上周的主要工作就是在公司的一台戴尔服务器上安装配置 Cacti,从而实现对公司所有的服务器及其应用的实时监控,在安装配置 Cacti 的过程中,我遇到了很多大大小小的问题,总之这些错误让我受益匪浅,所以我决定把安装配置的详细过程都写出来,希望能帮助到跟我有同样任务的朋友们,让他们少走些弯路,我在安装配置过程中遇到的错误,我也会一一提出并给出解决方案。需要说明的是配置安装 Cacti 的服务器是64位,所以一些 rpm 安装包我选用的都是 x86_64 安装包。所有下载的安装包,我都放在了服务器上的“/root/monitor”目录下。 现在,让我们开始 Cacti 的配置旅程吧!

1.

[root@pubservicedb monitor]# tar -xvf MySQL-5.5.9-1.linux2.6.x86_64.tar

[root@pubservicedb monitor]# rpm -ivh MySQL-server-5.5.9-1.linux2.6.x86_64.rpm
Preparing… #################################### [100%]
1:MySQL-server ################################### [100%]

[root@pubservicedb mysql]# cp my-small.cnf /etc

[root@pubservicedb mysql]# cd /etc

[root@pubservicedb etc]# mv my-small.cnf my.cnf

[root@pubservicedb etc]# vi my.cnf

#####################################

#——-inserted by chenjunlu——-#
#default-character-set = utf8
max_connections=1000
max_user_connections=500
wait_timeout=200
####################################

[root@pubservicedb monitor]# rpm -ivh MySQL-client-5.5.9-1.linux2.6.x86_64.rpm

Preparing… ####################################[100%]
1:MySQL-client ################################### [100%]

[root@pubservicedb monitor]#

[root@pubservicedb ~]# mysqld –user=mysql &

[1] 12224

[root@pubservicedb ~]# 110317 10:48:40 [Note] Plugin ‘FEDERATED’ is disabled.

110317 10:48:40 InnoDB: The InnoDB memory heap is disabled
110317 10:48:40 InnoDB: Mutexes and rw_locks use GCC atomic builtins
110317 10:48:40 InnoDB: Compressed tables use zlib 1.2.3
110317 10:48:40 InnoDB: Using Linux native AIO
110317 10:48:40 InnoDB: Initializing buffer pool, size = 128.0M
110317 10:48:40 InnoDB: Completed initialization of buffer pool
110317 10:48:40 InnoDB: highest supported file format is Barracuda.
110317 10:48:40 InnoDB: Waiting for the background threads to start
110317 10:48:41 InnoDB: 1.1.5 started; log sequence number 1595675
110317 10:48:41 [Note] Event Scheduler: Loaded 0 events
110317 10:48:41 [Note] mysqld: ready for connections.
Version: ’5.5.9′ socket: ‘/var/lib/mysql/mysql.sock’ port: 3306 MySQL Community Server (GPL)

[root@pubservicedb ~]# mysql -uroot

mysql: Unknown OS character set ‘GB18030′.
mysql: Switching to the default character set ‘latin1′.

Welcome to the MySQL monitor. Commands end with ; or \g.

Your MySQL connection id is 1

Server version: 5.5.9 MySQL Community Server (GPL)

Copyright (c) 2000, 2010, Oracle and/or its affiliates. All rights reserved.

Oracle is a registered trademark of Oracle Corporation and/or its

affiliates. Other names may be trademarks of their respective

owners.

Type ‘help;’ or ‘\h’ for help. Type ‘\c’ to clear the current input statement.

mysql> exit

Bye

[root@pubservicedb ~]# chkconfig –list | grep mysql
mysql 0:关闭 1:关闭 2:启用 3:启用 4:启用 5:启用 6:关闭

2.

[root@pubservicedb ~]# rpm -qa | grep httpd

httpd-2.2.3-43.el5
system-config-httpd-1.3.3.3-1.el5

[root@pubservicedb ~]# rpm -e httpd-2.2.3-43.el5

error: Failed dependencies:
httpd is needed by (installed) system-config-httpd-1.3.3.3-1.el5.noarch
[root@pubservicedb ~]# rpm -e httpd-2.2.3-43.el5
error: Failed dependencies:
httpd is needed by (installed) system-config-httpd-1.3.3.3-1.el5.noarch
[root@pubservicedb ~]# rpm -e system-config-httpd-1.3.3.3-1.el5
[root@pubservicedb ~]# rpm -e httpd-2.2.3-43.el5
[root@pubservicedb ~]#
[root@pubservicedb monitor]# tar -zxvf httpd-2.2.17.tar.gz
[root@pubservicedb httpd-2.2.17]# ./configure –prefix=/usr/local/apache –enable-so
[root@pubservicedb httpd-2.2.17]# make
[root@pubservicedb httpd-2.2.17]# make install

3.

[root@pubservicedb monitor]# tar -zxvf zlib-1.2.5.tar.gz

[root@pubservicedb monitor]# mv zlib-1.2.5 zlib
[root@pubservicedb monitor]# cd zlib
[root@pubservicedb zlib]# ./configure
[root@pubservicedb zlib]# make install

