fbpx

How To Install Cacti on Ubuntu 22.04

· >

What is Cacti?

Cacti provides a robust and extensible operational monitoring and fault management framework for users around the world. Cacti is a complete frontend to RRDTool, it stores all of the necessary information to create graphs and populate them with data in a MySQL database. The frontend is completely PHP driven. Along with being able to maintain Graphs, Data Sources, and Round Robin Archives in a database, cacti handles the data gathering. There is also SNMP support for those used to creating traffic graphs with MRTG.

Cacti Features

Cacti Offers a number of features, which are listed below.

  • An unlimited number of graph items can be defined for each graph optionally utilizing CDEFs or data sources from within cacti.
  • Automatic grouping of GPRINT graph items to AREA, STACK, and LINE[1–3] to allow for quick re-sequencing of graph items.
  • Data sources can be created that utilize RRDTool’s “create” and “update” functions. Each data source can be used to gather local or remote data and placed on a graph.
  • It contains a “data input” mechanism that allows users to define custom scripts that can be used to gather data. Each script can contain arguments that must be entered for each data source created using the script (such as an IP address).
  • Built-in SNMP support that can use php-snmp, ucd-snmp, or net-snmp.
  • A PHP-based poller is provided to execute scripts, retrieve SNMP data, and update your RRD files.
  • User-based management allows administrators to create users and assign different levels of permissions to the cacti interface.
  • Permissions can be specified per-graph for each user, making cacti suitable for co-location situations.
  • Each user can keep their graph settings for varying viewing preferences.

How To Install Cacti on Ubuntu 20.04

In this article we shall guide you step by step to install cacti latest version (1.2.12) on ubuntu 22.04 LTS.

Cacti Installation Requirements

Cacti requires that the following software is installed on your system.

  • RRDTool 1.0.49 or greater, 1.4+ recommended
  • MySQL 5.x or greater
  • PHP 5.1 or greater
  • Web Server that supports PHP e.g. Apache or IIS

Update and upgrade all system packages

$ sudo apt update && sudo apt upgrade

Install Apache Webserver

Install Apached as webserver for Cacti, you can also choose Nginx but in this guide we are using Apache as Cacti Webserver along with apache PHP libararies.

$ sudo apt install apache2 libapache2-mod-php -y

Install PHP and Required Extensions

install PHP and required extensions for Cacti framework.

$ sudo apt install php php-mysql php-snmp php-curl php-xml php-gd php-ldap php-mbstring php-gmp php-json php-common -y

Configure PHP Memory Limit, Execution time & Time Zone

Change a memory_limit, max_execution_time, and timezone in two PHP configuration file (php.ini) and save it.

$ sudo nano /etc/php/7.4/apache2/php.ini
$ sudo nano /etc/php/7.4/cli/php.ini
date.timezone = "Asia/Karachi"
memory_limit = 512M
max_execution_time = 60

Install MariaDB (Database Server)

Install a MariaDB as a database server. MariaDB is a community-developed, commercially supported fork of the MySQL relational database management system (RDBMS).

$ sudo apt install mariadb-server mariadb-client -y

Configure MariaDB (Database Server)

Using nano or your favourite editor in linux edit following mariadb configuration file as follows:

$ sudo nano /etc/mysql/mariadb.conf.d/50-server.cnf

Under [mysqld] section, Insert or update the below settings:

collation-server = utf8mb4_unicode_ci
max_heap_table_size = 128M
tmp_table_size = 128M
join_buffer_size = 256M
innodb_file_format = Barracuda
innodb_large_prefix = 1
innodb_buffer_pool_size = 2048M
innodb_flush_log_at_timeout = 3
innodb_read_io_threads = 32
innodb_write_io_threads = 16
innodb_io_capacity = 5000
innodb_io_capacity_max = 10000
innodb_buffer_pool_instances = 21

After editing the mariaDB configuration file, save the changes and restart the mariaDB service.

