OverviewThe following process outlines the steps needed to follow to install cacti on a CentOS server.
Downloading and InstallingDownloading:Install the base applications required:
yum install mysql-server mysql php-mysql php-pear php-common php-gd php-devel php php-mbstring php-cli php-snmp php-pear-Net-SMTP php-mysql httpd cacti
Configure the DB:Login to DB, set password:
First time you run mysql, the root password is not defined, so you can start it with this command. ( -u root says user is root, and mysql says open the "mysql database")mysql -u root mysql If you already have a root password defined, then you will need to add the -p flag to be queried a password after the command is entered mysql -u root mysql -p
Note that if you can also reset the root password if needed. Secure DB:You want to make sure that the db is setup properly, and that any unneeded initial tables are not included. In CentOS this is really simple, just run the following command and follow the instructions./usr/bin/mysql_secure_installation See detailed instructions on using this command if needed. Create Cacti DB:Create the cacti instance:
mysqladmin -u root -p create cacti At password prompt, enter in
DSxdWXdyCBB7 then provide it a structure:
mysql -p cacti < /usr/share/doc/cacti-0.8.7g/cacti.sql DSxdWXdyCBB7 Create a cacti user:
mysql -u root -p mysql At password prompt, enter in
DSxdWXdyCBB7 then at the mysql prompt, enter in the following:
Configure Apache:edit the httpd.conf file:
vim /etc/httpd/conf/httpd.conf #ServerName www.example.com:80 ServerName cacti.cmed.us:80 modify the cacti.conf file:
vim /etc/httpd/conf.d/cacti.conf And allow access to the /cacti server. You can do this by allowing only specific networks: (10.50.0.0/16 and 10.33.0.0/16) See in red.
<Directory /usr/share/cacti/> Order Deny,Allow Deny from all Allow from 127.0.0.1 10.50 10.33 </Directory> Or you can allow access from all IP's
<Directory /usr/share/cacti/> Order Deny,Allow Allow from all </Directory> and restart apache to take changes:
service httpd restart Configure IPTables:view the current rules setup:
iptables-save modify the iptables config
vim /etc/sysconfig/iptables and allow port 80 access inbound:
-A RH-Firewall-1-INPUT -m state --state NEW -p tcp --dport 80 -j ACCEPT service iptables restart Configuring the Cacti InstallTell Cacti how to get to the db by modifying the following file:
vim /usr/share/cacti/include/config.php Update the username and password:
Create a cacti user on the linux box, and setup a cronjob to run:
adduser cacti chown -R cacti /usr/share/cacti/rra chown -R cacti /usr/share/cacti/log chown -R cacti /var/lib/cacti/rra/ chown -R cacti /var/log/cacti/
(the last two might not be needed, just check the first two to make sure they are/are not symlinked, and make sure the symlinks have their files modified too. ) then create the cronjob:
vim /etc/cron.d/cacti and add the following line:
*/5 * * * * cacti /usr/bin/php /usr/share/cacti/poller.php > /dev/null 2>&1 Connect to the Cacti via the Web:from the browser, connect to:
http://{server}/cacti References:File Locations:
External Reference Material:
|