4.

[root@pubservicedb monitor]# rpm -qa | grep libpng

libpng-1.2.10-7.1.el5_3.2
libpng-1.2.10-7.1.el5_3.2

[root@pubservicedb monitor]# tar -zxvf libpng-1.5.1.tar.gz

[root@pubservicedb monitor]# mv libpng-1.5.1 libpng
[root@pubservicedb monitor]# cd libpng
[root@pubservicedb monitor]# ./configure –prefix=/usr/local/libpng
[root@pubservicedb monitor]# make
[root@pubservicedb monitor]# make install

5.

[root@pubservicedb freetype-2.4.4]# tar -zxvf freetype-2.4.4.tar.gz

[root@pubservicedb freetype-2.4.4]# cd freetype-2.4.4
[root@pubservicedb freetype-2.4.4]# ./configure –prefix=/usr/local/freetype
[root@pubservicedb freetype-2.4.4]# make
[root@pubservicedb freetype-2.4.4]# make install

6.

[root@pubservicedb monitor]# tar -zxvf jpegsrc.v8c.tar.gz

[root@pubservicedb monitor]# cd jpeg-8c/
[root@pubservicedb jpeg-8c]# mkdir -p /usr/local/libjpeg/man/man1
[root@pubservicedb jpeg-8c]# ./configure –prefix=/usr/local/libjpeg –enable-shared –enable-static
[root@pubservicedb jpeg-8c]# make
[root@pubservicedb jpeg-8c]# make install

7.

[root@pubservicedb monitor]# tar -zxvf libxml2-2.7.8.tar.gz

[root@pubservicedb monitor]# cd libxml2-2.7.8
[root@pubservicedb libxml2-2.7.8]# ./configure
[root@pubservicedb libxml2-2.7.8]# make
[root@pubservicedb libxml2-2.7.8]# make install

8.

[root@pubservicedb monitor]# tar -zxvf fontconfig-2.8.0.tar.gz

[root@pubservicedb monitor]# cd fontconfig-2.8.0
[root@pubservicedb fontconfig-2.8.0]# ./configure –prefix=/usr/local/fontconfig –with-freetype-config=/usr/local/freetype/bin/freetype-config
checking for LIBXML2… configure: error: Package requirements (libxml-2.0 >= 2.6) were not met:
No package ‘libxml-2.0′ found
[root@pubservicedb fontconfig-2.8.0]# find / -name libxml-2.0.pc
/root/monitor/libxml2-2.7.8/libxml-2.0.pc
/usr/local/lib/pkgconfig/libxml-2.0.pc
[root@pubservicedb fontconfig-2.8.0]# export PKG_CONFIG_PATH=/usr/local/lib/pkgconfig/:$PKG_CONFIG_PATH
[root@pubservicedb fontconfig-2.8.0]# ./configure –prefix=/usr/local/fontconfig –with-freetype-config=/usr/local/freetype/bin/freetype-config
[root@pubservicedb fontconfig-2.8.0]# make
[root@pubservicedb fontconfig-2.8.0]# make install

9.

[root@pubservicedb monitor]# tar zxvf gd-2.0.35.tar.gz

[root@pubservicedb monitor]# cd gd-2.0.35

[root@pubservicedb gd-2.0.35]# ./configure –with-zlib=/usr/local/zlib/ –with-jpeg=/usr/local/libjpeg/ –with-png=/usr/local/libpng/ –with-freetype=/usr/local/freetype/ –with-fontconfig=/usr/local/fontconfig –prefix=/usr/local/libgd

** Configuration summary for gd 2.0.34:

Support for PNG library: yes

Support for JPEG library: yes
Support for Freetype 2.x library: yes
Support for Fontconfig library: yes
Support for Xpm library: no
Support for pthreads: yes

[root@pubservicedb gd-2.0.35]# make

gd_png.c:16:53: error: png.h: No such file or directory

[root@pubservicedb gd-2.0.35]# make clean

[root@pubservicedb gd-2.0.35]# vi gd_png.c

/*——————————————————————–

#include “png.h” /* includes zlib.h and setjmp.h */
——————————————————————–*/

#include “/usr/local/libpng/include/png.h”

[root@pubservicedb gd-2.0.35]# make

[root@pubservicedb gd-2.0.35]# make install

10. 配置 /etc/ld.so.conf 文件

[root@pubservicedb gd-2.0.35]# vi /etc/ld.so.conf

