Install Cacti on Centos 7

Install Cacti on Centos 7

Install Cacti on Centos 7 - Pada tutorial kali ini kita akan membahas tentang install cacti di centos 7.

Apa itu cacti ?

Cacti adalah sebuah CMS MRTG yang berfungsi untuk mengcapture grafic traffic dari sebuah interface dan juga resource dari sebuah system dengan menggunakan snmp.

Berikut tahapan untuk menginstall cacti di centos 7

A. Install web dan database server

Disabled selinux
[root@mrtg2a ~]# vi /etc/sysconfig/selinux

Enabled repo dan update
[root@mrtg2a ~]# rpm --import /etc/pki/rpm-gpg/RPM-GPG-KEY*
[root@mrtg2a ~]# yum -y install epel-release
[root@mrtg2a ~]# yum update

Install paket pendukung
[root@mrtg2a ~]# yum install gcc nano wget net-tools automake autoconf libtool make gcc-c++ zlib-devel openssl-devel which bzip2 bzip2-devel zip unzip

Add MariaDB repo
[root@mrtg2a ~]# nano /etc/yum.repos.d/MariaDB.repo
Kemudian isi file tersebut dengan baris berikut ini :
===================================
# MariaDB 10.3 CentOS repository list
# Http://mariadb.org/mariadb/repositories/
[Mariadb]
name=MariaDB
baseurl=http://yum.mariadb.org/10.3/centos7-amd64
gpgkey=https://yum.mariadb.org/RPM-GPG-KEY-MariaDB
gpgcheck=1
===================================

Install webserver httpd, php dan module pendukung lainnya
[root@mrtg2a ~]# yum -y install mariadb-server mariadb php php-cli 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 php-ldap php-odbc php-pear php-xml php-xmlrpc php-snmp php-soap curl curl-devel php-imap php-mcrypt php-mssql php-mysqlnd php-tidy php-pecl-apc php-opcache

Enabled service
[root@mrtg2a ~]# systemctl enable httpd.service
[root@mrtg2a ~]# systemctl enable mariadb.service

 

Edit Mysql Config
[root@mrtg2a ~]# nano /etc/my.cnf.d/server.cnf
[mysqld]
max_heap_table_size=400M
max_allowed_packet=16M
tmp_table_size=64M
join_buffer_size=64M
innodb_file_per_table=ON
innodb_buffer_pool_size=1024M
innodb_doublewrite=OFF
innodb_lock_wait_timeout=50
innodb_flush_log_at_trx_commit=2
character_set_server=utf8
character_set_client=utf8
collation_server=utf8_general_ci
innodb_flush_log_at_timeout=3
innodb_read_io_threads=32
innodb_write_io_threads=16

[root@mrtg2a ~]# systemctl restart httpd.service
[root@mrtg2a ~]# systemctl restart mariadb.service

Setting Password MySQL
[root@mrtg2a ~]# /usr/bin/mysql_secure_installation

Create timezone data dan import ke database

[root@mrtg2a include]# cd /usr/share/mysql/
[root@mrtg2a mysql]# mysql -u root -pCact1301018 mysql < mysql_test_data_timezone.sql

PHP Settings

Edit file /etc/php.ini
date.timezone = Asia/Jakarta
error_log = syslog
file_uploads = On

Save and restart httpd web server service

Download dan install Cacti Files

[root@mrtg2a ~]# cd /var/www/html/
[root@mrtg2a html]# wget https://www.cacti.net/downloads/cacti-1.0.0.zip
[root@mrtg2a html]# unzip cacti-1.0.0.zip
[root@mrtg2a html]# mv cacti-1.0.0 cacti

Add cron dan file permission
[root@mrtg2a html]# adduser -d /var/www/html/cacti -s /sbin/nologin cacti
[root@mrtg2a html]# echo "*/1 * * * * cacti php /var/www/html/cacti/poller.php &>/dev/null" >> /etc/cron.d/cacti
[root@mrtg2a html]# cd /var/www/html/cacti
[root@mrtg2a cacti]# chown -R cacti.apache rra log resource scripts cache
[root@mrtg2a cacti]# chmod -R 775 rra log resource scripts cache
[root@mrtg2a cacti]# chown -R apache.apache /var/www/html/cacti/resource/snmp_queries
[root@mrtg2a cacti]# chown -R apache.apache /var/www/html/cacti/resource/script_server
[root@mrtg2a cacti]# chown -R apache.apache /var/www/html/cacti/resource/script_queries
[root@mrtg2a cacti]# chown -R apache.apache /var/www/html/cacti/scripts
[root@mrtg2a cacti]# chown -R apache.apache /var/www/html/cacti/log
[root@mrtg2a cacti]# chown -R apache.apache /var/www/html/cacti/cache/boost
[root@mrtg2a cacti]# chown -R apache.apache /var/www/html/cacti/cache/mibcache
[root@mrtg2a cacti]# chown -R apache.apache /var/www/html/cacti/cache/realtime
[root@mrtg2a cacti]# chown -R apache.apache /var/www/html/cacti/cache/spikekill

Create Cacti Database
[root@mrtg2a cacti]# mysqladmin -u root -ppassworddatabase create cacti
[root@mrtg2a cacti]# mysql -u root -pCact1301018 cacti < /var/www/html/cacti/cacti.sql
[root@mrtg2a cacti]# mysql -u root -pCact1301018
MariaDB [cacti]> GRANT SELECT ON mysql.time_zone_name TO root@localhost IDENTIFIED BY 'Cact1301018';
MariaDB [cacti]> GRANT ALL ON cacti.* TO root@localhost IDENTIFIED BY 'Cact1301018';
MariaDB [cacti]> flush privileges;

Edit file config.php access ke database
[root@mrtg2a cacti]# cd /var/www/html/cacti/include/
[root@mrtg2a include]# nano config.php
$database_type = 'mysql';
$database_default = 'cacti';
$database_hostname = 'localhost';
$database_username = 'root';
$database_password = 'Cact1301018';
$database_port = '3306';
$database_ssl = false;

Dan kemudian uncomment baris berikut ini : $url_path = "/cacti/";

Tambahkan firewall rules
[root@mrtg2a include]# firewall-cmd --permanent --zone=public --add-service=https
[root@mrtg2a include]# firewall-cmd --permanent --zone=public --add-service=http
[root@mrtg2a include]# firewall-cmd --reload

Jalankan Web-based installer dari browser anda dengan mengakses IP atau domain dari server cacti anda

http://192.168.20.146/cacti

Install Cacti on Centos 7

Next and Next

Install Cacti on Centos 7

Untuk proses di web ini ikutin sesuai petunjuk yang ada hingga selesai.

 

Demikian tutorial singkat ini selamat mencoba dan semoga berhasil.

 

andr3 reborn

Be the first to comment

Leave a Reply

This site uses Akismet to reduce spam. Learn how your comment data is processed.