先添加EPEL再用yum安装cacti和中文字体
yum install cacti cacti-spine mariadb-server google-noto-sans-simplified-chinese-fonts
编辑 /etc/httpd/conf.d/cacti.conf ,在 Directory /usr/share/cacti/ 中添加可访问的浏览器客户端
编辑 /etc/cron.d/cacti ,去掉注释
编辑 /etc/spine.conf ,注释RDB_*
创建数据库
[root@yaoge123]# mysqladmin --user=root create cacti
创建数据库用户
[root@yaoge123]# mysql --user=root mysql
MariaDB [mysql]> GRANT ALL ON cacti.* TO cactiuser@localhost IDENTIFIED BY 'cactiuser';
MariaDB [mysql]> flush privileges;
数据库用户增加 timezone 权限
[root@yaoge123]# mysql -u root
MariaDB [(none)]> GRANT SELECT ON mysql.time_zone_name TO cactiuser@localhost IDENTIFIED BY 'cactiuser';
MariaDB [(none)]> flush privileges;
数据库增加 timezone
[root@yaoge123]# mysql_tzinfo_to_sql /usr/share/zoneinfo/ | mysql -u root mysql
新建一个文件 /etc/my.cnf.d/cacti.cnf ,内容供参考根据实际情况修改
[mysqld]
character-set-client = utf8mb4
character-set-server = utf8mb4
collation-server = utf8mb4_unicode_ci
innodb_additional_mem_pool_size = 80M
innodb_buffer_pool_size = 1024M
innodb_doublewrite = ON
innodb_file_format = Barracuda
innodb_file_per_table = ON
innodb_flush_log_at_trx_commit = 2
innodb_flush_method = O_DIRECT
innodb_large_prefix = ON
join_buffer_size = 748M
max_allowed_packet = 16777216
max_heap_table_size = 374M
tmp_table_size = 374M
重启相关服务,设置开机自动启动
systemctl restart mariadb
systemctl enable mariadb
systemctl restart httpd
systemctl enable httpd
导入数据库
[root@yaoge123]# mysql cacti < /usr/share/doc/cacti-*/cacti.sql
浏览器打开 http://<server>/cacti/ ,默认用户名密码为 admin/admin