The default CentOS installation is missing several important packages. This section will show you how to install all required packages on your CentOS 7 system as well as the latest MariaDB 10.x version:
- Set up the MariaDB repository for installing the latest MariaDB version. You can get the latest repository from https://downloads.mariadb.org/mariadb/repositories/:
echo "# MariaDB 10.1 CentOS repository list - created 2017-02-08 16:11 UTC
# http://downloads.mariadb.org/mariadb/repositories/
[mariadb]
name = MariaDB
baseurl = http://yum.mariadb.org/10.1/centos7-amd64
gpgkey=https://yum.mariadb.org/RPM-GPG-KEY-MariaDB
gpgcheck=1" > /etc/yum.repos.d/MariaDB.repo
- Now we can install all required packages for Cacti:
yum -y install mariadb-server php php-cli php-mysql net-snmp-utils rrdtool
php-snmp gcc mariadb-devel net-snmp-devel autoconf automake libtool dos2unix wget help2man
php-posix php-ldap php-mbstring php-gd
- At this point you should also take care of updating your packages to the latest version. The following command will do this for you:
yum -y upgrade
- The next step will start the required MySQL/MariaDB server:
systemctl restart mariadb.service
- Cacti 1.x requires the timezone tables within MySQL to be populated. The following commands allow you to do so:
mysql_tzinfo_to_sql /usr/share/zoneinfo > /tmp/mysql_timezone.sql
mysql -u root mysql < /tmp/mysql_timezone.sql
- The timezone settings for Cacti are very important, so you will need to set your current timezone. The following command will help you to do so:
timedatectl set-timezone Europe/Berlin
- Now that you have set your timezone, installed the MySQL/MariaDB server, and upgraded your system, you will have to set some special configuration parameters for MySQL/MariaDB. Edit the/etc/my.cnf file:
vi /etc/my.cnf
- Change your [mysqld] section. Make sure to change the time zone setting to your actual timezone:
[mysqld]
datadir=/var/lib/mysql
socket=/var/lib/mysql/mysql.sock
symbolic-links=0
max_heap_table_size=90M
max_allowed_packet=16M
tmp_table_size=64M
join_buffer_size=64M
innodb_file_per_table=ON
innodb_buffer_pool_size=450M
innodb_doublewrite=OFF
innodb_additional_mem_pool_size=80M
innodb_lock_wait_timeout=50
innodb_flush_log_at_trx_commit=2
collation_server=utf8_general_ci
character_set_client=utf8
default-time-zone='Europe/Berlin'
innodb_flush_log_at_timeout=3
innodb_read_io_threads=32
innodb_write_io_threads=16
- As you have already learned, the timezone setting is very important in Cacti. You already changed it for the database server and your system, but PHP also needs to be aware of your timezone. Therefore, you will now edit the /etc/php.ini file. While doing so you will also enable error logging for the syslog system, which will help you find issues with custom plugins. Now edit the /etc/php.ini file and set the following lines:
; Log errors to syslog (Event Log on NT, not valid in Windows 95).
error_log = syslog
...
[Date]
; Defines the default timezone used by the date functions
; http://php.net/date.timezone
date.timezone = Europe/Berlin
- The next step will enable the web server as well as restart the required MySQL/MariaDB server. Use the following commands to start these:
systemctl start httpd.service
systemctl restart mariadb.service
- Now that the web server is up and running, you should enable the http/https ports on the CentOS firewall. The firewall-cmd command will help you with this task:
firewall-cmd --permanent --zone=public --add-service=https
firewall-cmd --permanent --zone=public --add-service=http
firewall-cmd --reload
- As you want to have both services started automatically after a reboot of the system, you should also enable both services during boot time. This final step will allow you to do so:
systemctl enable httpd.service
systemctl enable mariadb.service
- As a final step you should set the SELinux system to permissive. On a CentOS/RHEL system this can be done by editing the file /etc/selinux/config and setting the SELINUX variable to permissive, which will become active after the next restart:
SELINUX=permissive
- Before continuing it is now a good time to restart the system.