Installing On CentOS 7
Installing On CentOS 7
19
Installing on CentOS 7
LEMP (Linux, Nginx, MySQL, PHP) Required
packages
Web Server
1. Install Nginx
2. Enable and start the service to ensure it starts when the system reboots
/etc/nginx/conf.d/cacti.conf
#server_tokens off;
server {
listen 80;
# SSL configuration
server {
Cacti®
server_name cacti.yourdomain.com;
Release 1.2.19
root /usr/share/nginx/html/cacti;
gzip on;
gzip_min_length 1000;
location / {
location = /50x.html {
root /usr/share/nginx/html/;
location ~ \.php$ {
alias /usr/share/nginx/html/cacti;
index index.php
fastcgi_split_path_info ^(.+\.php)(/.+)$;
fastcgi_pass unix:/var/run/php-fpm/php-fpm.sock;
fastcgi_index index.php;
include /etc/nginx/fastcgi_params;
location /cacti {
root /usr/share/nginx/html/;
location ~ ^/cacti/(.+\.php)$ {
root /usr/share/nginx/html;
fastcgi_pass unix:/var/run/php-fpm/php-fpm.sock;
fastcgi_index index.php;
fastcgi_param SCRIPT_FILENAME $document_root$fastcgi_script_name;
include /etc/nginx/fastcgi_params;
location ~* ^/cacti/(.+\.(jpg|jpeg|gif|css|png|js|ico|html|xml|txt))$ {
expires max;
log_not_found off;
Cacti®
location /doc/ {
Release 1.2.19
alias /usr/share/nginx/html/cacti/doc/;
location ~* ^/docs/(.+\.(html|md|txt))$ {
root /usr/share/nginx/html/cacti/;
autoindex on;
allow ::1;
deny all;
location /cacti/rra/ {
deny all;
access_log /var/log/nginx/cacti_access.log;
ssl_certificate /etc/ssl/certs/YourOwnCertFile.crt;
ssl_certificate_key /etc/ssl/private/YourOwnCertKey.key;
ssl_session_cache shared:SSL:10m;
ssl_session_timeout 5m;
#ssl_prefer_server_ciphers on;
ssl_ciphers ECDH+AESGCM:ECDH+AES256:ECDH+AES128:DH+3DES:!ADH:!AECDH:!MD5;
# Disable SSLv3
ssl_dhparam /etc/ssl/certs/dhparam.pem;
Database Server
The choice between MySQL server and MariaDB is normally down to the OS
maintainers if you use one
of the predefined LAMP setup installations. If you
are deciding between these yourself, you should
research this via your
favorite search engine.
Whilst MySQL is the original open source SQL database server created in 1995
which is now owned by
Oracle, MariaDB is designed as a drop-in replacement by
some of the original MySQL developers /
owners. This will likely continue to
be a drop-in alternative until there is a major divergence that can not
Cacti®
be
bridged. Release 1.2.19
MySQL
1. Install MySQL server
2. Enable and start the service to ensure it starts when the system reboots
MariaDB
1. Install MariaDB server
2. Enable and start the service to ensure it starts when the system reboots
/usr/bin/mysql_secure_installation
vim /etc/my.cnf.d/server.cnf
[mysqld]
character-set-server=utf8mb4
collation-server=utf8mb4_unicode_ci
max_allowed_packet=18M
Cacti®
max_heap_table_size=98M
Release 1.2.19
tmp_table_size=64M
join_buffer_size=64M
innodb_buffer_pool_size=488M
innodb_doublewrite=OFF
innodb_flush_log_at_timeout=3
innodb_read_io_threads=32
innodb_write_io_threads=16
log-error = /var/log/mysql/mysql-error.log
log-queries-not-using-indexes = 1
slow-query-log = 1
slow-query-log-file = /var/log/mysql/mysql-slow.log
# mysql -u root -p
Database changed
Cacti®
Query OK, 0 rows affected (0.00 sec)
Release 1.2.19
MariaDB [(none)]> FLUSH PRIVILEGES;
date.timezone = Pacific/Auckland
cgi.fix_pathinfo=0
Setup php-fpm
1. Enable and start the service to ensure it starts when the system reboots
2. Edit /etc/php-fpm.d/www.conf
listen = /var/run/php-fpm/php-fpm.sock
Find listen.owner and listen.group and set them to nginx
Cacti® Release 1.2.19
listen.owner = nginx
listen.group = nginx
user = nginx
group = nginx
RRDtool
RRDtool is required to store the data retrieved from devices in .rra files to
produce the graphs which are
shown within Cacti
SNMP
SNMP is used to query most devices for information.
Cacti
The following steps will show you how to manually download, install and
configure the basics for Cacti.
cd /tmp
wget https://www.cacti.net/downloads/cacti-1.y.z.tar.gz
mv -v cacti-1.y.z /usr/share/nginx/html/cacti
3. Update database_ fields with your own details. This section only applies to
the Main Cacti Server
$database_type = 'mysql';
$database_default = 'your_cacti_database';
$database_hostname = 'localhost';
$database_username = 'your_cacti_username';
$database_password = 'your_cacti_password';
$database_port = '3306';
$database_ssl = false;
$database_ssl_key = '';
$database_ssl_cert = '';
$database_ssl_ca = '';
4. Set your cookie domain to match your web site domain name
$cacti_cookie_domain = 'cacti.yourdomain.com';
Starting with Cacti 1.2.16, you have the option to use either the
legacy Crontab entry, or an optional
cactid units file and server
to run your Cacti pollers.
For systemd unit's file install, you will need to modify the
included units file to following your install
location
and desired user and group's to run the Cacti poller as.
To complete the task, follow the
procedure below:
touch /etc/sysconfig/cactid
cp -p /var/www/html/cacti/service/cactid.service /etc/systemd/system
Spine
1. Install the necessary packages to compile and install spine
yum install -y autoconf automake libtool dos2unix help2man \
Cacti®
openssl-devel mariadb-devel net-snmp-devel
Release 1.2.19
cd /tmp
wget https://www.cacti.net/downloads/spine/cacti-spine-1.y.z.tar.gz
cd cacti-spine-1.y.z
# ./configure
config/install-sh -c -d '/usr/local/spine/bin'
config/install-sh -c -d '/usr/local/spine/etc'
config/install-sh -c -d '/usr/local/spine/share/man/man1'
4. Edit spine.conf
mv -v /usr/local/spine/etc/spine.conf.dist /usr/local/spine/etc/spine.conf
vi /usr/local/spine/etc/spine.conf
DB_Host localhost
DB_Database your_cacti_database
DB_User your_cacti_username
DB_Pass your_cacti_password
DB_Port 3306
#DB_UseSSL 0
#RDB_SSL_Key
#RDB_SSL_Cert
#RDB_SSL_CA
getenforce
setenforce 0
setenforce 1
Note: If you installed Cacti out of /usr/share/nginx/html make sure you fix
up all SELinux context and
permissions.
GitHub
API
Back to top
Donate
RRDtool
Copyright © 2004-2021 The Cacti Group, Inc. - Cacti is the registered trademark The Cacti Group, Inc.
Made by BV IT Solutions Ltd.