How to Install Cacti on CentOS 5.5

Share this Article :

Cacti is a complete network graphing solution that usefull for network administrator to monitor their network bandwidth. It is very easy to use and have the following features:

  • Graphs
  • Data Sources
  • Data Gathering
  • Graph Display
  • User Management

In this tutorial, i will guide you on how to install Cacti on CentOS 5.5 server. This tutorial assume that you already installed LAMP (Linux CentOS, Apache, Mysql and PHP) server.

How to Prepare Other Yum Repositories For RHEL/CentOS 5

1. Download and install the rpmforge repository.

For x86 (32-bit) systems

    [[email protected] ~]# rpm -Uhv http://apt.sw.be/redhat/el5/en/i386/rpmforge/RPMS/rpmforge-release-0.5.2-2.el5.rf.i386.rpm
    

For x64 (64-bit) systems

    [[email protected] ~]# rpm -Uhv http://apt.sw.be/redhat/el5/en/x86_64/rpmforge/RPMS/rpmforge-release-0.5.2-2.el5.rf.x86_64.rpm
    

2. Install Cacti and dependencies with below command:

    [[email protected] ~]# yum -y --enablerepo=rpmforge install cacti mysql-server mysql php-common php-mysql net-snmp net-snmp-utils php-snmp liberation-fonts
    Loaded plugins: fastestmirror
    Loading mirror speeds from cached hostfile
    * addons: centos.maulvi.net
    * base: centos.maulvi.net
    * epel: ftp.cuhk.edu.hk
    * extras: centos.maulvi.net
    * rpmforge: fr2.rpmfind.net
    * updates: mirror.yourconnect.com
    Setting up Install Process
    Package matching php-mysql-5.1.6-27.el5_5.3.i386 already installed. Checking for update.
    Package liberation-fonts-1.0-1.el5.noarch already installed and latest version
    Resolving Dependencies
    --> Running transaction check
    ---> Package cacti.noarch 0:0.8.7g-2.el5.rf set to be updated
    --> Processing Dependency: rrdtool for package: cacti
    ---> Package mysql.i386 0:5.0.77-4.el5_5.5 set to be updated
    ---> Package mysql-server.i386 0:5.0.77-4.el5_5.5 set to be updated
    ---> Package net-snmp.i386 1:5.3.2.2-9.el5_5.1 set to be updated
    --> Processing Dependency: net-snmp-libs = 1:5.3.2.2-9.el5_5.1 for package: net-snmp
    ---> Package net-snmp-utils.i386 1:5.3.2.2-9.el5_5.1 set to be updated
    ---> Package php-common.i386 0:5.1.6-27.el5_5.3 set to be updated
    ---> Package php-snmp.i386 0:5.1.6-27.el5_5.3 set to be updated
    --> Running transaction check
    ---> Package net-snmp-libs.i386 1:5.3.2.2-9.el5_5.1 set to be updated
    ---> Package rrdtool.i386 0:1.4.4-1.el5.rf set to be updated
    --> Processing Dependency: ruby for package: rrdtool
    --> Processing Dependency: lua for package: rrdtool
    --> Processing Dependency: xorg-x11-fonts-Type1 for package: rrdtool
    --> Processing Dependency: perl(RRDs) for package: rrdtool
    --> Processing Dependency: perl(RRDp) for package: rrdtool
    --> Processing Dependency: libdbi.so.0 for package: rrdtool
    --> Running transaction check
    ---> Package libdbi.i386 0:0.8.1-2.1 set to be updated
    ---> Package lua.i386 0:5.1.4-4.el5 set to be updated
    ---> Package perl-rrdtool.i386 0:1.4.4-1.el5.rf set to be updated
    ---> Package ruby.i386 0:1.8.5-5.el5_4.8 set to be updated
    --> Processing Dependency: ruby-libs = 1.8.5-5.el5_4.8 for package: ruby
    --> Processing Dependency: libruby.so.1.8 for package: ruby
    ---> Package xorg-x11-fonts-Type1.noarch 0:7.1-2.1.el5 set to be updated
    --> Processing Dependency: chkfontpath for package: xorg-x11-fonts-Type1
    --> Running transaction check
    ---> Package chkfontpath.i386 0:1.10.1-1.1 set to be updated
    --> Processing Dependency: xfs for package: chkfontpath
    ---> Package ruby-libs.i386 0:1.8.5-5.el5_4.8 set to be updated
    --> Running transaction check
    ---> Package xorg-x11-xfs.i386 1:1.0.2-5.el5_6.1 set to be updated
    --> Finished Dependency Resolution
    
    Dependencies Resolved
    
    =====================================================================================
    Package                   Arch        Version                   Repository     Size
    =====================================================================================
    Installing:
    cacti                     noarch      0.8.7g-2.el5.rf           rpmforge      2.2 M
    net-snmp                  i386        1:5.3.2.2-9.el5_5.1       base          697 k
    net-snmp-utils            i386        1:5.3.2.2-9.el5_5.1       base          186 k
    php-common                i386        5.1.6-27.el5_5.3          base          153 k
    php-snmp                  i386        5.1.6-27.el5_5.3          base           30 k
    Updating:
    mysql                     i386        5.0.77-4.el5_5.5          updates       4.8 M
    mysql-server              i386        5.0.77-4.el5_5.5          updates       9.8 M
    Installing for dependencies:
    chkfontpath               i386        1.10.1-1.1                base           15 k
    libdbi                    i386        0.8.1-2.1                 base           35 k
    lua                       i386        5.1.4-4.el5               epel          228 k
    perl-rrdtool              i386        1.4.4-1.el5.rf            rpmforge       52 k
    rrdtool                   i386        1.4.4-1.el5.rf            rpmforge      895 k
    ruby                      i386        1.8.5-5.el5_4.8           base          274 k
    ruby-libs                 i386        1.8.5-5.el5_4.8           base          1.6 M
    xorg-x11-fonts-Type1      noarch      7.1-2.1.el5               base          1.5 M
    xorg-x11-xfs              i386        1:1.0.2-5.el5_6.1         updates        69 k
    Updating for dependencies:
    net-snmp-libs             i386        1:5.3.2.2-9.el5_5.1       base          1.3 M
    
    Transaction Summary
    =====================================================================================
    Install      14 Package(s)
    Upgrade       3 Package(s)
    
    Total download size: 24 M
    Downloading Packages:
    (1/17): chkfontpath-1.10.1-1.1.i386.rpm                       |  15 kB     00:00
    (2/17): php-snmp-5.1.6-27.el5_5.3.i386.rpm                    |  30 kB     00:01
    (3/17): libdbi-0.8.1-2.1.i386.rpm                             |  35 kB     00:01
    (4/17): perl-rrdtool-1.4.4-1.el5.rf.i386.rpm                  |  52 kB     00:02
    (5/17): xorg-x11-xfs-1.0.2-5.el5_6.1.i386.rpm                 |  69 kB     00:02
    (6/17): php-common-5.1.6-27.el5_5.3.i386.rpm                  | 153 kB     00:12
    (7/17): net-snmp-utils-5.3.2.2-9.el5_5.1.i386.rpm             | 186 kB     00:12
    (8/17): lua-5.1.4-4.el5.i386.rpm                              | 228 kB     00:20
    (9/17): ruby-1.8.5-5.el5_4.8.i386.rpm                         | 274 kB     00:10
    (10/17): net-snmp-5.3.2.2-9.el5_5.1.i386.rpm                  | 697 kB     00:25
    (11/17): rrdtool-1.4.4-1.el5.rf.i386.rpm                      | 895 kB     01:03
    (12/17): net-snmp-libs-5.3.2.2-9.el5_5.1.i386.rpm             | 1.3 MB     01:11
    (13/17): xorg-x11-fonts-Type1-7.1-2.1.el5.noarch.rpm          | 1.5 MB     01:38
    (14/17): ruby-libs-1.8.5-5.el5_4.8.i386.rpm                   | 1.6 MB     01:43
    (15/17): cacti-0.8.7g-2.el5.rf.noarch.rpm                     | 2.2 MB     02:23
    (16/17): mysql-5.0.77-4.el5_5.5.i386.rpm                      | 4.8 MB     03:32
    (17/17): mysql-server-5.0.77-4.el5_5.5.i386.rpm               | 9.8 MB     07:06
    -------------------------------------------------------------------------------------
    Total                                                 19 kB/s |  24 MB     21:11
    Running rpm_check_debug
    Running Transaction Test
    Finished Transaction Test
    Transaction Test Succeeded
    Running Transaction
    Updating       : net-snmp-libs                                                1/20
    Updating       : mysql                                                        2/20
    Installing     : net-snmp                                                     3/20
    Installing     : net-snmp-utils                                               4/20
    Installing     : libdbi                                                       5/20
    Installing     : php-common                                                   6/20
    Installing     : php-snmp                                                     7/20
    Installing     : ruby-libs                                                    8/20
    Installing     : ruby                                                         9/20
    Installing     : lua                                                         10/20
    Updating       : mysql-server                                                11/20
    Installing     : chkfontpath                                                 12/20
    Installing     : xorg-x11-xfs                                                13/20
    Installing     : xorg-x11-fonts-Type1                                        14/20
    Installing     : rrdtool                                                     15/20
    Installing     : cacti                                                       16/20
    Installing     : perl-rrdtool                                                17/20
    Cleanup        : mysql-server                                                18/20
    Cleanup        : mysql                                                       19/20
    Cleanup        : net-snmp-libs                                               20/20
    
    Installed:
    cacti.noarch 0:0.8.7g-2.el5.rf              net-snmp.i386 1:5.3.2.2-9.el5_5.1
    net-snmp-utils.i386 1:5.3.2.2-9.el5_5.1     php-common.i386 0:5.1.6-27.el5_5.3
    php-snmp.i386 0:5.1.6-27.el5_5.3
    
    Dependency Installed:
    chkfontpath.i386 0:1.10.1-1.1          libdbi.i386 0:0.8.1-2.1
    lua.i386 0:5.1.4-4.el5                 perl-rrdtool.i386 0:1.4.4-1.el5.rf
    rrdtool.i386 0:1.4.4-1.el5.rf          ruby.i386 0:1.8.5-5.el5_4.8
    ruby-libs.i386 0:1.8.5-5.el5_4.8       xorg-x11-fonts-Type1.noarch 0:7.1-2.1.el5
    xorg-x11-xfs.i386 1:1.0.2-5.el5_6.1
    
    Updated:
    mysql.i386 0:5.0.77-4.el5_5.5         mysql-server.i386 0:5.0.77-4.el5_5.5
    
    Dependency Updated:
    net-snmp-libs.i386 1:5.3.2.2-9.el5_5.1
    
    Complete!
    

