install cacti on fedora 34
Install Cacti (Network Monitoring) on Fedora
First, we need to install following dependency packages one-by-one using the default package manager tool as shown.
Login as a root user
dnf upgrade
Install Apache
dnf install httpd httpd-devel
Install MySQL
dnf install mariadb-server -y
Install PHP
for previous version like 33,32,30
dnf config-manager --set-enabled remi
dnf -y install epel-release
dnf module reset php
dnf module install php:remi-7.4
then do this
you can use direct only new version start from fedora 34
dnf install php php-cli php-fpm php-mysqlnd php-zip php-devel php-gd php-mcrypt php-mbstring php-curl php-xml php-pear php-bcmath php-json
Install PHP-SNMP
dnf install php-snmp
Install NET-SNMP
dnf install net-snmp-utils net-snmp-libs
Install RRDTool
dnf install rrdtool
all packages in one command you may use one command instead step by step
dnf install httpd httpd-devel mariadb-server php-mysqlnd php-pear php-common php-gd php-devel php php-mbstring php-cli php-snmp net-snmp-utils net-snmp-libs rrdtool
Starting Apache, MySQL, and SNMP Services
Once you’ve installed all the required software’s for Cacti installation, let’s start them one-by-one using following commands.
systemctl start mariadb.service
systemctl start snmpd.service
(please correct the suggested settings in your /etc/php.ini file as shown and restart Apache after making changes)
memory_limit = 512M
max_execution_time = 60
date.timezone = Asia/karachi
check timezome list on fedora
timedatectl list-timezones
Asia/karachi
And make sure your fedora time should be matches with php timezone
To set use command on fedora
timedatectl set-timezone Asia/karachi
Configure System Start-up Links
Configuring Apache, MySQL and SNMP Services to start on boot.
systemctl enable httpd.service
systemctl enable mariadb.service
systemctl enable snmpd.service
Install Cacti on Fedora
Here, you need to install and enable the EPEL Repository. Once you’ve enabled the repository, type the following command to install Cacti application.
dnf install epel-release -y >>>>>not required for version fedora 34 need for old version i.e 33,29,30,31,32 etc
dnf install cacti
Configuring MySQL Server for Cacti Installation
We need to configure MySQL for Cacti, to do this we need to secure a newly installed MySQL server and then we will create Cacti database with user Cacti. If you’re MySQL is already installed and secured, then don’t need to do it again.
mysql_secure_installation
>>> this is optional you can skip this command for unsecure mysql
Create MySQL Cacti Database
Login into MySQL server with a newly created password and create Cacti database with user Cacti and set the password for it.
mysql -u root -p
create database cacti;
GRANT ALL ON cacti.* TO cacti@localhost IDENTIFIED BY 'password';
FLUSH privileges;
quit;
Similarly, you also need to grant access to the MySQL TimeZone database for user Cacti, so that the database is populated with global TimeZone information.
mysql -u root -p mysql < /usr/share/mysql/mysql_test_data_timezone.sql >>>> old version
mysql -u root -p mysql < /usr/share/mariadb/mysql_test_data_timezone.sql >>>>> new version
OR
mysql -u root -p
use mysql;
GRANT SELECT ON mysql.time_zone_name TO cacti@localhost;
flush privileges;
quit
Install Cacti Tables to MySQL
Find out the database file path using RPM command, to install cacti tables into newly created Cacti database, use the following command.
rpm -ql cacti | grep cacti.sql
/usr/share/doc/cacti-1.2.18/cacti.sql
OR
/usr/share/doc/cacti/cacti.sql
Now we’ve of the location of Cacti.sql file, type the following command to install tables, here you need to type the Cacti user password.
mysql -u root -p cacti < /usr/share/doc/cacti/cacti.sql
Configure MySQL settings for Cacti
Open the file called /etc/cacti/db.php with any editor.
Make the following changes and save the file. Make sure you set password correctly.
$database_type = 'mysql';
$database_default = 'cacti';
$database_hostname = 'localhost';
$database_username = 'cacti';
$database_password = 'password';
$database_port = '3306';
$database_retries = 5;
$database_ssl = false;
Database Tuning
Cacti recommend changing MariaDB settings for better performances. Edit the MariaDB configuration file.
nano /etc/my.cnf.d/mariadb-server.cnf
Add variables in the [mysqld] section.
collation-server = utf8mb4_unicode_ci
character-set-server=utf8mb4
max_heap_table_size = 64M
tmp_table_size = 64M
join_buffer_size = 128M
innodb_file_format = Barracuda
innodb_large_prefix = 1
innodb_flush_log_at_timeout = 3
innodb_buffer_pool_size = 1GB
innodb_buffer_pool_instances = 10
innodb_io_capacity = 5000
innodb_io_capacity_max = 10000
Configuring Firewall for Cacti
firewall-cmd --permanent --zone=public --add-service=http
firewall-cmd --reload
Configuring Apache Server for Cacti Installation
Open file called /etc/httpd/conf.d/cacti.conf with your choice of editor.
vi /etc/httpd/conf.d/cacti.conf
You need to enable access to Cacti application for your local network or per IP level. For example, we’ve enabled access to our local LAN network 172.16.0.0/16. In your case, it would be different.
In the latest version of Apache (ex: Apache 2.4), you may need to change according to the following settings.
# to access your Cacti installation, change the httpd ACLs below.
# For example:
# On httpd 2.4, change "Require host localhost" to "Require all granted".
# On httpd 2.2, change "Allow from localhost" to "Allow from all".
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>
Finally, restart the Apache service.
service httpd restart
systemctl restart httpd.service
Setting Cron for Cacti
Open file /etc/cron.d/cacti.
Uncomment the following line. The poller.php script runs every 5mins and collects data of known host which is used by Cacti application to display graphs.
*/5 * * * * cacti /usr/bin/php /usr/share/cacti/poller.php > /dev/null 2>&1
SeLINUX should be disabled
pen ‘/etc/sysconfig/selinux‘ file and change the option from ‘permissive‘ to ‘disabled‘.
nano /etc/sysconfig/selinux
SELINUX=permissive
TO
SELINUX=disabled
Changing the Apache Port
nano /etc/httpd/conf/httpd.conf
In the file, find the 'Listen' and find the following statement as
Listen 80.
Listen 80 to 8181
anyportnumber
Listen yourIP: 8181
Finally
>>this step is very important
to fix writeable issue
/usr/share/cacti/log
chkconfig httpd on
systemctl enable httpd.services
systemctl start httpd.services
chkconfig snmpd on
chkconfig mysqld on
sudo chown -R apache:apache /usr/share/cacti/log/
chown -R root:root/usr/share/cacti/log/
sudo chown -R normal_user_name:normal_User_NAME /usr/share/cacti/log/
>>i.e saad
After reboot you will have to start them again so it’s better to change this so these services always start at boot:
you may required while finshing cacti installtion setup:
Set the SELinux context for Cacti logs.
yum install -y policycoreutils-python
semanage fcontext -a -t httpd_sys_rw_content_t "/var/log/cacti(/.*)?"
restorecon -Rv /var/log/cacti/
Running Cacti Installer Setup
Finally, Cacti is ready, just go to http://localhost/cacti/ & follow the installer instruction through the following screens. Enter the default login details and hit Enter button.
User: admin
Password: admin
nano /etc/snmp/smpd_con
rwcommunity cacti 192.168.88.151
Comments
Post a Comment