include ld.so.conf.d/*.conf

/usr/local/zlib/lib
/usr/local/freetype/lib
/usr/local/libjpeg/lib
/usr/local/libgd/lib

[root@pubservicedb gd-2.0.35]# ldconfig

[root@pubservicedb gd-2.0.35]#

11.

[root@pubservicedb monitor]# tar -zxvf php-5.3.5.tar.gz

[root@pubservicedb monitor]# cd php-5.3.5

[root@pubservicedb php-5.3.5]#

[root@pubservicedb php-5.3.5]# ./configure –prefix=/usr/local/php –with-apxs2=/usr/local/apache/bin/apxs –with-mysql –with-gd=/usr/local/libgd –enable-gd-native-ttf –enable-gd-jis-conv –with-freetype-dir=/usr/local/freetype –with-jpeg-dir=/usr/local/libjpeg –with-png-dir=/usr/local/libpng –with-zlib-dir=/usr/local/zlib –enable-xml –enable-mbstring –enable-sockets

checking for specified location of the MySQL UNIX socket… no

configure: error: Cannot find MySQL header files under yes.
Note that the MySQL client library is not bundled anymore!

[root@pubservicedb php-5.3.5]# find / -name mysql.h

[root@pubservicedb php-5.3.5]#

[root@pubservicedb monitor]# rpm -ivh MySQL-devel-5.5.9-1.linux2.6.x86_64.rpm

Preparing… #################################### [100%]

1:MySQL-devel ################################### [100%]

[root@pubservicedb monitor]# find / -name mysql.h

/usr/include/mysql/mysql.h

[root@pubservicedb monitor]# cd php-5.3.5

[root@pubservicedb php-5.3.5]# ./configure –prefix=/usr/local/php –with-apxs2=/usr/local/apache/bin/apxs –with-gd=/usr/local/libgd –enable-gd-native-ttf –enable-gd-jis-conv –with-freetype-dir=/usr/local/freetype –with-jpeg-dir=/usr/local/libjpeg –with-png-dir=/usr/local/libpng –with-zlib-dir=/usr/local/zlib –enable-xml –enable-mbstring –enable-sockets –with-mysql=/usr/include/mysql/

checking for specified location of the MySQL UNIX socket… no

configure: error: Cannot find libmysqlclient under /usr.

Note that the MySQL client library is not bundled anymore!

[root@pubservicedb php-5.3.5]# cp -rp /usr/lib64/mysql/libmysqlclient.a /usr/lib/libmysqlclient.a

[root@pubservicedb php-5.3.5]# ./configure –prefix=/usr/local/php –with-apxs2=/usr/local/apache/bin/apxs –with-gd=/usr/local/libgd –enable-gd-native-ttf –enable-gd-jis-conv –with-freetype-dir=/usr/local/freetype –with-jpeg-dir=/usr/local/libjpeg –with-png-dir=/usr/local/libpng –with-zlib-dir=/usr/local/zlib –enable-xml –enable-mbstring –enable-sockets –with-mysql=/usr/include/mysql/

+——————————————————————–+

| License: |

| This software is subject to the PHP License, available in this |
| distribution in the file LICENSE. By continuing this installation |
| process, you are bound by the terms of this license agreement. |
| If you do not agree with the terms of this license, you must abort |
| the installation process at this point. |

+——————————————————————–+

Thank you for using PHP.

[root@pubservicedb php-5.3.5]# make

Build complete.

Don’t forget to run ‘make test’.

[root@pubservicedb php-5.3.5]# make install

Installing PHP SAPI module: apache2handler

/usr/local/apache/build/instdso.sh SH_LIBTOOL=’/usr/local/apache/build/libtool’ libphp5.la /usr/local/apache/modules

/usr/local/apache/build/libtool –mode=install cp libphp5.la /usr/local/apache/modules/

cp .libs/libphp5.so /usr/local/apache/modules/libphp5.so

cp .libs/libphp5.lai /usr/local/apache/modules/libphp5.la

libtool: install: warning: remember to run `libtool –finish /root/monitor/php-5.3.5/libs’

chmod 755 /usr/local/apache/modules/libphp5.so

[activating module `php5' in /usr/local/apache/conf/httpd.conf]

Installing PHP CLI binary: /usr/local/php/bin/

Installing PHP CLI man page: /usr/local/php/man/man1/
Installing build environment: /usr/local/php/lib/php/build/
Installing header files: /usr/local/php/include/php/
Installing helper programs: /usr/local/php/bin/
program: phpize
program: php-config
Installing man pages: /usr/local/php/man/man1/
page: phpize.1
page: php-config.1
Installing PEAR environment: /usr/local/php/lib/php/

[PEAR] Archive_Tar – installed: 1.3.7

[PEAR] Console_Getopt – installed: 1.2.3
[PEAR] Structures_Graph- installed: 1.0.3
[PEAR] XML_Util – installed: 1.2.1
[PEAR] PEAR – installed: 1.9.1

Wrote PEAR system config file at: /usr/local/php/etc/pear.conf

You may want to add: /usr/local/php/lib/php to your php.ini include_path

/root/monitor/php-5.3.5/build/shtool install -c ext/phar/phar.phar /usr/local/php/bin

ln -s -f /usr/local/php/bin/phar.phar /usr/local/php/bin/phar

Installing PDO headers: /usr/local/php/include/php/ext/pdo/

[root@pubservicedb php-5.3.5]# ls -s /usr/local/php/bin/* /usr/local/bin/

4 /usr/local/php/bin/pear 0 /usr/local/php/bin/phar 4 /usr/local/php/bin/php-config

4 /usr/local/php/bin/peardev 16 /usr/local/php/bin/phar.phar 8 /usr/local/php/bin/phpize

4 /usr/local/php/bin/pecl 29980 /usr/local/php/bin/php

/usr/local/bin/:

总计 400

20 annotate 4 dbhome 16 gd2topng 16 gdparttopng 4 oraenv 24 webpng 156 xmllint

4 bdftogd 16 gd2copypal 16 gdcmpgif 16 gdtopng 16 pngtogd 4 xml2-config

4 coraenv 16 gd2togif 4 gdlib-config 16 giftogd2 16 pngtogd2 32 xmlcatalog

[root@pubservicedb php-5.3.5]#

对php 编译选项的解释:

  • –prefix=/usr/local/php //指定PHP的安装目录

  • –with-apxs2=/usr/local/apache2/bin/apxs //支持Apache模块

  • –with-mysql=/usr/include/mysql //支持MySQl

  • –with-gd=/usr/local/libgd //支持GD库

  • –enable-gd-native-ttf //激活对本地TrueType字符串函数的支持

  • –with-freetype-dir=/usr/local/freetype //激活对FreeType 2.x的支持

  • –with-jpeg-dir=/usr/local/libjpeg //激活对jpeg-6b的支持

  • –with-png-dir //激活对png的支持

  • –with-zlib-dir=/usr/local/zlib//激活对zlib的支持

  • –enable-mbstring //激活mbstring模块

  • –enable-gd-jis-conv //使JIS-mapped可用,支持日文字体

  • –enable-xml //支持XML

  • –enable-sockets //支持套接字

12. 配置 httpd.conf

[root@pubservicedb php-5.3.5]# vi /usr/local/apache/conf/httpd.conf

AddType application/x-compress .Z

AddType application/x-gzip .gz .tgz
AddType application/x-tar .tgz
AddType application/x-httpd-php .php
AddType p_w_picpath/x-icon .ico

DirectoryIndex index.php index.html index.html.var

[root@pubservicedb php-5.3.5]# vi /usr/local/apache/htdocs/test.php

[root@pubservicedb php-5.3.5]# /usr/local/apache/bin/apachectl -k stop

httpd: Could not reliably determine the server’s fully qualified domain name, using 10.10.6.201 for ServerName

httpd (no pid file) not running

[root@pubservicedb php-5.3.5]# /usr/local/apache/bin/apachectl -k start

httpd: Could not reliably determine the server’s fully qualified domain name, using 10.10.6.201 for ServerName

[root@pubservicedb monitor]# links http://10.10.6.201/test.php

也可以在浏览器的地址栏输入“http://10.10.6.201/test.php”,如果显示 php 版本信息,则表示安装成功。

13.

[root@pubservicedb monitor]# tar -zxvf rrdtool-1.4.5.tar.gz

[root@pubservicedb monitor]# cd rrdtool-1.4.5

[root@pubservicedb rrdtool-1.4.5]# ./configure –prefix=/usr/local/rrdtool

Find 3rd-Party Libraries

checking for libdbi… no

checking for libwrap… yes
checking for cairo_font_options_create in -lcairo… no
checking for pkg-config… pkg-config

configure: WARNING:

—————————————————————————-

* I found a copy of pkgconfig, but there is no cairo-png.pc file around.

You may want to set the PKG_CONFIG_PATH variable to point to its

location.

—————————————————————————-
configure: WARNING:
—————————————————————————-
* I could not find a working copy of cairo-png. Check config.log for hints on why
this is the case. Maybe you need to set LDFLAGS and CPPFLAGS appropriately
so that compiler and the linker can find libcairo and its header files. If
you have not installed cairo-png, you can get it either from its original home on

http://cairographics.org/releases/

You can find also find an archive copy on

http://oss.oetiker.ch/rrdtool/pub/libs

The last tested version of cairo-png is 1.4.6.

LIBS=-lm -lwrap
LDFLAGS=
CPPFLAGS=
—————————————————————————-
checking for cairo_svg_surface_create in -lcairo… no
checking for pkg-config… (cached) pkg-config
configure: WARNING:
—————————————————————————-
* I found a copy of pkgconfig, but there is no cairo-svg.pc file around.
You may want to set the PKG_CONFIG_PATH variable to point to its
location.
—————————————————————————-
configure: WARNING:
—————————————————————————-
* I could not find a working copy of cairo-svg. Check config.log for hints on why
this is the case. Maybe you need to set LDFLAGS and CPPFLAGS appropriately
so that compiler and the linker can find libcairo and its header files. If
you have not installed cairo-svg, you can get it either from its original home on

http://cairographics.org/releases/

You can find also find an archive copy on

http://oss.oetiker.ch/rrdtool/pub/libs

The last tested version of cairo-svg is 1.4.6.

LIBS=-lm -lwrap
LDFLAGS=
CPPFLAGS=
—————————————————————————-
checking for cairo_pdf_surface_create in -lcairo… no
checking for pkg-config… (cached) pkg-config
configure: WARNING:
—————————————————————————-
* I found a copy of pkgconfig, but there is no cairo-pdf.pc file around.
You may want to set the PKG_CONFIG_PATH variable to point to its
location.
—————————————————————————-
configure: WARNING:
—————————————————————————-
* I could not find a working copy of cairo-pdf. Check config.log for hints on why
this is the case. Maybe you need to set LDFLAGS and CPPFLAGS appropriately
so that compiler and the linker can find libcairo and its header files. If
you have not installed cairo-pdf, you can get it either from its original home on

http://cairographics.org/releases/

You can find also find an archive copy on

http://oss.oetiker.ch/rrdtool/pub/libs

The last tested version of cairo-pdf is 1.4.6.

LIBS=-lm -lwrap
LDFLAGS=
CPPFLAGS=
—————————————————————————-
checking for cairo_ps_surface_create in -lcairo… no
checking for pkg-config… (cached) pkg-config
configure: WARNING:
—————————————————————————-
* I found a copy of pkgconfig, but there is no cairo-ps.pc file around.
You may want to set the PKG_CONFIG_PATH variable to point to its
location.
—————————————————————————-
configure: WARNING:
—————————————————————————-
* I could not find a working copy of cairo-ps. Check config.log for hints on why
this is the case. Maybe you need to set LDFLAGS and CPPFLAGS appropriately
so that compiler and the linker can find libcairo and its header files. If
you have not installed cairo-ps, you can get it either from its original home on

http://cairographics.org/releases/

You can find also find an archive copy on

http://oss.oetiker.ch/rrdtool/pub/libs

The last tested version of cairo-ps is 1.4.6.

LIBS=-lm -lwrap
LDFLAGS=
CPPFLAGS=
—————————————————————————-
checking for glib_check_version in -lglib-2.0… no
checking for pkg-config… (cached) pkg-config
configure: WARNING:
—————————————————————————-
* I found a copy of pkgconfig, but there is no glib-2.0.pc file around.
You may want to set the PKG_CONFIG_PATH variable to point to its
location.
—————————————————————————-
configure: WARNING:
—————————————————————————-
* I could not find a working copy of glib-2.0. Check config.log for hints on why
this is the case. Maybe you need to set LDFLAGS and CPPFLAGS appropriately
so that compiler and the linker can find libglib-2.0 and its header files. If
you have not installed glib-2.0, you can get it either from its original home on
ftp://ftp.gtk.org/pub/glib/2.12/
You can find also find an archive copy on

http://oss.oetiker.ch/rrdtool/pub/libs

The last tested version of glib-2.0 is 2.12.12.

LIBS=-lm -lwrap
LDFLAGS=
CPPFLAGS=
—————————————————————————-
checking for pango_cairo_context_set_font_options in -lpangocairo-1.0… no
checking for pkg-config… (cached) pkg-config
configure: WARNING:
—————————————————————————-
* I found a copy of pkgconfig, but there is no pangocairo.pc file around.
You may want to set the PKG_CONFIG_PATH variable to point to its
location.
—————————————————————————-
configure: WARNING:
—————————————————————————-
* I could not find a working copy of pangocairo. Check config.log for hints on why
this is the case. Maybe you need to set LDFLAGS and CPPFLAGS appropriately
so that compiler and the linker can find libpangocairo-1.0 and its header files. If
you have not installed pangocairo, you can get it either from its original home on

http://ftp.gnome.org/pub/GNOME/sources/pango/1.17

You can find also find an archive copy on

http://oss.oetiker.ch/rrdtool/pub/libs

The last tested version of pangocairo is 1.17.

LIBS=-lm -lwrap
LDFLAGS=
CPPFLAGS=
—————————————————————————-
checking for xmlParseFile in -lxml2… yes
checking libxml/parser.h usability… no
checking libxml/parser.h presence… no
checking for libxml/parser.h… no
checking for pkg-config… (cached) pkg-config
checking for xmlParseFile in -lxml2… yes
checking libxml/parser.h usability… yes
checking libxml/parser.h presence… yes
checking for libxml/parser.h… yes
configure: error: Please fix the library issues listed above and try again.

13.1

[root@pubservicedb pango-1.28.3]# cd ..

[root@pubservicedb monitor]# tar -zxvf glib-2.28.3.tar.gz
[root@pubservicedb monitor]# cd glib-2.28.3
[root@pubservicedb glib-2.28.3]# ./configure

/usr/bin/msgfmt -o test.mo ./de.po; \

/bin/mkdir -p de/LC_MESSAGES; \
cp -f test.mo de/LC_MESSAGES
./de.po:15: 关键字“msgctxt”未知
./de.po:15:8: parse error
/usr/bin/msgfmt: 发现 2 处致命错误

当前系统没有安装 gettext 包,请参考13.4节安装,然后继续安装 glib 包:

[root@pubservicedb monitor]# cd glib-2.28.3

[root@pubservicedb glib-2.28.3]# ./configure

[root@pubservicedb glib-2.28.3]# make
[root@pubservicedb glib-2.28.3]# make install

13.2

[root@pubservicedb monitor]# tar -zxvf pixman-0.21.6.tar.gz

[root@pubservicedb monitor]# cd pixman-0.21.6
[root@pubservicedb pixman-0.21.6]# ./configure
[root@pubservicedb pixman-0.21.6]# make
[root@pubservicedb pixman-0.21.6]# make install

13.3

[root@pubservicedb pixman-0.21.6]# cd ..

[root@pubservicedb monitor]# cd cairo-1.10.2
[root@pubservicedb cairo-1.10.2]# ./configure
cairo (version 1.10.2 [release]) will be compiled with:

The following surface backends:

Image: yes (always builtin)

Recording: yes (always builtin)
Tee: no (disabled, use –enable-tee to enable)
XML: no (disabled, use –enable-xml to enable)
Skia: no (disabled, use –enable-skia to enable)
Xlib: no (requires X development libraries)
Xlib Xrender: no (requires –enable-xlib)
Qt: no (disabled, use –enable-qt to enable)
Quartz: no (requires CoreGraphics framework)
Quartz-p_w_picpath: no (disabled, use –enable-quartz-p_w_picpath to enable)
XCB: no (disabled, use –enable-xcb to enable)
Win32: no (requires a Win32 platform)
OS2: no (disabled, use –enable-os2 to enable)
CairoScript: no (disabled, use –enable-script to enable)
PostScript: yes
PDF: yes
SVG: yes
OpenGL: no (disabled, use –enable-gl to enable)
BeOS: no (disabled, use –enable-beos to enable)
DirectFB: no (disabled, use –enable-directfb to enable)
OpenVG: no (disabled, use –enable-vg to enable)
DRM: no (disabled, use –enable-drm to enable)

The following font backends:

User: yes (always builtin)

FreeType: yes
Fontconfig: yes
Win32: no (requires a Win32 platform)
Quartz: no (requires CoreGraphics framework)

The following functions:

PNG functions: yes

GLEW functions: no (not required by any backend)
GLX functions: no (not required by any backend)
WGL functions: no (not required by any backend)
EGL functions: no (not required by any backend)
X11-xcb functions: no (disabled, use –enable-xlib-xcb to enable)
XCB-drm functions: no (disabled, use –enable-xcb-drm to enable)
XCB-shm functions: no (requires –enable-xcb)
DRM-Xr functions: no (disabled, use –enable-drm-xr to enable)

The following features and utilities:

cairo-trace: yes

cairo-script-interpreter: yes

And the following internal features:

pthread: yes

gtk-doc: no
gcov support: no
symbol-lookup: no (requires bfd)
test surfaces: no (disabled, use –enable-test-surfaces to enable)
ps testing: no (requires libspectre)
pdf testing: no (requires poppler-glib >= 0.13.3)
svg testing: no (requires librsvg-2.0 >= 2.15.0)

*** No native surface backends enabled for your platform. It is strongly

*** recommended that you enable the native surface backend feature for your
*** platform.

[root@pubservicedb cairo-1.10.2]# make

[root@pubservicedb cairo-1.10.2]# make install

13.4

[root@pubservicedb glib-2.28.3]# cd ..

[root@pubservicedb monitor]# tar -zxvf gettext-0.18.1.1.tar.gz
[root@pubservicedb monitor]# cd gettext-0.18.1.1
[root@pubservicedb gettext-0.18.1.1]# ./configure
[root@pubservicedb gettext-0.18.1.1]# make

[root@pubservicedb gettext-0.18.1.1]# make install

13.5

[root@pubservicedb Server]# rpm -ivh pango-devel-1.14.9-6.el5.x86_64.rpm

warning: pango-devel-1.14.9-6.el5.x86_64.rpm: Header V3 DSA signature: NOKEY, key ID 37017186
Preparing… ####################################[100%]
1:pango-devel ####################################[100%]

[root@pubservicedb Server]#

本来我打算用 Tarball 包安装 pango 的,但是在我经历了无数次失败后,我放弃了,我分析的原因大概是系统中已经存在 rpm 版本的 pango 所以编译安装的办法可能行不通,所以我最后又安装了 pango 的 devel 包,这样 RRDTool 安装包就可以顺利的使用 pango 的源代码编译了。最后 RRDTool 工具的安装过程如下:

[root@pubservicedb rrdtool-1.4.5]# export PKG_CONFIG_PATH=/usr/local/fontconfig/lib/pkgconfig/:/usr/local/freetype/lib/pkgconfig/:\

/usr/local/libpng/lib/pkgconfig/:/usr/local/lib/pkgconfig/:/usr/local/lib/pkgconfig/:

[root@pubservicedb rrdtool-1.4.5]# ./configure –prefix=/usr/local/rrdtool

[root@pubservicedb rrdtool-1.4.5]# make
[root@pubservicedb rrdtool-1.4.5]# make install

[root@pubservicedb rrdtool-1.4.5]# ln -s /usr/local/rrdtool/bin/* /usr/local/bin/

14.

[root@pubservicedb monitor]# tar -zxvf net-snmp-5.6.1.tar.gz

[root@pubservicedb monitor]# cd net-snmp-5.6.1

[root@pubservicedb net-snmp-5.6.1]# ./configure –prefix=/usr/local/net-snmp –enable-developer

———————————————————

Net-SNMP configuration summary:
———————————————————

SNMP Versions Supported: 1 2c 3

Building for: linux
Net-SNMP Version: 5.6.1
Network transport support: Callback Unix Alias TCP UDP IPv4Base SocketBase TCPBase UDPIPv4Base UDPBase
SNMPv3 Security Modules: usm
Agent MIB code: default_modules => snmpv3mibs mibII ucd_snmp notification notification-log-mib target agent_mibs agentx disman/event disman/schedule utilities host
MYSQL Trap Logging: unavailable
Embedded Perl support: enabled
SNMP Perl modules: building — embeddable
SNMP Python modules: disabled
Crypto support from: internal
Authentication support: MD5 SHA1
Encryption support: DES AES
WARNING: This platform does not yet support hrSWInstalledTable rewrites
———————————————————

[root@pubservicedb net-snmp-5.6.1]# make

[root@pubservicedb net-snmp-5.6.1]# make install
[root@pubservicedb net-snmp-5.6.1]# ln -s /usr/local/net-snmp/bin/* /usr/local/bin/
[root@pubservicedb net-snmp-5.6.1]# cp EXAMPLE.conf /usr/local/net-snmp/share/snmp/snmpd.conf
[root@pubservicedb net-snmp-5.6.1]# vi /etc/rc.d/rc.local
/usr/local/net-snmp/sbin/snmpd

[root@pubservicedb net-snmp-5.6.1]# /usr/local/net-snmp/sbin/snmpd

15.

[root@pubservicedb net-snmp-5.6.1]# mv cacti-0.8.7g.tar.gz /usr/local/apache/htdocs/

[root@pubservicedb net-snmp-5.6.1]# cd /usr/local/apache/htdocs/

[root@pubservicedb htdocs]# tar -zxvf cacti-0.8.7g.tar.gz
[root@pubservicedb htdocs]# mv cacti-0.8.7g cacti
[root@pubservicedb htdocs]# vi cacti/include/config.php

/* make sure these values refect your actual database/host/user/password */

