ITeye博客

Linux系统安装cacti

yanwenhan · 2008-07-24 16:07 · 流量监控 · Markdown

Installing Cacti on Linux

1.Mysql source code installation

shell> groupadd mysql shell> useradd -g mysql mysql shell> gunzip < mysql-VERSION.tar.gz | tar -xvf - shell> cd mysql-VERSION shell> ./configure --prefix=/usr/local/mysql shell> make shell> make install shell> cp support-files/my-medium.cnf /etc/my.cnf shell> cd /usr/local/mysql shell> bin/mysql_install_db --user=mysql shell> chown -R root . shell> chown -R mysql var shell> chgrp -R mysql . shell> bin/mysqld_safe --user=mysql &

cp ./support-files/mysql.server /etc/init.d/mysql (In mysql scurce code directory) chmod +x /etc/init.d/mysql cd /etc/rc3.d and rc5.d ln -s ../init.d/mysql S86mysql ln -s ../init.d/mysql K86mysql (Note: the number in filename doesn't conflict with other scripts)

2. Apache installation

./configure --prefix=/www --enable-so make && make install

cp /www/bin/apachectl /etc/init.d/httpd cd /etc/rc3.d and rc5.d ln -s ../init.d/httpd S87httpd ln -s ../init.d/httpd K87httpd

or chkconfig --add httpd chkconfig --level 35 httpd on

3. PHP Installation

./configure --prefix=/www/php --with-apxs2=/www/bin/apxs --with-config-file-path=/www/php --enable-sockets --with-mysql=/usr/local/mysql --with-zlib-dir=/usr/include --with-gd make && make install cp php.ini-dist /www/php/php.ini vi /www/conf/httpd.conf 加入: ###############for php and cacti################### AddType application/x-tar .tgz AddType application/x-httpd-php .php AddType image/x-icon .ico DirectoryIndex index.php index.html index.html.var #######################over########################

/etc/init.d/httpd restart

4.

Mysql setting

/usr/local/mysql/bin/mysql -u root -p mysql> set password for root@localhost=password('cactipw'); mysql> Query OK, 0 rows affected (0.00 sec) mysql> create database cacti; mysql> grant all on cacti.* to root; mysql> grant all on cacti.* to root@localhost; mysql> grant all on cacti.* to cactiuser; mysql> grant all on cacti.* to cactiuser@localhost; mysql> set password for cactiuser@localhost=password('cactipw'); mysql> flush privileges; (See cacti docs/INSTALL) mysql> exit

5、rrdtool installation download: http://people.ee.ethz.ch/~oetike ... dtool-1.0.50.tar.gz then ./configure make && make install

6、net-snmp installation Download the latest version and install it.

7、cacti installation

cp cacti-0.8.6g.tar.gz /www/htdocs tar xzvf cacti-0.8.6g.tar.gz mv cacti-0.8.6g cacti cd cacti

/usr/local/mysql/bin/mysql –u root –psccmrtg cacti < cacti.sql

chown –R cactiuser rra/ log/ or chown -R cactiuser /www/htdocs/cacti

vi /www/htdocs/cacti/include/config.php

$database_type = “mysql”; $database_default = “cacti”; $database_hostname = “localhost”; $database_username = “cactiuser”; $database_password = “cactipw”;

useradd cactiuser passwd cactiuser su - cactiuser Crontab –u cactiuser –e

*/5 * * * * /www/php/bin/php /www/htdocs/cacti/poller.php > /dev/null 2>&1

/etc/init.d/crond restart

Logon to internet and perform below command in shell window:

wget http://www.cacti.net/downloads/p ... g_parse_error.patch wget http://www.cacti.net/downloads/p ... operties_zoom.patch wget http://www.cacti.net/downloads/p ... ver_snmp_auth.patch wget http://www.cacti.net/downloads/p ... _file_loading.patch patch -p1 -N < short_open_tag_parse_error.patch patch -p1 -N < graph_properties_zoom.patch patch -p1 -N < script_server_snmp_auth.patch patch -p1 -N < mib_file_loading.patch

cactid installation ./configure --with-mysql=/usr/local/mysql/include make && make install

modify cactid.conf and copy it to /usr/local/cactid/

ln -s /tmp/mysql.sock /var/lib/mysql/mysql.sock or cd /var/lib ln -s /tmp mysql

  1. threshold installation.(Add email or syslog alert function) thold-0.2.5.zip cd thold-0.2.5 ./install.sh /www/htdocs/cacti/ cactiuser cactipw

You'd better add /usr/local/mysql/bin to $PATH.

  1. Cacti settings http://IP/cacti

  2. other plugins installation Monitor, Report,...

If you want to migrate cacti to another host, just use mysqldump to export cacti configuration, use source command in mysql to inport config, then copy /log and /rra to new host.

评论(0)

暂无评论。

评论功能维护中,当前仅展示历史评论。