Centos下Cacti快速shell安装程序精简版
Centos下Cacti快速shell安装程序的过程如下!
有朋友说
cacti安装一条龙h
ttp://blog.chinaunix.net/u1/46222/showart_1000408.html
太麻烦,太复杂了?所以做个精简版shell程序进行快速安装,以使用cacti监测系统性能及网络流量
经测试撰写的, 欢迎大家批评指教
在 CentOS 5.1 上安装比 Fedora 7 麻烦很多, 主要是因为没有 yum
cacti,可用要自己判断和安装一大堆附件。
如果还是认为麻烦,哪就直接去下载CactiEZ CD光盘镜像。
下载Cactiez 0.4 CD
Shell安装代码:
echo -e "******************************************"
echo -e "Program : cacti_centos51_small.20080501.sh "
echo -e "Cacti Install Shell Script (CentOS 5.1) "
echo -e "by Lu 2008/05/01 "
echo -e "******************************************"
echo ""
#先要保证你的Centos系统能够正常上网,因为yum程序要从网络安装需要的附加开发套件。
yum -y install httpd mysql-server cacti php php-mysql php-snmp net-snmp
net-snmp-libs net-snmp-utils rrdtool gcc libart_lgpl-devel zlib-devel
libpng-devel freetype-devel
wget http://www.cacti.net/downloads/cacti-0.8.7b.tar.gz
wget http://oss.oetiker.ch/rrdtool/pub/rrdtool-1.2.27.tar.gz
chkconfig snmpd on
chkconfig httpd on
chkconfig mysqld on
service snmpd restart
service httpd restart
service mysqld restart
tar zxvf rrdtool-1.2.27.tar.gz
cd rrdtool-1.2.27
./configure
make
make install
ln -s /usr/local/rrdtool-1.2.27/bin/rrdtool /usr/local/bin/rrdtool
cd ..
tar zxvf cacti-0.8.7b.tar.gz -C /var/www/html
mv /var/www/html/cacti-0.8.7b /var/www/html/cacti
cd /var/www/html/cacti
#建立cacti数据库及设置用户访问权限
mysqladmin --user=root create cacti
mysql -e "use cacti; show databases; "
mysql cacti
mysql -e "use cacti; show tables; "
mysql -e "GRANT ALL PRIVILEGES ON cacti.* TO cactiuser@localhost IDENTIFIED BY 'cactiuser' ; "
mysql -e " flush privileges; "
mysql -e "use mysql; select * from user where User='cactiuser'; "
#利用时程表设置轮洵
echo "*/5 * * * * root /usr/bin/php /var/www/html/cacti/poller.php > /dev/null 2>&1 " >> /etc/crontab
#echo "" >> /etc/crontab
#cat /etc/crontab | grep poller
service snmpd restart
service httpd restart
service mysqld restart
#用firefox测试cacti
echo -e "\033[32mfirefox http://localhost/cacti & \033[0m"
echo -e "\033[32mUserName : admin \033[0m"
echo -e "\033[32mPassword : admin \033[0m"