Cacti is a network monitoring and graphing tool designed as a front-end application for the RRDTool. It allows you to monitor network devices and system resources using graphs and provides a user-friendly interface. In this guide, we will walk through the steps to install Cacti on Ubuntu 22.04. Whether you are deploying it on a local server or a Windows VPS UK, this tutorial will help you get started with monitoring.
Step 1: Update Your System
Before installing Cacti, update your Ubuntu system to ensure all packages are up to date. Run the following commands:
sudo apt update && sudo apt upgrade -y
Keeping your system updated is important for performance and security, whether you are using it locally or on a VPS Windows Servers platform.
Step 2: Install Apache, MySQL, and PHP
Cacti requires a web server, a database, and PHP. Install Apache, MySQL, and PHP by running:
sudo apt install apache2 mysql-server php php-mysql php-xml php-snmp php-gd php-ldap php-mbstring -y
Start and enable Apache and MySQL services:
sudo systemctl start apache2
sudo systemctl enable apache2
sudo systemctl start mysql
sudo systemctl enable mysql
Step 3: Secure MySQL Installation
Run the MySQL security script to set up the root password and secure the database installation:
sudo mysql_secure_installation
Follow the prompts to configure your MySQL installation for better security.
Step 4: Create a Database for Cacti
Log into MySQL and create a database and user for Cacti:
sudo mysql -u root -p
Inside the MySQL shell, run the following commands:
CREATE DATABASE cacti;
GRANT ALL PRIVILEGES ON cacti.* TO 'cactiuser'@'localhost' IDENTIFIED BY 'your_password';
FLUSH PRIVILEGES;
EXIT;
Replace your_password
with a secure password.
Step 5: Install Cacti and SNMP
Cacti requires the SNMP protocol for network monitoring. Install Cacti and SNMP with the following command:
sudo apt install cacti snmp snmpd rrdtool -y
Step 6: Configure Cacti
During the installation process, you will be prompted to configure the Cacti database. Select "Yes" and enter the MySQL root password. Then, choose the Cacti database name and user credentials that you created earlier.
Step 7: Set Up Timezone in PHP
Edit the PHP configuration file to set your correct timezone:
sudo nano /etc/php/7.4/apache2/php.ini
Search for date.timezone
and set your desired timezone. For example:
date.timezone = "America/New_York"
Save and exit the file, then restart Apache:
sudo systemctl restart apache2
Step 8: Access Cacti Web Interface
You can now access the Cacti web interface by opening your browser and navigating to:
http:///cacti
Follow the on-screen instructions to complete the Cacti setup, including logging in with the default admin credentials and changing the password.
Step 9: Secure Cacti
To improve security, it is recommended to restrict access to Cacti by IP address or use a firewall to limit access to the web interface.