We're here to assist with any of your needs, don't hestitate to reach out.
Cacti is an open-source network monitoring and graphing tool designed to provide a visually appealing dashboard for analyzing and managing network infrastructure. It uses the Simple Network Management Protocol (SNMP) to collect data from various devices and presents it in the form of comprehensive graphs and charts.
To install Cacti on Ubuntu 20.04, follow the steps below:
Before installing any software, it is recommended to update the system packages to their latest versions. Open a terminal and run the following command:
sudo apt update
sudo apt upgrade
Cacti requires a LAMP (Linux, Apache, MySQL, PHP) stack to run. Install the necessary packages using the following command:
sudo apt install apache2 mariadb-server php php-mysql libapache2-mod-php php-snmp php-xml php-imagick php-gd php-net-socket php-mbstring php-gettext php-ldap php-xmlrpc php-bcmath php-json mysql-client
During the installation of the MariaDB package, you will be prompted to set a root password. After that, run the following command to secure the installation:
sudo mysql_secure_installation
Log in to the MySQL/MariaDB server using the root credentials:
sudo mysql -u root -p
Once logged in, create a new database for Cacti:
CREATE DATABASE cacti;
GRANT ALL PRIVILEGES ON cacti.* TO 'cactiuser'@'localhost' IDENTIFIED BY 'password';
FLUSH PRIVILEGES;
EXIT;
Install the Cacti package using the following command:
sudo apt install cacti
During the installation, you will be prompted to choose the web server you are using. Select "Apache2" and press ENTER.
After the installation completes, import the default Cacti database:
sudo mysql -u cactiuser -p cacti < /usr/share/doc/cacti/cacti.sql
Edit the Cacti configuration file using a text editor such as nano or vim:
sudo nano /etc/cacti/db.php
Find the following lines:
$database_username = 'cactiuser';
$database_password = 'password';
Replace 'password' with the password you set for the cactiuser in Step 4. Save the file and exit the editor.
Enable the necessary Apache modules by running the following command:
sudo a2enmod rewrite
Then, open the Cacti configuration file in a text editor:
sudo nano /etc/apache2/sites-available/cacti.conf
Find the following line:
Require host localhost
Add a new line below it:
Allow from all
Save the file and exit the editor.
Disable the default Apache virtual host and enable the Cacti virtual host:
sudo a2dissite 000-default
sudo a2ensite cacti
Restart Apache to apply the changes:
sudo systemctl restart apache2
Configure a cron job to automatically poll data for Cacti. Open the crontab file using the following command:
sudo crontab -e
Add a new line at the end of the file:
* * * * * www-data php /usr/share/cacti/site/poller.php > /dev/null 2>&1
Save the file and exit the editor.
Open a web browser and visit your server's IP address or domain name followed by "/cacti" (e.g., http://your_server_ip/cacti). You should see the Cacti login page.
Log in with the following default credentials:
Username: admin
Password: admin
After logging in, you will be prompted to change the admin password. Follow the on-screen instructions to complete the setup.
You have successfully installed Cacti on Ubuntu 20.04. Enjoy monitoring and graphing your network infrastructure!
What our customers say about us
Create your free account today.