$database_type = “mysql”;

$database_default = “cacti”;
$database_hostname = “localhost”;
$database_username = “cacti”;
$database_password = “cacti”;
$database_port = “3306″;

/* Default session name – Session name must contain alpha characters */

#$cacti_session_name = “Cacti”;

[root@pubservicedb htdocs]# useradd cacti

[root@pubservicedb htdocs]# chown -R cacti /usr/local/apache/htdocs/cacti/rra
[root@pubservicedb htdocs]# chgrp -R cacti /usr/local/apache/htdocs/cacti
[root@pubservicedb htdocs]# su – cacti
[cacti@pubservicedb ~]$ crontab -e
*/5 * * * * /usr/local/php/bin/php /usr/local/apache/htdocs/cacti/poller.php > /dev/null 2>&1

16.

[root@pubservicedb ~]# cd monitor/

[root@pubservicedb monitor]# tar -zxvf cacti-spine-0.8.7g.tar.gz

[root@pubservicedb monitor]# cd cacti-spine-0.8.7g

[root@pubservicedb cacti-spine-0.8.7g]# ./configure –with-mysql=/usr/include/mysql/ –with-snmp=/usr/local/net-snmp

checking priv.h presence… no
checking for priv.h… no
checking whether we are using Solaris privileges… no
checking for mysql_init in -lmysqlclient_r… no
configure: error: MySQL libraries not found

