Cacti is an open-source network monitoring tool that allows you to collect data from a variety of sources and graph it over time. In this tutorial, we will walk through the steps to install Cacti on FreeBSD.
Before installing any new software, it’s important to update your system to the latest version. This can be done by running the following command:
freebsd-update fetch install
The following packages are required for installing Cacti:
pkg install apache24 mysql57-server php74 php74-extensions php74-gd php74-mysqli php74-xml php74-zlib php74-bcmath php74-ctype php74-session php74-json php74-filter php74-hash php74-opcache php74-pdo php74-pdo_mysql php74-simplexml net-snmp
Start the mysql service at boot time:
echo 'mysql_enable="YES"' >> /etc/rc.conf
Initialize the MySQL data directory:
/usr/local/etc/rc.d/mysql-server initialize
Start the MySQL service:
service mysql-server start
Set the root password:
mysql_secure_installation
Start the apache service at boot time:
echo 'apache24_enable="YES"' >> /etc/rc.conf
Start the Apache service:
service apache24 start
Download the latest version of Cacti from the official website:
cd /usr/local/www
fetch https://www.cacti.net/downloads/cacti-latest.tar.gz
tar -zxvf cacti-latest.tar.gz
mv cacti-* cacti
Create a new database and user for Cacti:
mysql -u root -p
CREATE DATABASE cacti;
CREATE USER 'cactiuser'@'localhost' IDENTIFIED BY 'password';
GRANT ALL PRIVILEGES ON cacti.* TO 'cactiuser'@'localhost';
FLUSH PRIVILEGES;
exit
Import the Cacti database template:
cd /usr/local/www/cacti
mysql -u cactiuser -p cacti < cacti.sql
Edit the Cacti configuration file:
cp include/config.php.dist include/config.php
vi include/config.php
Update the database settings with the following:
$database_type = 'mysql';
$database_default = 'cacti';
$database_hostname = 'localhost';
$database_username = 'cactiuser';
$database_password = 'password';
$database_port = '3306';
Create a new virtual host file for Cacti:
cp /usr/local/etc/apache24/Includes/cacti.conf.sample /usr/local/etc/apache24/Includes/cacti.conf
vi /usr/local/etc/apache24/Includes/cacti.conf
Update the Apache virtual host settings with the following:
Alias /cacti /usr/local/www/cacti
<Directory "/usr/local/www/cacti/">
Order allow,deny
Allow from all
</Directory>
Restart the Apache service:
service apache24 restart
To access Cacti, open a web browser and navigate to the following URL:
http://your_server_ip/cacti/
You should now be able to log in to Cacti with the default username ‘admin’ and the password ‘admin’.
Congratulations, you have successfully installed Cacti on FreeBSD!
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!