How to Install Cacti on Void Linux

Cacti is an open-source network monitoring system that provides a web-based front-end for graphing data from various network devices. In this tutorial, we will be installing Cacti on Void Linux.

Prerequisites

Before we get started with the installation process, we need to ensure that our system is up-to-date and that we have a few necessary packages installed.

sudo xbps-install -S
sudo xbps-install -y apache php php-gd php-mysqlnd mariadb-server net-snmp-utils rrdtool

Note: We will be using the MariaDB database system as our backend.

Installation

Once we have our system updated and the necessary packages installed, we can now proceed with the installation of Cacti.

  1. Download the Cacti tarball using the following command:
wget https://www.cacti.net/downloads/cacti-x.x.x.tar.gz

Replace x.x.x with the latest version available.

  1. Extract the tarball:
tar -xvzf cacti-x.x.x.tar.gz
  1. Move the extracted files to Apache's web directory:
sudo mv cacti-x.x.x /srv/http/
  1. Create a database for Cacti using MariaDB:
sudo mysql -u root -p
CREATE DATABASE cacti_db;
CREATE USER 'cacti_user'@'localhost' IDENTIFIED BY 'password';
GRANT ALL PRIVILEGES ON cacti_db.* TO 'cacti_user'@'localhost';
FLUSH PRIVILEGES;

Replace "password" with your desired password.

  1. Import Cacti's default database schema:
sudo mysql -u cacti_user -p cacti_db < /srv/http/cacti-x.x.x/cacti.sql
  1. Edit Cacti's configuration file:
sudo nano /srv/http/cacti-x.x.x/include/config.php

Change the following parameters:

$database_type     = 'mysql';
$database_default  = 'cacti_db';
$database_hostname = 'localhost';
$database_username = 'cacti_user';
$database_password = 'password';
  1. Set proper permissions for Cacti's installation directory:
sudo chown -R http:http /srv/http/cacti-x.x.x
sudo chmod -R 775 /srv/http/cacti-x.x.x/rra/

Configuration

Now that we have installed Cacti, we need to perform some additional configurations.

  1. Start the MariaDB service:
sudo systemctl start mariadb
  1. Enable the snmpd service:
sudo systemctl enable snmpd
  1. Set up a PHP timezone in the php.ini file:
sudo nano /etc/php/php.ini

Uncomment the following line and set your desired timezone:

date.timezone = "America/New_York"
  1. Restart Apache:
sudo systemctl restart httpd

Accessing Cacti

Once all the configurations are done, we can now access Cacti by opening a web browser and typing our server's IP address or domain name followed by "/cacti" in the address bar:

http://<server_IP_or_domain_name>/cacti/

You should be greeted with the Cacti login screen. Use the default login with admin as the username and admin as the password.

Conclusion

We have successfully installed Cacti on Void Linux and configured it for use. With this network monitoring system up and running, we can now monitor our network devices and detect any issues that may arise.

If you want to self-host in an easy, hands free way, need an external IP address, or simply want your data in your own hands, give IPv6.rs a try!

Alternatively, for the best virtual desktop, try Shells!