[root@pubservicedb cacti-spine-0.8.7g]#

I everybody,

i was with the same problem on RH4 using an x86_64 kernel (2.6.9-5.ELsmp) , and i resolved it by modification in configure file.
Line 4864: str=”$i/lib/mysql/libmysqlclient.*”
replaced by : str=”$i/lib64/mysql/libmysqlclient.*”
Line 4867: MYSQL_LIB_DIR=$i/lib/mysql
by MYSQL_LIB_DIR=$i/lib64/mysql
Afterthat, compilation finished with success !

[root@pubservicedb cacti-spine-0.8.7g]# find / -name libmysqlclient_r.*

/usr/lib64/mysql/libmysqlclient_r.a

[root@pubservicedb cacti-spine-0.8.7g]# ln -s /usr/lib64/mysql/libmysqlclient_r.a /usr/lib64/libmysqlclient_r.a

[root@pubservicedb monitor]# rpm -ivh MySQL-embedded-5.5.9-1.linux2.6.x86_64.rpm
[root@pubservicedb monitor]# rpm -ivh MySQL-shared-5.5.9-1.linux2.6.x86_64.rpm
[root@pubservicedb monitor]# rpm -ivh MySQL-test-5.5.9-1.linux2.6.x86_64.rpm

[root@pubservicedb monitor]# ./configure –with-mysql=/usr/include/mysql/ –with-snmp=/usr/local/net-snmp

