1、yum 安装cacti
#yum install cacti
2、安装mariadb-server
#yum install mariadb-server
3、oracle linux 8 还需单独安装php-fpm
#yum install php-fpm
4、相关配置
a. 配置maraidb
#mysql_secure_installation //设置root密码
#mysql -u root -p //创建cacti数据库和用户、密码
CREATE DATABASE cacti;
GRANT ALL ON cacti.* TO 'cacti'@'localhost' IDENTIFIED BY 'StrongDBPassword';
FLUSH PRIVILEGES;
exit
#vi /etc/muy.cnf.d/mariadb-server.cnf
[mariadb-10.3]
collation-server=utf8mb4_unicode_ci
character-set-server=utf8mb4
max_heap_table_size=250M
tmp_table_size=250M
join_buffer_size=500M
innodb_buffer_pool_size=3876M
innodb_flush_log_at_timeout=3
innodb_read_io_threads=32
innodb_write_io_threads=16
innodb_buffer_pool_instances=33
innodb_io_capacity=5000
innodb_io_capacity_max=10000
innodb_file_format=Barracude
innodb_large_prefix=1
#mysql -u root -p cacti < /usr/share/doc/cacti/cacti.sql //初始化cacti数据库
#mysql_tzinfo_to_sql /usr/share/zoneinfo |mysql -u root -p mysql //装入timezone数据
#mysql -u root -p
GRANT SELECT ON mysql.time_zone_name TO cacti@localhost;
ALTER DATABASE cacti CHARACTER SET utf8mb4 COLLATE utf8mb4_unicode_ci;
FLUSH PRIVILEGES;
quit
#systemctl enable --now mariadb
b.配置php
#vi /etc/php.ini
; http://php.net/date.timezone
date.timezone = Asia/Shanghai //设置timezone
memory_limit = 400M //将PHP内存限制更改为400M
#systemctl enable --now php-fpm
c.配置httpd
#systemctl enable --now httpd
d.配置cacti
#vi /etc/httpd/conf.d/cacti.conf
#httpd 2.4
#Require host localhost
Require all granted #change
...
#vi /usr/share/cacti/include/config.php
$database_type = 'mysql';
$database_default = 'cacti';
$database_hostname = 'localhost';
$database_username = 'cacti';
$database_password = 'StrongDBPassword';
$database_port = '3306';
#crontab -u apache -e //设置定时数据采集
*/5 * * * * php /usr/share/cacti/poller.php > /dev/null 2>&1
e.安全设置
#setenforce 0
#vi /etc/sysconfig/selinux
SELINUX=disabled
#firewall-cmd --add-service={http,https} --permanent
#firewall-cmd --reload
5、运行cacti向导
http://ip/cacti
用户名密码admin/admin
修改密码
如果有警告或错误,按提示修改
6.中文字体安装
建立存放中文字体库的文件夹
# cd /usr/share/fonts
# mkdir chinese
将字体上传到/usr/share/fonts/chinese
我这里就只安装msyh.ttf,msyhbd.ttf,simhei.ttf,simsun.ttc,Fangsong.ttf。
刷新字体库缓存
#fc-cache
查询已经安装字体
#fc-list