CentOS 8 YUM 安装CACTI

分类:笔记 2.96k浏览

最近将 Cacti 新装v1.2并再带升级v0.8.8版本,所以顺手安装,本来想yum安装给自己省事,结果步骤还是有点多。

一、安装

yum install epel-release -y

yum install cacti cacti-spine mariadb-server  mariadb-server -y

yum install php php-mysql php-gd php-pear php-common php-cli php-devel php php-mbstring

二、开放apache访问

vi /etc/httpd/conf.d/cacti.conf

将apache 2.4 的 Require host localhost 改为 Require all granted

将apache 2.2 的 Deny from all改成Allow from all

三、启动进程并设置自动启动

systemctl restart mariadb

systemctl enable mariadb

systemctl restart httpd

systemctl restart php-fpm

systemctl enable httpd

四、创建数据库

mysql_secure_installation

mysql> ALTER DATABASE cacti CHARACTER SET utf8mb4 COLLATE utf8mb4_unicode_ci;

 mysql -uroot -p

create database cacti;

SHOW DATABASES;

flush privileges;

五、数据表导入

1、因为是连带旧版升级,在原来机器导出mysql 数据,当然如果是新装就导入cacti默认数据库了

mysqldump -l –add-drop-table cacti > cacti.sql

2、Mysql根据cacti需要的参数预先设定

vi /etc/my.cnf

[mysqld]
character-set-server=utf8mb4
collation-server=utf8mb4_unicode_ci
max_heap_table_size=128M
tmp_table_size=128M
join_buffer_size=128M
innodb_buffer_pool_size=1024M
innodb_flush_log_at_timeout=3
innodb_read_io_threads=32
innodb_write_io_threads=16
innodb_buffer_pool_instances=9
innodb_io_capacity=5000
innodb_io_capacity_max=10000
innodb_file_format=Barracuda
innodb_large_prefix=1

3、导入数据库

mysql -uroot -p cacti < /root/cacti.sql

4、如果是升级则需要编辑数据库连接配置,如果新安装无需。

vi /usr/share/cacti/include/config.php

六、PHP设定

vi /etc/php.ini

memory_limit=512M

max_execution_time=600

date.timezone = Asia/Hong_Kong

完毕后重启生效

systemctl restart httpd

systemctl restart php-fpm

七、最终收尾

4、开始进入设置

http://ip/cacti/ ,默认用户名密码为 admin/admin

5、权限

最终完成后,要给cacti的rra和log文件夹 775的权限,不然无法生成最新图

 

 

 

参考文献:

https://www.cacti.net/download_cacti.php

https://blog.csdn.net/weixin_33769207/article/details/90539035

http://www.yaoge123.com/blog/archives/2639

https://blog.csdn.net/windowsworld/article/details/90345102

https://blog.csdn.net/zxy15771771622/article/details/78596150

http://www.vue5.com/centos/22999.html