[root@pubservicedb cacti-spine-0.8.7g]# make
[root@pubservicedb cacti-spine-0.8.7g]# make install
make[1]: Entering directory `/root/monitor/cacti-spine-0.8.7g’
test -z “/usr/local/spine/bin” || /bin/mkdir -p “/usr/local/spine/bin”
/bin/sh ./libtool –mode=install /usr/bin/install -c spine ‘/usr/local/spine/bin’
libtool: install: /usr/bin/install -c spine /usr/local/spine/bin/spine
test -z “/usr/local/spine/etc” || /bin/mkdir -p “/usr/local/spine/etc”
/usr/bin/install -c -m 644 spine.conf.dist ‘/usr/local/spine/etc’
make[1]: Leaving directory `/root/monitor/cacti-spine-0.8.7g’

[root@pubservicedb cacti-spine-0.8.7g]# cd /usr/local/spine/etc

[root@pubservicedb etc]# cp spine.conf.dist spine.conf
[root@pubservicedb etc]# vi spine.conf

DB_Host 127.0.0.1

DB_Database cacti
DB_User cacti
DB_Pass cacti
DB_Port 3306
DB_PreG 0

[root@pubservicedb etc]# mv spine.conf /etc/

17. Cacti 配置

[root@pubservicedb etc]# mysql -uroot

