Linux系统安装cacti

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

8. 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.

9. Cacti settings
http://IP/cacti

10. 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
    点赞
  • 0
    收藏
    觉得还不错? 一键收藏
  • 0
    评论
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值