#!/bin/bash# Script Name: Automated installation cacti Server # script last night the Stars # notes:# 1. The script applies to the ENTOS&NBSP;6.2&NBSP;32 bit system; 2. If you already have MySQL and Apache installed, the script may not work;# 3. the script does not set a password for the root account of the MySQL service, for your MySQL service security, It is recommended that you manually set the password after the script is executed;# 4. for convenience, the script does not modify the default database user account and password for cacti, if you are just testing or learning, then you can ignore it, but, If you want to build a cacti server for your production environment, then I recommend that you modify the corresponding user name (Cactiuser) and password (cactiuser) in the script, and do not forget to modify the cacti configuration file after you modify it (/var/www/html/ cacti/include/config.php). echo -n ' is stopping iptables and shutting down SELinux ... ' (# stop iptables, close selinuxservice iptables stopchkconfig iptables offsetenforce 0[ -f /etc/selinux/config ] && sed -i '/^selinux=/s/=.*/=disabled/' /etc/selinux/config) &> /dev/null && echo ' Finish ' | | exitecho -n ' Installing dependent packages ... ' (# install dependency pack Yum -y install rrdtool mysql-server httpd php php-mysql php-snmp php-xml net-snmp net-snmp-utils wget# launch related services Service httpd startservice mysqld start) &> /dev/ null && echo ' Finish ' | | exitecho -n ' Installing cacti ... ' (# download, unzip, rename wget http://www.cacti.net/downloads/ Cacti-0.8.8g.tar.gz -p /tmp/tar xzf /tmp/cacti-0.8.8g.tar.gz -c /var/www/html/mv /var/www/html/cacti-0.8.8g /var/www/html/cacti# Create a dedicated user useradd cacti -m -s /sbin/nologin# change owner, all groups Chown -r apache:apache /var/www/html/cactichown -r cacti :cacti /var/www/html/cacti/{log,rra}# Create a database and a dedicated user mysql -uroot << eofcreate Database cacti;grant all privileges on cacti.* to [email protected] identified by ' Cactiuser ';flush privileges; eof# importing tables and underlying data mysql -uroot < /var/www/html/cacti/cacti.sql# creating timed Tasks echo ' */5 * * * * root php /var/www/html/cacti/poller.php &> /dev/null ' >> /etc /crontab) &> /dev/null && echo ' Complete ' | | exitecho ' installation is complete! Please visit through the browser, the default account and password are admin, the first time you log in cacti will ask you to reset the admin password. ‘
This article is from the "Last Night Stars" blog, please make sure to keep this source http://yestreenstars.blog.51cto.com/1836303/1766149
Cacti automated installation cacti service side