$ sudo systemctl restart mysql

Create Cacti’s database

To create cacti database, Enter to the MariaDB Server with this command without using MySQL password. When the prompt “Enter password” appeared press “enter” to login.

sudo mysql -u root -p

create cacti’s database with “create database” command.

MariaDB [(none)]> create database cacti;

Grant the permission to the cactiuser. Replace the ‘password’ with ‘your password’. Then Flush Privilege and exit from MariaDB console.

MariaDB [(none)]> GRANT ALL ON cacti.* TO cactiuser@localhost IDENTIFIED BY 'password';
MariaDB [(none)]> flush privileges;
MariaDB [(none)]> exit

Install SNMP and RRDtool

Install an SNMP and rrdtool. Cacti use the SNMP protocol to collect data from the device or remote server. RRDtool is the OpenSource industry standard, high performance data logging and graphing system for time series data.

$ sudo apt install snmp snmpd snmp-mibs-downloader rrdtool librrds-perl -y

Configure the System time zone

Changing the Timezone Using the timedatectl Command.

$ sudo timedatectl list-timezones
$ sudo timedatectl set-timezone Asia/Karachi

Download and Prepare a Cacti setup

Next change directory to apache, remove the index file and then download cacti using wget command.

$ cd /var/www/html
$ sudo rm index.html
$ sudo wget https://www.cacti.net/downloads/cacti-latest.tar.gz

next untar the cacti-latest.tar.gz file and move all contents to /var/www/html folder.

$ sudo tar zxvf cacti-latest.tar.gz
$ cd cacti-1.2.12/
$ sudo mv * /var/www/html/

Import the Cacti’s database with this command.

$ sudo mysql -u root -p cacti < /var/www/html/cacti.sql

Edit the MySQL in the Cacti config file.

$ sudo nano /var/www/html/include/config.php
Install Cacti on Ubuntu 20.04
Download and Prepare a cacti setup

Change the Cacti Directory owner to the www-data and store the log file.

$ sudo touch /var/www/html/log/cacti.log
$ sudo chown -R www-data:www-data /var/www/html/*

ALSO READ

Install cacti

Open the cacti installation by entering your URL “https://mycacti.mydomain.com/cacti” on your web browser.

Install Cacti on Ubuntu 20.04
The Cacti first installation page

Login with username: admin and password: admin and cacti will force you to change the default password.

Install Cacti on Ubuntu 20.04
Setup New Cacti Password

Accept GPL License Agreement and click Begin

Install Cacti on Ubuntu 20.04
Accept GPL License Agreement

Pre-Installation Checks during Cacti Installation Wizard

Install Cacti on Ubuntu 20.04

Choose the Installation type, as its new cacti server, choose New Primary Server and Click on Next

Install Cacti on Ubuntu 20.04
choose New Primary Server

Cacti Directory Permission Checks

Install Cacti on Ubuntu 20.04
Cacti Directory Permission Checks

Critical Binary Locations and Versions Check, Make sure all are okay before proceeding.

Install Cacti on Ubuntu 20.04
Critical Binary Locations and Versions Check

Input Validation Whitelist Protection. Checked the “I have read this statement”.

Install Cacti on Ubuntu 20.04

Setup the profile. I select a default cacti profile and disable “Scan Mode” to stop the automation. (this option can be enabled after install)

Install Cacti on Ubuntu 20.04

Select all Template and Click on Next

Install Cacti on Ubuntu 20.04

Server Collation and Database Collation Screen Appears, Click on Next and then confirm the installation

Install Cacti on Ubuntu 20.04

After this step, Cacti Installation process shall begin, once the cacti installation is complete click on “Get Started” and login using your credentials.

In this guide we have learnt What is Cacti and what features does Cacti Offer and finally how to install Cacti on Ubuntu 22.04. I hope this has been informative for you.

Subscribe
Notify of
guest
0 Comments
Inline Feedbacks
View all comments