mysql: Unknown OS character set ‘GB18030′.
mysql: Switching to the default character set ‘latin1′.
Welcome to the MySQL monitor. Commands end with ; or \g.
Your MySQL connection id is 379
Server version: 5.5.9 MySQL Community Server (GPL)
Copyright (c) 2000, 2010, Oracle and/or its affiliates. All rights reserved.
Oracle is a registered trademark of Oracle Corporation and/or its
affiliates. Other names may be trademarks of their respective
owners.

Type ‘help;’ or ‘\h’ for help. Type ‘\c’ to clear the current input statement.

mysql> create database cacti;

Query OK, 1 row affected (0.00 sec)

mysql> grant all on cacti.* to cacti@localhost identified by “cacti”;

Query OK, 0 row affected (0.00 sec)

mysql>quit

BYE

[root@pubservicedb cacti]# mysql -uroot cacti < cacti.sql

mysql: Unknown OS character set ‘GB18030′. mysql: Switching to the default character set ‘latin1′. ERROR 1064 (42000) at line 5: You have an error in your SQL syntax; check the manual that corresponds to your MySQL server version for the right syntax to use near ‘TYPE=MyISAM’ at line 6

[root@pubservicedb cacti]# sed -e ‘s/TYPE=MyISAM/ENGINE=MyISAM/g’ cacti.sql > cacti_5.5.sql

