iso:centos7.9mini
1.1 关闭SeLinux
setenforce 0 #临时关闭
vi /etc/selinux/config
#永久关闭:关闭SELINUX
SELINUX=disabled
1.2 关闭firewalld
systemctl stop firewalld.service #临时关闭firewalld
systemctl disable firewalld.service #永久关闭firewalld
1.3 安装apache
yum install httpd #使用yum安装httpd
systemctl enable httpd #设置开机自启httpd
systemctl start httpd #开启httpd服务
systemctl status httpd #查看httpd服务状态
1.4 安装mysql
yum install mariadb mariadb-server #yum安装mariadb
systemctl enable mariadb #设置开机自启服务
systemctl start mariadb #开机mariadb服务
systemctl status mariadb #查看mariadb状态
1.5 安装php环境
yum install php php-mysql
1.6 安装zabbix
rpm -ivh http://repo.zabbix.com/zabbix/3.4/rhel/7/x86_64/zabbix-release-3.4-2.el7.noarch.rpm
#这里我遇到了一个报错,提示找不到这些包,我们可以更改为阿里源试下
报错如下:
解决如下:
[root@ceshi yum.repos.d]# cat zabbix.repo
[zabbix]
name=Zabbix Official Repository - $basearch
#baseurl=http://repo.zabbix.com/zabbix/3.4/rhel/7/$basearch/
baseurl=https://mirrors.aliyun.com/zabbix/zabbix/3.4/rhel/7/$basearch/
enabled=1
gpgcheck=1
gpgkey=file:///etc/pki/rpm-gpg/RPM-GPG-KEY-ZABBIX-A14FE591
[zabbix-non-supported]
name=Zabbix Official Repository non-supported - $basearch
#baseurl=http://repo.zabbix.com/non-supported/rhel/7/$basearch/
baseurl=https://mirrors.aliyun.com/zabbix/non-supported/rhel/7/$basearch/
enabled=1
gpgkey=file:///etc/pki/rpm-gpg/RPM-GPG-KEY-ZABBIX
gpgcheck=1
yum install zabbix-server-mysql zabbix-get zabbix-web zabbix-web-mysql zabbix-agent zabbix-sender #再次安装
创建一个zabbix库并设置为utf8的字符编码格式
create database zabbix character set utf8 collate utf8_bin;
创建账户并且授权设置密码
grant all privileges on zabbix.* to zabbix@localhost identified by 'zabbix';
flush privileges;
导入表
cd /usr/share/doc/zabbix-server-mysql-3.4.15/
进行解压
gunzip create.sql.gz
#进入mysql
1.7 配置zabbix server配置文件
#配置文件目录
cd /etc/zabbix/
[root@ceshi zabbix]# ls
web zabbix_agentd.conf zabbix_agentd.d zabbix_server.conf
#对zabbix_server.conf进行配置
DBHost=localhost
DBName=zabbix
DBUser=zabbix
DBPassword=zabbix
DBSocket=/var/lib/mysql/mysql.sock
开机自启zabbix-server服务
systemctl start zabbix-server #开启服务
systemctl enable zabbix-server #设置开机自启
systemctl status zabbix-server #查看服务状态
1.8 配置php
cd /etc/httpd/conf.d
[root@ceshi conf.d]# ls
autoindex.conf php.conf README userdir.conf welcome.conf zabbix.conf
vi zabbix.conf
# php_value date.timezone Europe/Riga
php_value date.timezone Asia/Shanghai
1.8 登陆zabbix网址设置
https://192.168.3.30/zabbix
操作如下:
输入我们之前设置的密码:zabbix
默认用户:Admin
默认密码:zabbix