CentOSLinuxTutorials

How To Install Cacti Network Monitoring on CentOS 8

In this tutorial, we will show you how to install Cacti Network Monitoring on CentOS 8. For those of you who didn’t know, Cacti is an open-source, web-based network monitoring and graphing tool designed as a front-end application for the open-source, industry-standard data logging tool RRDtool. It is used by IT businesses and stores all of the necessary information about bandwidth, hard disk usage, CPU usage, load average, RAM statistics, etc in a MySQL database. Cacti create graphs and populate them with data. It offers SNMP support, 3rd party templates, and plugins and has built-in user authentications and user permission features.

This article assumes you have at least basic knowledge of Linux, know how to use the shell, and most importantly, you host your site on your own VPS. The installation is quite simple and assumes you are running in the root account, if not you may need to add ‘sudo‘ to the commands to get root privileges. I will show you the step-by-step installation of Cacti on a CentOS 8 server.

Prerequisites

  • A server running one of the following operating systems: CentOS 8.
  • It’s recommended that you use a fresh OS install to prevent any potential issues.
  • A non-root sudo user or access to the root user. We recommend acting as a non-root sudo user, however, you can harm your system if you’re not careful when acting as the root.

Install Cacti Network Monitoring on CentOS 8

Step 1. First, let’s start by ensuring your system is up-to-date.

sudo dnf install https://dl.fedoraproject.org/pub/epel/epel-release-latest-8.noarch.rpm
sudo dnf update

Step 2. Installing LAMP server.

A CentOS 8 LAMP server is required. If you do not have LAMP installed, you can follow our guide here.

Step 3. Installing required packages extensions.

Now, we’ll gonna install SNMP and cacti on your CentOS system:

sudo dnf install net-snmp net-snmp-utils rrdtool

Step 4. Installing Cacti on CentOS 8.

Run the following command to install Cacti:

dnf install cacti

Step 5. Configuring MariaDB for Cacti.

By default, MariaDB is not hardened. You can secure MariaDB using the mysql_secure_installation script. you should read and below each step carefully which will set a root password, remove anonymous users, disallow remote root login, and remove the test database and access to secure MariaDB:

mysql_secure_installation

Configure it like this:

- Set root password? [Y/n] y
- Remove anonymous users? [Y/n] y
- Disallow root login remotely? [Y/n] y
- Remove test database and access to it? [Y/n] y
- Reload privilege tables now? [Y/n] y

Next, we will need to log in to the MariaDB console and create a database for the Cacti. Run the following command:

mysql -u root -p

This will prompt you for a password, so enter your MariaDB root password and hit Enter. Once you are logged in to your database server you need to create a database for Cacti installation:

MariaDB [(none)]> create database cacti;
MariaDB [(none)]> GRANT ALL ON cacti.* TO cacti@localhost IDENTIFIED BY 'cactipass';
MariaDB [(none)]> FLUSH privileges;
MariaDB [(none)]> quit;

Next, import cacti database tables from the cacti.sql file. First, locate cacti.sql file:

mysql -u cacti -p cacti < /usr/share/doc/cacti-0.8.8b/cacti.sql

We’ll now configure our cacti configuration file:

nano /etc/cacti/db.php
$database_type = "mysql"; 
$database_default = "cacti"; 
$database_hostname = "localhost"; 
$database_username = "cacti"; 
$database_password = "cactipass";

Step 6. Configuring Apache Server for Cacti Installation.

Open file called /etc/httpd/conf.d/cacti.conf with nano editor:

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

Add the following lines:

Alias /cacti    /usr/share/cacti

<Directory /usr/share/cacti/>
        <IfModule mod_authz_core.c>
                # httpd 2.4
                Require all granted
        </IfModule>
        <IfModule !mod_authz_core.c>
                # httpd 2.2
                Order deny,allow
                Deny from all
                Allow from all
        </IfModule>
</Directory>

Save and close the file. Restart the Apache service for the changes to take effect:

systemctl restart httpd.service

Then, set cron for Cacti:

*/5 * * * * cacti /usr/bin/php /usr/share/cacti/poller.php > /dev/null 2>&1

Step 7. Configuring Firewall for Cacti.

Allow HTTP and HTTPS ports on the firewall:

firewall-cmd --permanent --zone=public --add-service=http
firewall-cmd --reload

Step 8. Accessing cacti.

Cacti will be available on HTTP port 80 by default. Open your favorite browser and navigate to http://your_domain.com/cacti or http://server-ip/cacti and complete the required steps to finish the installation. You will get the “Cacti Installation Guide” on the screen. Click on the ‘Next’ button.

Install Cacti Network Monitoring on CentOS 8

On the next screen, you will get a drop-down button. Because of this fresh installation select ‘New Install’ and click ‘Next’ button.

Install Cacti Network Monitoring on CentOS 8

Cacti will now check for the packages it needs to run properly. Make sure all the checks appear with an “OK” status and then click Finish.

Install Cacti Network Monitoring on CentOS 8

The next page is the login page. The first time you log into Cacti, use admin as username and password.

Install Cacti Network Monitoring on CentOS 8

Congratulations! You have successfully installed Cacti. Thanks for using this tutorial for installing Cacti network monitoring on your CentOS 8 system. For additional help or useful information, we recommend you to check the official Cacti website.

VPS Manage Service Offer
If you don’t have time to do all of this stuff, or if this is not your area of expertise, we offer a service to do “VPS Manage Service Offer”, starting from $10 (Paypal payment). Please contact us to get the best deal!

r00t

r00t is an experienced Linux enthusiast and technical writer with a passion for open-source software. With years of hands-on experience in various Linux distributions, r00t has developed a deep understanding of the Linux ecosystem and its powerful tools. He holds certifications in SCE and has contributed to several open-source projects. r00t is dedicated to sharing her knowledge and expertise through well-researched and informative articles, helping others navigate the world of Linux with confidence.
Back to top button