一. zabbix环境准备
1.关闭防火墙,修改selinux
systemctl stop firewalld
systemctl disable firewalld
setenforce 0
也可使用sed命令直接修改文件内容
sed -i 's/SELINUX=enforcing/SELINUX=disabled/g'/etc/sysconfig/selinux
2.修改/etc/hosts
[root@centos test]# cat /etc/hosts
127.0.0.1 localhost localhost.localdomain localhost4 localhost4.localdomain4
::1 localhost localhost.localdomain localhost6 localhost6.localdomain6
192.168.10.10 centos
3.指定zabbix源
[root@localhost~]#wget http://repo.zabbix.com/zabbix/3.2/rhel/7/x86_64/zabbix-release-3.2-1.el7.noarch.rpm
[root@localhost~]#rpm -i http://repo.zabbix.com/zabbix/3.2/rhel/7/x86_64/zabbix-release-3.2-1.el7.noarch.rpm
4.安装常用软件包及数据库相关软件包
yum clean all
yum install wget vim net-tools mariadb mariadb-server -y
6.#创建zabbix库,默认字符集为utf8
MariaDB [(none)]> GRANT ALL ON zabbix.* TO root@'127.0.0.1' IDENTIFIED BY '123456';
MariaDB [(none)]> GRANT ALL ON zabbix.* TO root@'localhost' IDENTIFIED BY '123456';
# rootr可以从本机登录,密码为123456,对zabbix有所有的权限。可以通过show grants for root;查看root的权限
MariaDB [(none)]> GRANT ALL ON zabbix.* TO zabbix@'192.168.10.%' IDENTIFIED BY 'zabbix';
vim /etc/php.ini
max_execution_time = 300
memory_limit = 128M
post_max_size = 16M
upload_max_filesize = 2M
max_input_time = 300
date.timezone Shanghai/Asia
8.测试
重启服务
systemctl restart httpd.service
systemctl restart mariadb.service
通过浏览器访问验证:
http://192.168.10.10/index.php
二、安装zabbix软件包
yum install zabbix-server-mysql zabbix-web-mysql -y
导入zabbix数据库
zcat /usr/share/doc/zabbix-server-mysql-3.2.11/create.sql.gz | mysql -uzabbix -pzabbix zabbix
# 登录mysql查看是否创建成功
mysql -uroot -p
MariaDB [zabbix]> use zabbix
MariaDB [zabbix]> show tables;
修改zabbix server配置文件
vim /etc/zabbix/system/zabbix-server.conf
#要连接的数据库主机,这里默认数据库和zabbix安装在同一台主机上。
DBHost=localhost# 取消注释
#连接的数据库名称,默认为zabbix
DBName=zabbix
# 数据库用户名
DBUser=zabbix
# 数据库密码
DBPassword=zabbix
启动服务,设置开机启动
systemctl start zabbix-server.service
systemctl enable zabbix-server.service
访问URL:http://IP地址/zabbix进行登录
用户名密码 :Admin/zabbix
至此,zabbix server端安装完毕