3. Create the database, user for cacti:

    mysql> CREATE DATABASE cactidb;
    Query OK, 1 row affected (0.00 sec)
    
    mysql> CREATE USER 'cactiuser'@'localhost' IDENTIFIED BY 'cactipassword';
    Query OK, 0 rows affected (0.00 sec)
    
    mysql> GRANT ALL PRIVILEGES ON cactidb.* to [email protected];
    Query OK, 0 rows affected (0.00 sec)
    
    mysql> SHOW GRANTS FOR 'cactiuser'@'localhost';
    +-----------------------------------------------------------------------------------------+
    | Grants for [email protected]                                                          |
    +-----------------------------------------------------------------------------------------+
    | GRANT USAGE ON *.* TO 'cactiuser'@'localhost' IDENTIFIED BY PASSWORD '368d8a955a5a0bad' |
    | GRANT ALL PRIVILEGES ON `cactidb`.* TO 'cactiuser'@'localhost'                          |
    +-----------------------------------------------------------------------------------------+
    2 rows in set (0.00 sec)
    

4. Populate the cacti database (Note: You will use the password you created for cactiuser here)

    [[email protected] ~]# /usr/bin/mysql cactidb -u cactiuser -p < /var/www/cacti/cacti.sql
    Enter password:
    
    [[email protected] ~]# vi /var/www/cacti/include/config.php
    

