1.我这里使用的是ali的yum源
#wget -O /etc/yum.repos.d/CentOS-Base.repo http://mirrors.aliyun.com/repo/Centos-7.repo
#setenforce 0
另:配置文件路径 在 /etc/selinux/config 里面,需要将其修改,不然关机再开会出现zabbix-server服务启动失败的情况。
#systemctl stop firewalld
#systemctl disable firewalld
2.下载安装zabbix 4.2
官网网址https://www.zabbix.com/download?zabbix=4.2&os_distribution=centos&os_version=7&db=mysql
选择对应的系统版本,然后按照官网的命令进行下载,安装。
# rpm -Uvh https://repo.zabbix.com/zabbix/4.2/rhel/7/x86_64/zabbix-release-4.2-1.el7.noarch.rpm
# yum clean all
# yum -y install zabbix-server-mysql zabbix-web-mysql zabbix-agent
3.安装mariadb
#yum install -y mariadb-server.x86_64 mariadb-devel.x86_64 mariadb-libs.x86_64
#chmod -R 777 /var/lib/mysql
#systemctl enable mariadb
#systemctl start mariadb
#mysql_secure_installation
Set root password? [Y/n] <– 是否设置root用户密码,输入y并回车或直接回车
New password: <– 设置root用户的密码
Re-enter new password: <– 再输入一次你设置的密码
a
mysql> create database zabbix character set utf8 collate utf8_bin;
mysql> grant all privileges on zabbix.* to 'zabbix'@'localhost' identified by 'zabbix';
DBHost=localhost
DBName=zabbix
DBUser=zabbix
DBPassword=zabbix
保存退出
#vim /etc/httpd/conf.d/zabbix.conf 修改时区为上海
php_value date.timezone Asia/Shanghai
6.安装apache
#yum install -y httpd* 粗略安装,详细安装请自行搜寻
7.启动apache和zabbix
#systemctl start httpd
# systemctl enable httpd
# netstat -an |grep 80
tcp 0 0 192.168.56.11:80 0.0.0.0:* LISTEN
# systemctl start zabbix-server
# systemctl enable zabbix-server
# systemctl start zabbix-agent.service
# systemctl enable zabbix-agent.service
遇到了一些报错,解决方法:
#yum install policycoreutils-python
# cat /var/log/audit/audit.log | grep zabbix_server | grep denied | audit2allow -M zabbix_server_setrlimit
# semodule -i zabbix_server_setrlimit.pp
# systemctl start zabbix-server
8.访问zabbix安装网址
http://ip/zabbix
如果不能访问,可以查看一下apche状态是否正常
防火墙firewalld是否关闭
selinux的setenfore状态是什么?
9.web安装
①下一步
②等待自我检测,全部OK即可下一步,有问题需要进行排查。
③填入数据库密码
④zabbix命名
⑤确认信息无误
⑥完成
现在可以登录zabbix了
默认用户名密码:
Admin
zabbix
注:
以上是基于图形化安装界面提供的步骤说明,如果没有安到图形化这么高级,可能会缺少一些依赖包,下面补充:
#yum install gcc mysql-devel php-mbstring php-bcmath php-mysql OpenIPMI OpenIPMI-devel libcurl libcurl-devel libxml2 libxml2-devel net-snmp net-snmp-devel fping -y