Seems like this should be easy, especially since there is a yum install for cacti but oh no, nothing is what it seems. If you follow the below instructions (well as of January 2020) then you have a good chance at being successful. Please note, this is best case and no guarantee it will work but it worked for me. This also will help me keep track of some helpful commands I used for the future.
Open and edit SELinux configuration file.
Change SELINUX=enforcing to SELINUX=disabled. Save and exit. Reboot system
ENABLE REPOS (where you need software installed from)
Head over to the Fedora website and copy the latest download link of the latest file.
Download the EPEL repository:
wget https://dl.fedoraproject.org/pub/epel/epel-release-latest-7.noarch.rpm --no-check-certificate
Install EPEL repository
rpm -Uvh epel-release-latest-7.noarch.rpm
Download the REMI repository:
wget http://rpms.famillecollet.com/enterprise/remi-release-7.rpm --no-check-certificate
Install REMI repository
rpm -Uvh remi-release-7.rpm
yum repolist Loaded plugins: fastestmirror, priorities Loading mirror speeds from cached hostfile * base: centos.host-engine.com * centos-sclo-rh: bay.uchicago.edu * centos-sclo-sclo: linux.mirrors.es.net * epel: fedora-epel.mirror.lstn.net * extras: centos.sonn.com * remi-safe: fr2.rpmfind.net * updates: centos.mirrors.hoobly.com repo id repo name status Tuleap/x86_64 Tuleap 65 base/7/x86_64 CentOS-7 - Base 10,097 centos-sclo-rh/x86_64 CentOS-7 - SCLo rh 8,968 centos-sclo-sclo/x86_64 CentOS-7 - SCLo sclo 878 cwp/x86_64 CentOS Web Panel repo for Linux 7 - x86_64 76 epel/x86_64 Extra Packages for Enterprise Linux 7 - x86_64 13,212 extras/7/x86_64 CentOS-7 - Extras 335 mariadb MariaDB 85 remi-safe Safe Remi's RPM repository for Enterprise Linux 7 - x86_64 3,690 updates/7/x86_64 CentOS-7 - Updates 1,487 repolist: 38,893
Install Apache and start the service. Now I thought I could just install httpd but boy was I wrong. You need that httpd-devel to make things happen with cacti which is another reason you need to enable both repositories.
yum install -y httpd httpd-devel
You can confirm install by running
httpd -v Server version: Apache/2.4.6 (CentOS) Server built: Aug 8 2019 11:41:18
Now lets make it active by starting Apache
systemctl start httpd
Install SNMP and RRDTool
To install SNMP and RRD Tool, enter the following command:
yum install -y net-snmp net-snmp-utils net-snmp-libs rrdtool
systemctl start snmpd
Install Maria Database Server
Use the following command to install the MariaDB server
yum -y install mariadb-server
Now start MariaDB Service
systemctl start mariadb
Secure MariaDB Installation by running:
- Set root password? [Y/n] Y
- Remove anonymous users? [Y/n] Y
- Disallow root login remotely? [Y/n] Y
- Remove test database and access to it? [Y/n] Y
- Reload privilege tables now? [Y/n] Y
Install PHP and needed packages
Run the following command to install necessary PHP and required packages.
yum --enablerepo=remi install -y php-mysql php-pear php-common php-gd php-devel php php-mbstring php-cli php-intl php-snmp
To see what version of php your system is running, run the following
php -v PHP 5.4.45 (cli) (built: Oct 22 2019 13:26:02) Copyright (c) 1997-2014 The PHP Group Zend Engine v2.4.0, Copyright (c) 1998-2014 Zend Technologies
You can see what modules (packages) that are installed by running
php -m [PHP Modules] bz2 calendar Core ctype curl date dom ereg exif fileinfo filter ftp gd gettext gmp hash iconv intl json ldap libxml mbstring mhash mysql mysqli openssl pcntl pcre PDO pdo_mysql pdo_sqlite Phar posix readline Reflection session shmop SimpleXML snmp sockets SPL sqlite3 standard sysvmsg sysvsem sysvshm tokenizer wddx xml xmlreader xmlwriter xsl zip zlib [Zend Modules]
Create a Cacti Database
Import the timezone sql file
mysql -u root -p mysql < /usr/share/mysql/mysql_test_data_timezone.sql
Log in to the database server with the previously configured password you used when you secured your installation
mysql -u root -p
Create a Database and user.
MariaDB [(none)]> create database zahlinuxcacti; MariaDB [(none)]> CREATE USER 'zahlinuxuser'@'localhost' IDENTIFIED BY 'OMGsup3Rs3creT!!';
Grant permission and flush privileges.
MariaDB [(none)]> grant all privileges on zahlinuxcacti.* to zahlinuxuser@localhost ; MariaDB [(none)]> GRANT SELECT ON mysql.time_zone_name TO zahlinuxuser@localhost ; MariaDB [(none)]> FLUSH PRIVILEGES;
We need to modify database parameters for better performance. Use the following command.
Add the following lines to the [mysqld] section.
[mysqld] collation-server = utf8mb4_unicode_ci init-connect='SET NAMES utf8' character-set-server = utf8mb4 max_heap_table_size = 128M max_allowed_packet = 16777216 tmp_table_size = 64M join_buffer_size = 128M innodb_file_per_table = on innodb_file_format = Barracuda innodb_large_prefix = 1 innodb_buffer_pool_size = 932M innodb_doublewrite = on innodb_additional_mem_pool_size = 80M innodb_lock_wait_timeout = 50 innodb_flush_log_at_trx_commit = 2 innodb_flush_log_at_timeout = 3 innodb_read_io_threads = 32 innodb_write_io_threads = 16 innodb_io_capacity = 5000 innodb_io_capacity_max = 10000
Now that you made changes to the MariaDB config, you gotta restart them services
systemctl restart mariadb.service
Install and configure Cacti
Now that you did all the prep work, let's install Cacti now using YUM.
yum -y install cacti
Import default cacti database file to the created database.
Import the SQL file provided by cacti
mysql -u root -p zahlinuxcacti < cacti.sql
Edit the Cacti configuration file which includes a database, password details etc.
Modify database details.
$database_type = 'mysql'; $database_default = 'zahlinuxcacti'; $database_hostname = 'localhost'; $database_username = 'zahlinuxuser'; $database_password = 'OMGsup3Rs3cret!!'; $database_port = '3306'; $database_ssl = false;
Set Cron for Cacti
Open cacti cron file.
Uncomment the following line.
*/5 * * * * apache /usr/bin/php /usr/share/cacti/poller.php > /dev/null 2>&1
Save and exit the file
Configure Apache for Cacti
This will help us to do a remote installation. Edit the cacti config file.
Change “Require host localhost” to “Require all granted” and “Allow from localhost” to “Allow from all.”
Here is an example of what I have (not positive its correct but it does work for me)
Alias /cacti /usr/share/cacti/ <Directory /usr/share/cacti/> <IfModule mod_authz_core.c> # httpd 2.4 Require all granted </IfModule> <IfModule !mod_authz_core.c> # httpd 2.2 Order deny,allow Deny from all Allow from all </IfModule> </Directory> <Directory /usr/share/cacti/install> </Directory>
Change Time Zone.
vim /etc/php.ini date.timezone = your time Zone E.g.:- date.timezone = Australia/Sydney
systemctl restart httpd.service
systemctl restart mariadb.service
systemctl restart snmpd.service
Configure the Firewall
Use these commands:
firewall-cmd --permanent --zone=public --add-service=http firewall-cmd --reload
Start Cacti installation
Open a web browser and use the following URL to access Cacti web interface.
License Agreement: click Accept GPL License Agreement and click Begin
Pre-installation checks. Click next if there are no issues.
Next window is Installation Type. It will show Database connection details. Click Next to continue.
Verify Critical Binary Locations and Versions and then click next.
Verify Directory Permissions and continue.
In the Template Setup window, you can select all templates, and click finish to the complete installation. IMPORTANT: as of Cacti 1.2.10 you will get a screen like the one below that has a blank line with a checkmark to the far right. Uncheck this box or what will happen is your install will get to 42% and hang there forever. Only way I figured out how to start the install over again was delete the entire cacti database and re-create database, import sql, create user etc..
After the installation, it will redirect to Login Page.
Using default user name “admin” and default password “admin” you can log in to Cacti server. You should be asked to change the password after that.
Change Password and click save. Then you should see the Cacti Dashboard.
You can add new devices from Managemnt-> Devices Then click plus mark “+” on top of the right-hand corner.
That’s it! You have successfully configured Cacti 1.2.10 on CentOS 7!