[root@pubservicedb cacti]# mysql -uroot cacti < cacti_5.5.sql
mysql: Unknown OS character set ‘GB18030′.
mysql: Switching to the default character set ‘latin1′.

[root@pubservicedb cacti]# su – cacti

[cacti@pubservicedb cacti]$ /usr/local/php/bin/php /usr/local/apache/htdocs/cacti/poller.php

[root@pubservicedb lib]# cp /root/monitor/php-5.3.5/php.ini-production /usr/local/php/lib/php.ini

[root@pubservicedb lib]# vi /usr/local/php/lib/php.ini

date.timezone = Asia/Chongqing

[root@pubservicedb lib]# /usr/local/apache/bin/apachectl -k restart

httpd: Could not reliably determine the server’s fully qualified domain name, using 10.10.6.201 for ServerName

18.

[root@pubservicedb monitor]# tar -zxvf cacti-plugin-0.8.7g-PA-v2.9.tar.gz

[root@pubservicedb monitor]# cd cacti-plugin-arch/
[root@pubservicedb cacti-plugin-arch]# sed -e ‘s/TYPE=MyISAM/ENGINE=MyISAM/g’ pa.sql > pa_5.5.sql
[root@pubservicedb cacti-plugin-arch]# mysql -ucacti -p cacti < pa_5.5.sql
[root@pubservicedb cacti-plugin-arch]# cd files-0.8.7g/
[root@pubservicedb files-0.8.7g]# cp -rf * /usr/local/apache/htdocs/cacti/
[root@pubservicedb files-0.8.7g]# chown -R cacti /usr/local/apache/htdocs/cacti/rra
[root@pubservicedb files-0.8.7g]# chgrp -R cacti /usr/local/apache/htdocs/cacti
[root@pubservicedb files-0.8.7g]# vi /usr/local/apache/htdocs/cacti/include/config.php

/* make sure these values refect your actual database/host/user/password */

$database_type = “mysql”;
$database_default = “cacti”;
$database_hostname = “localhost”;
$database_username = “cacti”;
$database_password = “cacti”;
$database_port = “3306″;

/* load up old style plugins here */

$plugins = array();
//$plugins[] = ‘thold’;

/*

Edit this to point to the default URL of your Cacti install
ex: if your cacti install as at http://serverip/cacti/ this
would be set to /cacti/
*/
$url_path = “/cacti/”;

/* Default session name – Session name must contain alpha characters */

#$cacti_session_name = “Cacti”;

然后在浏览器中打开 Cacti,更改 User Management,给予 admin 用户用于 Plugin Management 权限