How to Install Cacti on CentOS 6.2 using EPEL Repository

Cacti is a popular open-source network monitoring and graphing tool used for visualizing network performance data. CentOS 6.2 is an older version of the CentOS operating system, but it is still in use in some environments.

In this guide, we will show you how to install Cacti on CentOS 6.2 using the EPEL repository.

Step 1: Install the EPEL Repository

The first step is to install the EPEL repository on your CentOS system. Run the following command:

sudo yum install epel-release

This command will download and install the EPEL repository on your system.

Step 2: Install Required Packages

Next, you need to install the required packages for Cacti. Run the following command:

sudo yum install httpd mysql-server php php-mysql php-snmp php-gd net-snmp-utils

This command will install Apache web server, MySQL server, PHP and its required modules, SNMP utilities, and other dependencies needed for Cacti to function properly.

Step 3: Configure MySQL Database

Now, you need to configure the MySQL database for Cacti. Run the following command:

sudo mysql_secure_installation

This command will prompt you to set the root password for MySQL and perform some security-related tasks. Follow the prompts and answer the questions as needed.

Step 4: Create a Cacti Database

Next, you need to create a database for Cacti. Run the following command:

sudo mysql -u root -p

This command will log you in to the MySQL server as the root user. Enter the root password you set in step 3 when prompted. Once you are logged in, run the following commands:

CREATE DATABASE cacti;
GRANT ALL PRIVILEGES ON cacti.* TO cactiuser@localhost IDENTIFIED BY 'password';
FLUSH PRIVILEGES;
exit;

This will create a new database named cacti, create a user named cactiuser with the password password and grant all privileges to the cacti database.

See also  How to Setup and Configure 389 Directory Server on CentOS 6.2

Step 5: Install Cacti

Now, you can install Cacti using the following command:

sudo yum install cacti

This command will download and install Cacti on your system.

Step 6: Configure Cacti

Next, you need to configure Cacti to use the MySQL database you created in step 4. Run the following command:

sudo nano /etc/cacti/db.php

This command will open the db.php file in the nano text editor. Find the section that starts with $database_type and change mysql to mysqli. Then, find the section that starts with $database_default and change it to cacti. Finally, find the section that starts with $database_username and $database_password and enter the username and password for the cactiuser account you created in step 4. Save the changes and exit the editor by pressing Ctrl + X, then Y, and finally Enter.

Step 7: Configure Apache Web Server

Now, you need to configure the Apache web server to serve the Cacti web interface. Run the following command:

sudo nano /etc/httpd/conf.d/cacti.conf

This command will create a new file named `cacti.confin theconf.d` directory and open it in the nano text editor. Add the following lines to the file:

Alias /cacti /usr/share/cacti/

        Options Indexes FollowSymLinks MultiViews
        AllowOverride None
        Order allow,deny
        allow from all

These lines create an alias for the Cacti web interface and specify the directory where Cacti is installed. Save the changes and exit the editor by pressing Ctrl + X, then Y, and finally Enter.

See also  How to Install wget on Linux (Ubuntu, CentOS, RHEL, Fedora)

Step 8: Start Services

Finally, you need to start the Apache and MySQL services and enable them to start automatically at boot time. Run the following commands:

sudo service httpd start
sudo service mysqld start
sudo chkconfig httpd on
sudo chkconfig mysqld on

These commands will start the Apache and MySQL services and configure them to start automatically when the system boots up.

Step 9: Access Cacti Web Interface

Now, you can access the Cacti web interface by opening your web browser and navigating to http://your-server-ip/cacti/. You will be prompted to log in with the default username and password admin/admin. Once you are logged in, you can begin configuring Cacti to monitor your network devices.

Commands Mentioned:

  • sudo yum install epel-release – Install the EPEL repository
  • sudo yum install httpd mysql-server php php-mysql php-snmp php-gd net-snmp-utils – Install required packages
  • sudo mysql_secure_installation – Configure MySQL database
  • sudo mysql -u root -p – Log in to MySQL server
  • CREATE DATABASE cacti; – Create a Cacti database
  • GRANT ALL PRIVILEGES ON cacti.* TO cactiuser@localhost IDENTIFIED BY ‘password’; – Grant privileges to the Cacti database
  • FLUSH PRIVILEGES; – Refresh MySQL privileges
  • exit; – Exit MySQL shell
  • sudo yum install cacti – Install Cacti
  • sudo nano /etc/cacti/db.php – Configure Cacti database settings
  • sudo nano /etc/httpd/conf.d/cacti.conf – Configure Apache web server
  • sudo service httpd start – Start Apache web server
  • sudo service mysqld start – Start MySQL server
  • sudo chkconfig httpd on – Enable Apache web server to start at boot time
  • sudo chkconfig mysqld on – Enable MySQL server to start at boot time
See also  How to Add Linux Swap Space on CentOS 6 VPS

Conclusion

In this guide, we have shown you how to install Cacti on CentOS 6.2 using the EPEL repository. By following these steps, you can easily set up a powerful network monitoring and graphing tool to keep track of your network performance data. Remember to secure your installation by changing the default username and password and by configuring Cacti to use HTTPS instead of HTTP. You can also customize Cacti by adding new devices to monitor and by creating custom graphs and templates. We hope this guide has been helpful to you.

If you have any comments or suggestions for improvements, please feel free to share them below.

Comments

2 Comments

  • Avatar KAGE says:

    /etc/httpd/conf.d/cacti.conf

  • Avatar KAGE says:

    vi /etc/httpd/conf.d/cacti.conf

    Original configuration

    Order Deny,Allow
    Deny from all
    Allow from 127.0.0.1

    Change the configuration to :

    Order Deny,Allow
    Deny from all
    Allow from all

Leave a Reply

Your email address will not be published. Required fields are marked *