登录官网选择版本
https://www.zabbix.com/cn/download?zabbix=4.0&os_distribution=centos&os_version=7&db=mysql&ws=apache
此次选择安装版本为ZABBIX4.0,LINUX版本为CentOS7,数据库选择为MySQL。
LINUX已事先安装完成,网络也配置完成并测试通过。
通过SSH进入系统,然后根据官网指导逐步进行安装。
1.Install and configure Zabbix server for your platform
a. Install Zabbix repository
rpm -Uvh https://repo.zabbix.com/zabbix/4.0/rhel/7/x86_64/zabbix-release-4.0-2.el7.noarch.rpm
yum clean all
b. 安装Zabbix server,Web前端,agent
yum install zabbix-server-mysql zabbix-web-mysql zabbix-agent
c.install Apache
yum install httpd
启动并检查http服务
systemctl start httpd
systemctl status httpd
显示已启动
d.install Mysql
安装前由于本CentOS版本不带wget服务,所以先安装wget服务
yum install wget
然后开始下载并安装(此过程较长)
wget http://repo.mysql.com/mysql-community-release-el7-5.noarch.rpm
rpm -ivh mysql-community-release-el7-5.noarch.rpm
yum update
yum install mysql-server
参考文献:https://blog.csdn.net/weixin_45187975/article/details/107096952
启动并检查MySQL服务
systemctl start mysqld
systemctl status mysqld
显示已开始运行
e.install php
yum install -y php php-fpm php-mysql
f.开始创建初始数据库
mysql -uroot -p
由于原密码为空,password直接回车进入数据库命令界面
mysql> create database zabbix character set utf8 collate utf8_bin;
mysql> create user zabbix@localhost identified by 'password';
密码设为password
mysql> grant all privileges on zabbix.* to zabbix@localhost;
mysql> quit;
退出
导入初始架构和数据,系统将提示您输入新创建的密码
zcat /usr/share/doc/zabbix-server-mysql*/create.sql.gz | mysql -uzabbix -p zabbix
新密码即为password
g.为ZABBIX server配置数据库
编辑配置文件
vi /etc/zabbix/zabbix_server.conf
进入文件后找到DBPassword填写密码
注意去除原#使之生效。(修改i,退出按ESC,:wq)
h.为Zabbix前端配置PHP
编辑配置文件
vi /etc/httpd/conf.d/zabbix.conf
修改原timezone(默认Europe/Riga)为 Asia/Shanghai
注意去除原#使之生效(修改i,退出按ESC,:wq)
完成后退出。
i.启动Zabbix server和agent进程
启动Zabbix server和agent进程,并为它们设置开机自启:
systemctl restart zabbix-server zabbix-agent httpd
systemctl enable zabbix-server zabbix-agent httpd
为使得所有配置修改生效,重启LINUX
至此安装及配置启动服务已经完成
2.关闭防火墙和SELinux
a.关闭防火墙
systemctl stop firewalld #关闭
systemctl status firewalld #查看
systemctl disable firewalld #永久关闭
b.关闭SELinux
进入配置文件进行修改
vi /etc/selinux/config
关闭完成,重启
参考文献:https://blog.51cto.com/u_12924846/2336425
打开ZABBIX前端进行配置,安装全部完成。
(前端地址为http://server_ip_or_name/zabbix,server_ip_or_name为你的服务器地址。)
前端到达登录界面后,初始用户名为Admin,密码为zabbix。