5. Please make sure these values reflect your actual database/host/user/password:

    $database_type = "mysql";
    $database_default = "cactidb";
    $database_hostname = "localhost";
    $database_username = "cactiuser";
    $database_password = "cactipassword"; $database_port = "3306";
    

6. Setting up the crontab:

     [[email protected] ~]# crontab -e
    
    # Used to update Cacti
    */5 * * * * /usr/bin/php /var/www/cacti/poller.php >> /var/log/cacti 2>&1
    

7. Configure cacti.conf as below:

    [[email protected] ~]# vi /etc/httpd/conf.d/cacti.conf
    
    Alias /cacti/ /var/www/cacti/
    <Directory /var/www/cacti/>
    DirectoryIndex index.php
    Options -Indexes
    AllowOverride all
    order deny,allow
    allow from all
    AddType application/x-httpd-php .php
    php_flag magic_quotes_gpc on
    php_flag track_vars on
    </Directory>
    

8. Restart Apache to take effect on the changes:

    [[email protected] ~]# /etc/init.d/httpd restart
    Stopping httpd:                                            [  OK  ]
    Starting httpd:                                            [  OK  ]
    [[email protected] ~]#
    

9. Navigate your browser to http://servername/cacti

Also Read :   How to Install and Configure ProFTPD FTP Server on Ubuntu 14.04

10. Login to your new Cacti installation from http://servername/cacti/ with default user (admin) and the default password (admin).


One Response

  1. XaXa

Leave a Reply