cacti logo

How to Install Cacti on Ubuntu 20.04

Spread the love

Cacti is a complete network graphing solution designed to harness the power of RRDTool‘s data storage and graphing functionality. Cacti provides a fast poller, advanced graph templating, multiple data acquisition methods, and user management features out of the box. All of this is wrapped in an intuitive, easy to use interface that makes sense for LAN-sized installations up to complex networks with thousands of devices.

How to Install Cacti on Ubuntu 20.04

I have used Cacti for many years and it has proven to be a reliable method for graphing server performance metrics to show historic server loads and is very useful when troubleshooting performance issues and also to show potential bottlenecks that could cause issues in the future.

The process of Installing Cacti on Ubuntu 20.04 is pretty straight forward and can easily be installed by following the following instructions:

How to Install Cacti on Ubuntu 20.04:

Make sure that the server is up to date:

Run the following command to make sure that the server is up to date:

sudo apt -y update && sudo apt -y upgrade

If there are any updates to install apt will install them. If not you will see the following message once apt has finished:

How to Install Cacti on Ubuntu 20.04

Install PHP and the PHP extensions

Run the following command to install PHP and the required extensions:

sudo apt install -y php-mysql libapache2-mod-php php-xml php-ldap php-mbstring php-gd php-gmp
How to Install Cacti on Ubuntu 20.04

Once PHP and its extensions have been installed the installer will go back to the command prompt:

How to Install Cacti on Ubuntu 20.04

Once installed check the version of php installed:

php -v
How to Install Cacti on Ubuntu 20.04

Set your memory limit, max_execution time and time zone in the php.ini:

sudo vim /etc/php/7.4/apache2/php.ini
How to Install Cacti on Ubuntu 20.04

My settings were set to:

date.timezone = Europe/London
memory_limit = 512M
max_execution_time = 60

Make the same changes for /etc/php/7.4/cli/php.ini

Install Apache2:

Apache2 web server is installed by running the following command:

sudo apt-get install -y apache2
How to Install Cacti on Ubuntu 20.04

In my installation Apache2 was already at the latest version:

How to Install Cacti on Ubuntu 20.04

Allow http and https access through the firewall by running the following:

sudo ufw allow http
sudo ufw allow https
How to Install Cacti on Ubuntu 20.04

And Restart Apache2:

sudo systemctl restart apache2
How to Install Cacti on Ubuntu 20.04

Install MariaDB Database

Run the following command to install MariaDB:

sudo apt install mariadb-server
How to Install Cacti on Ubuntu 20.04

Type Y and enter to install MariaDB:

How to Install Cacti on Ubuntu 20.04

Wait for MariaDB to install:

How to Install Cacti on Ubuntu 20.04

Once the installation is complete it will return to the command line:

How to Install Cacti on Ubuntu 20.04

Configure MariaDB

Run the following command to configure MariaDB:

sudo mysql_secure_installation
How to Install Cacti on Ubuntu 20.04

Enter a root password and press enter:

How to Install Cacti on Ubuntu 20.04

Type Y to replace the root password for MariaDB:

How to Install Cacti on Ubuntu 20.04

Type the new password and enter:

How to Install Cacti on Ubuntu 20.04

Re-enter the password and press enter:

How to Install Cacti on Ubuntu 20.04

Type Y and enter to remove anonymous users:

How to Install Cacti on Ubuntu 20.04

Type Y to disable the root login from logging in remotely:

How to Install Cacti on Ubuntu 20.04

Enter Y and press enter to remove the test database:

How to Install Cacti on Ubuntu 20.04

Type Y and enter to reload the privilege tables now:

How to Install Cacti on Ubuntu 20.04

MariaDB is now configured:

How to Install Cacti on Ubuntu 20.04

Install SNMP and rrdtools

To install SNMP and rrdtools run the following command:

sudo apt install -y snmp php-snmp rrdtool librrds-perl
How to Install Cacti on Ubuntu 20.04

Install Cacti

To install Cacti run the following command:

sudo apt install cacti
How to Install Cacti on Ubuntu 20.04

Type Y and enter to install Cacti:

How to Install Cacti on Ubuntu 20.04

Select Apache2 and press enter:

How to Install Cacti on Ubuntu 20.04

Select Yes to create a database for Cacti:

How to Install Cacti on Ubuntu 20.04

Add a password for the cacti db and press enter:

How to Install Cacti on Ubuntu 20.04

Confirm the password and press enter:

How to Install Cacti on Ubuntu 20.04

Once the installation finishes it will go back to the command line.

Open a browser and go to http://ipofserver/cacti:

How to Install Cacti on Ubuntu 20.04

Log into cacti using the user admin and the password of the MariaDB cacti user created during installation:

How to Install Cacti on Ubuntu 20.04
How to Install Cacti on Ubuntu 20.04 1

Cacti is now ready to configure.

Please go to our Cacti section to find more documents relating to Cacti.

Leave a Comment

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

Scroll to Top