[繼續CentOS教學] 安裝 Cacti

跟據呢篇裝咗CentOS: [Linux 101] 安裝Centos 7 伺服器
再埋呢篇裝埋MySQL 5.6/7: 如何在CENTOS 7 上安裝MySQL 5.6

下一步,挑戰 Cacti!! (Reference: Install Cacti on CentOS 7– The Definitive Guide in 2017 – The Networker)

*** 因為教學reference 係用 MariaDB,喺下面我會變做用MySQL ***

Step 1: 教學話要先將CentOS嘅 Time zone 轉做UTC,如果唔係Cacti 有機會出Error。姑且信住做咗先:image

Step 2: 一次過裝哂所有要嘅嘢先! (因為喺前文已經安裝咗 MySQL,呢度唔會完全跟教學咁裝MariaDB)

Step 3: 話咁快,裝鬼哂!

Step 4: 裝多個tool for Cacti 嘅圖像先:yum install php-snmp net-snmp-utils net-snmp-libs rrdtool -yimage… 掂!

Step 5: 踢著哂啲services 佢!

systemctl start httpd.service
systemctl start mysqld.service **
systemctl start snmpd.service
systemctl enable httpd.service
systemctl enable mysqld.service **
systemctl enable snmpd.service

打星係因為之前已經裝咗同enable 咗mysqld,呢度只不過係做多次去確認。

Step 6: Create Database 先,記住要先入 mysql -u root -p 去MySQL 呀!

mysql> create database cacti;
mysql> GRANT ALL ON cacti.* TO cacti@localhost IDENTIFIED BY ‘access123’;
mysql> FLUSH privileges;
mysql> quit;
image

Step 7: 終於可以裝cacti 了: yum install cacti –y image

Step 8: Import 返Cacti 個table 入MySQL先 image

Step 9: VI 入去改咗cacti 個DB connection parameters image

記住改完用 wq! save 返改咗嘅嘢呀!

Step 10: 改埋Cacti Config: vim /etc/httpd/conf.d/cacti.conf 由咁:

改成咁,都係記住,要 :wq! 去save 低改動呀

Step 11: Restart 返個httpd service 等佢食到啲新改動先image

Step 12: 開返個folder 俾cacti 寫log: mkdir -p /var/log/cacti image

Step 13: 整個 cacti.log file 喺啱啱create 個folder 入面 image

Step 14: uncomment 返個 cron file (remove 咗第一個# 就可以了~): vi /etc/cron.d/cacti

Step 15: 試吓入去先… 明明IP啱點解入唔到?

Step 16: 懷疑應該係 firewall… 熄咗佢先,掂,一熄就去到

Step 17: 繼續去安裝…

Step 18: 又遇到Error… 關於Time Zone Database…


要咁做

cd /usr/share/mysql
mysql -u root -p mysql < mysql_test_data_timezone.sql
mysql -u root -p
mysql> GRANT SELECT ON mysql. time_zone_name TO ‘cacti’@‘localhost’ IDENTIFIED BY ‘your-db-password’;
mysql> FLUSH privileges;

Step 19: Refresh 再試,得咗

Step 20: 去到recommended MySQL system variable settings… 好多紅色…

Step 21: 去改 vi /etc/my.cnf (SOURCE: 塵世浮沉近千秋: Cent OS 7 Cacti 1.1.0 Install + Mysql 5.7.17 Install)

===========
#Mysql 5.7.17 for Cacti 1.1.0

[mysqld]

innodb_buffer_pool_size = 512M

datadir=/var/lib/mysql
socket=/var/lib/mysql/mysql.sock

'# Disabling symbolic-links is recommended to prevent assorted security risks
symbolic-links=0

character-set-server=utf8mb4
collation-server=utf8mb4_unicode_ci
init-connect=‘SET NAMES utf8’
lower_case_table_names=0

max_heap_table_size=90M
max_allowed_packet=167M
tmp_table_size = 64M
join_buffer_size =128M
sort_buffer_size = 4M
read_rnd_buffer_size = 4M
innodb_doublewrite = OFF
innodb_flush_log_at_timeout = 3
innodb_read_io_threads = 32
innodb_write_io_threads = 16
sql_mode=NO_ENGINE_SUBSTITUTION,STRICT_TRANS_TABLES

log-error=/var/log/mysqld.log
pid-file=/var/run/mysqld/mysqld.pid

Step 22: Restart mysql service image

Step 23: 淨返一個紅色,教學冇講,由佢先

Step 24: 揀 New Primary Server

Step 25: 又Error,冇 Spine (不過原來係可裝可不裝,呢度先skip 唔裝)

Step 26: 都仲有Error! 有啲Folder not writable - 搵過原來關SELINUX 事,Disable 咗佢先

Step 27: 要熄好簡單,先 vi /etc/selinux/config 再改成咁

SELINUX=enforcing

改成:

SELINUX=disabled

另外將 “SELINUXTYPE=targeted” 加上註釋

Step 28: 用 ‘reboot’ 重新開機

Step 29: 再去 http://IP/cacti 再試,得咗! 再 next

Step 30: 揀template… 我試試唔理,揀哂先!

Step 31: 入到!default user name 同 password 都係 ‘admin’ 第一次入佢會叫你改password image image