How to install and configure Cacti in Linux?
Here are the steps you can follow to install and configure Cacti on Linux:
- Install the LAMP (Linux, Apache, MySQL, and PHP) stack.
- To install the LAMP stack, run the following commands:
sudo apt update
sudo apt install apache2 mysql-server php php-mysql php-snmp php-xml php-mbstring php-gd - Establish a Cacti database.
- Log in to the MySQL server using the following command: sudo mysql -u root -p
- Create a new database called cacti, grant all permissions to the user ‘cactiuser’ on the database, and then flush privileges.
- Exit the MySQL server: quit;
- Import the Cacti database template.
- To import the Cacti database template, use the following command: sudo mysql -u cactiuser -p cacti < /usr/share/doc/cacti/cacti.sql.
- Set up Cacti.
- Open the Cacti configuration file: sudo nano /etc/cacti/db.php
- Change the following lines:
$database_username = ‘cactiuser’;
$database_password = ‘password’;
$database_default = ‘cacti’;
$database_hostname = ‘localhost’; - Save and close the file.
- Set up the Apache server.
- Open the Cacti Apache configuration file: sudo nano /etc/apache2/sites-available/cacti.conf.
- Include the following information within the
section: Declare that Options +FollowSymLinks, AllowOverride all, and Require all granted. - Save and close the file.
- Enable the Cacti Apache configuration file.
- Run the following command to enable the Cacti Apache configuration file: sudo a2ensite cacti.conf
- Restart the Apache server.
- Execute the following command to restart the Apache server: sudo systemctl restart apache2.
- Access the Cacti web interface.
- Enter the IP address or domain name of the server in your web browser, and then visit http://
/cacti. - Configure according to the instructions of the Cacti installation wizard.
This way, you will be able to successfully install and configure Cacti on Linux.