how-to install cacti on rhel-5/centos-5

Hopefully this short and simple how-to will be useful to someone. There may be inaccuracies so please feel free to let me know if you see anything that needs correcting.

Download all necessary packages

* `yum install httpd php php-mysql php-snmp mysql mysql-server net-snmp net-snmp-utils rrdtool libart_lgpl -y`
* rrd-tool can be obtained from dag (http://dag.wieers.com/rpm/packages/rrdtool/perl-rrdtool-1.2.23-1.el5.rf.x86_64.rpm and http://dag.wieers.com/rpm/packages/rrdtool/rrdtool-1.2.23-1.el5.rf.x86_64.rpm for 64-bit) if it is not in your repos.

Verify that the required daemons are started and configured to start on boot

* `chkconfig httpd on`
* `chkconfig snmpd on`
* `chkconfig mysqld on`
* `/etc/init.d/httpd restart`
* `/etc/init.d/mysqld restart`
* `/etc/init.d/snmpd restart`

Configure mysql daemon to listen only on localhost (optional)

* `vi /etc/my.cnf`
* add 'bind='
* restart mysql `/etc/init.d/mysqld restart`
* confirm that it is listening on localhost `netstat -ntlp | grep :3306`

Configure mysql users

* mysql -u root`
* set mysql password for root user
o `use mysql;`
o `update user set Password=PASSWORD('selectapw') where User='root';`
* create cacti database
o `create database cacti;`
* create cacti user and grant them permissions to the cacti database
o `grant all privileges on cacti.* to 'cacti'@'localhost' identified by 'selectpw' with grant option;`
* apply all new permission changes
o `flush privileges;`
o or you can simply restart mysql

Get and extract the cacti tarball

* `cd /var/www/html/`
* `wget http://www.cacti.net/downloads/cacti-0.8.7d.tar.gz`
* `tar -xvzf cacti-0.8.7d.tar.gz`

Create symbolic link and change the owernship to apache

* `ln -s /var/www/html/cacti-0.8.7d.tar.gz`
* `chown -R apache:apache /var/www/html/cacti`

Create the necessary cacti tables

* `mysql -u root -p cacti < /var/www/html/cacti/cacti.sql` Create cacti user and create the poller cron * `useradd cacti` * `passwd cacti` * `su – cacti` * `crontab -e` * insert `*/5 * * * * php /var/www/html/cacti/poller.php > /dev/null 2>&1` and save `:wq`
* exit back to root `exit`

Change ownership of rra and log to cacti

* `chown -R cacti /var/www/html/cacti/rra/ /var/www/html/cacti/log/`

Populate the cacti config with mysql information

* `vi /var/www/html/cacti/include/config.php`
* update the below accordingly
* $database_type = "mysql";
* $database_default = "cacti";
* $database_hostname = "";
* $database_username = "cacti";
* $database_password = "createdpass";

Point your web browser to `http://your-server/cacti/` and follow the on-screen instructions

* accept defaults
* when prompted the default usernamd and password is admin

Current repolist
repo id repo name status
addons CentOS-5 - Addons enabled : 0
base CentOS-5 - Base enabled : 3,272
centosplus CentOS-5 - Plus enabled : 63
contrib CentOS-5 - Contrib enabled : 0
epel Epel from fedora enabled : 4,970
extras CentOS-5 - Extras enabled : 266
updates CentOS-5 - Updates enabled : 258

No comments:

Post a Comment