安装zabbix server篇
一、安装前准备虚拟环境(已经准备好centos7服务器的此步骤-跳过)
创建虚拟机:在VirtualBox安装centos7
至少安装两台服务器:
zabbix server
zabbix agent
二、Centos7系统环境设置
# 升级系统组件到最新的版本
[root@zabbix ~]# yum -y update
# 临时关闭selinux
[root@zabbix ~]# setenforce 0
# 永久关闭selinux
[root@zabbix ~]# vi /etc/selinux/config
#将SELINUX=enforcing改为SELINUX=disabled
# 以上的更改需要重启后生效
[root@zabbix ~]# reboot
# 查看selinux是否关闭,Disabled 为关闭
[root@zabbix ~]# getenforce
Disabled
# 临时关闭防火墙
[root@zabbix ~]# systemctl stop firewalld.service
# 查看防火墙是否关闭
[root@zabbix ~]# firewall-cmd --state
not running
# 禁止firewall开机启动
[root@zabbix ~]# systemctl disable firewalld.service
Removed symlink /etc/systemd/system/multi-user.target.wants/firewalld.service.
Removed symlink /etc/systemd/system/dbus-org.fedoraproject.FirewallD1.service.
三、搭建LAMP环境
# 安装所需所有软体仓库
# Zabbix是建立在LAMP或者LNMP环境之上,在此为了方便就使用yum安装LAMP环境。
[root@zabbix ~]# yum install -y httpd mariadb-server mariadb php php-mysql php-gd libjpeg* php-ldap php-odbc php-pear php-xml php-xmlrpc php-mhash
# 安装完成后检查应用版本
[root@zabbix ~]# rpm -qa httpd php mariadb
php-5.4.16-46.1.el7_7.x86_64
mariadb-5.5.64-1.el7.x86_64
httpd-2.4.6-90.el7.centos.x86_64
[root@zabbix ~]# vi /etc/httpd/conf/httpd.conf
ServerName www.zabbila.com #修改为主机名
DirectoryIndex index.html index.php # 添加首页支持格式
# 编辑httpd
vi /etc/httpd/conf/httpd.conf
ServerName www.zabbixla.com #修改为主机名
DirectoryIndex index.html index.php # 添加首页支持格式
# 编辑配置php,配置中国时区
[root@zabbix ~]# vi /etc/php.ini
date.timezone = PRC
# 启动httpd
[root@zabbix ~]# systemctl start httpd
# 加入开机自启动httpd
[root@zabbix ~]# systemctl enable httpd
Created symlink from /etc/systemd/system/multi-user.target.wants/httpd.service to /usr/lib/systemd/system/httpd.service.
# 启动mysqld
[root@zabbix ~]# systemctl start mariadb
# 加入开机自启动mysqld
[root@zabbix ~]# systemctl enable mariadb
Created symlink from /etc/systemd/system/multi-user.target.wants/mariadb.service to /usr/lib/systemd/system/mariadb.service.
# 查看httpd启动情况,80端口监控表示httpd已启动
[root@zabbix ~]# ss -anplt | grep httpd
LISTEN 0 128 [::]:80 [::]:* users:(("httpd",pid=1752,fd=4),("httpd",pid=1751,fd=4),("httpd",pid=1750,fd=4),("httpd",pid=1749,fd=4),("httpd",pid=1748,fd=4),("httpd",pid=1746,fd=4))
#查看mysqld启动情况,3306端口监控表示mysqld已启动
[root@zabbix ~]# ss -naplt | grep mysqld
LISTEN 0 50 *:3306 *:* users:(("mysqld",pid=2043,f