Installation Cacti on CentOS 7
==============================
Step by step:
[rgx@rexus ~]$ su
Password:
[root@rexus rgx]# yum update -y
[root@rexus rgx]# rpm -Uvh https://dl.fedoraproject.org/pub/epel/epel-release-
latest-7.noarch.rpm
[root@rexus rgx]# yum -y install net-snmp net-snmp-utils net-snmp-libs rrdtool
[root@rexus rgx]# yum install -y https://rpms.remirepo.net/enterprise/remi-release-
7.rpm
[root@rexus rgx]# yum install -y --enablerepo=remi-php73 php php-xml php-session
php-sockets php-ldap php-gd php-gmp php-intl php-mbstring php-mysqlnd php-pdo php-
process php-snmp
[root@rexus rgx]# cat <<EOF>> /etc/yum.repos.d/mariadb.repo
> [mariadb]
> name = MariaDB
> baseurl = http://yum.mariadb.org/10.4/centos7-amd64
> gpgkey=https://yum.mariadb.org/RPM-GPG-KEY-MariaDB
> gpgcheck=1
> EOF
[root@rexus rgx]# yum install -y MariaDB-server MariaDB-client
[root@rexus rgx]# nano /etc/my.cnf.d/server.cnf
Add variables in the [mysqld]
collation-server = utf8mb4_unicode_ci
character-set-server=utf8mb4
max_heap_table_size = 64M
tmp_table_size = 64M
join_buffer_size = 64M
innodb_file_format = Barracuda
innodb_large_prefix = 1
innodb_flush_log_at_timeout = 3
innodb_buffer_pool_size = 1GB
innodb_buffer_pool_instances = 10
# Based on what type for storage you use. The below values are for SSD drives.
# Change it if Cacti reports issues during the installation
innodb_read_io_threads = 32
innodb_write_io_threads = 16
innodb_io_capacity = 5000
innodb_io_capacity_max = 10000
[root@rexus rgx]# systemctl start httpd snmpd mariadb
[root@rexus rgx]# systemctl enable httpd snmpd mariadb
[root@rexus rgx]# mysql -u root -p
Enter password:
Welcome to the MariaDB monitor. Commands end with ; or \g.
Your MariaDB connection id is 8
Server version: 10.4.25-MariaDB MariaDB Server
Copyright (c) 2000, 2018, Oracle, MariaDB Corporation Ab and others.
Type 'help;' or '\h' for help. Type '\c' to clear the current input statement.
MariaDB [(none)]> create database cacti;
Query OK, 1 row affected (0.00.2 sec)
MariaDB [(none)]> GRANT ALL ON cacti.* TO cactiuser@localhost IDENTIFIED BY
'cactipassword';
Query OK, 1 row affected (0.00.2 sec)
MariaDB [(none)]> flush privileges;
Query OK, 1 row affected (0.00.2 sec)
MariaDB [(none)]> exit
Bye
[root@rexus rgx]# yum -y install cacti
[root@rexus rgx]# mysql cacti < /usr/share/doc/cacti-*/cacti.sql -u root -p
[root@rexus rgx]# nano /usr/share/cacti/include/config.php
/* make sure these values reflect your actual database/host/user/password */
$database_type = "mysql";
$database_default = "cacti";
$database_hostname = "localhost";
$database_username = "cactiuser";
$database_password = "cactipassword";
$database_port = "3306";
$database_ssl = false;
[root@rexus rgx]# nano /etc/cron.d/cacti
*/5 * * * * apache /usr/bin/php /usr/share/cacti/poller.php > /dev/null 2>&1
[root@rexus rgx]# nano /etc/php.ini
date.timezone = Asia/Makassar
memory_limit = 512M
max_execution_time = 60
[root@rexus rgx]# nano /etc/httpd/conf.d/cacti.conf
Alias /cacti /usr/share/cacti
<Directory /usr/share/cacti/>
<IfModule mod_authz_core.c>
# httpd 2.4
Require host localhost (edited) Require all granted
</IfModule>
<IfModule !mod_authz_core.c>
# httpd 2.2
Order deny,allow
Deny from all
Allow from localhost
</IfModule>
</Directory>
[root@rexus rgx]# systemctl restart httpd
[root@rexus rgx]# firewall-cmd --permanent --add-service=http
[root@rexus rgx]# firewall-cmd --reload
[root@rexus rgx]# yum install -y policycoreutils-python
[root@rexus rgx]# semanage fcontext -a -t httpd_sys_rw_content_t
"/var/log/cacti(/.*)?"
[root@rexus rgx]# restorecon -Rv /var/log/cacti/
[root@rexus rgx]# setenforce 0
Setup Cacti
Visit the following URL to start the installation of cacti.
http://your-ip-address/cacti
Login to Cacti to set up Cacti installation.
Username: admin
Password: admin
ISSUE :
Your MySQL TimeZone database is not populated.
Please populate this database before proceeding.
SOLUTION :
Now you need to grant access to the MySQL TimeZone database for user Cacti,
so that the database is populated with global TimeZone information, to do this run
the following commands.
# mysql -u root -p
Enter password:
mysql> use mysql;
mysql> GRANT SELECT ON mysql.time_zone_name TO cactiuser@localhost;
mysql> flush privileges;
mysql> exit
# systemctl restart mariadb.service
# systemctl restart httpd.service