1-1 服务端部署
最后更新于:2022-04-02 07:40:35
### 基础环境
操作系统:Centos7.3 1611 关闭防火墙和Selinux
|序号|名称|IP|端口|
| :------------: | :------------: | :------------: | :------------: |
| 1 |Zabbix(Server/Web) | 192.168.16.3 |10051/80|
| 2 |MySQL|192.168.16.4|3306 |
#### 部署Zabbix Server/Web服务
```shell
mkdir /etc/yum.repos.d/old && mv /etc/yum.repos.d/C* /etc/yum.repos.d/old/
wget -O /etc/yum.repos.d/epel.repo http://mirrors.aliyun.com/repo/epel-7.repo
wget -O /etc/yum.repos.d/CentOS-Base.repo http://mirrors.aliyun.com/repo/Centos-7.repo
rpm -ivh http://repo.zabbix.com/zabbix/3.0/rhel/7/x86_64/zabbix-release-3.0-1.el7.noarch.rpm
yum install httpd php php-bcmath php-cli php-common php-gd php-ldap php-mbstring php-mysql php-pdo php-xml
yum install fping OpenIPMI net-snmp libzip
yum install zabbix-server-mysql.x86_64 zabbix-web.noarch zabbix-web-mysql.noarch zabbix-java-gateway zabbix-agent -y
```
#### 配置MySQL数据库
```shell
create database zabbix;
create user zabbix@'192.168.%' identified by 'zabbix';
grant all on zabbix.* to zabbix@'192.168.%';
```
#### 导入Zabbix基础数据并启动Zabbix
```shell
cd /usr/share/doc/zabbix-server-mysql-3.*/
gzip -d create.sql.gz
#zabbix执行
mysql -uzabbix -p -h 192.168.0.236 zabbix< create.sql
#MySQL执行
cd /usr/local/mysql/bin/ && ./mysql -uroot -S /tmp/mysql3306.sock -p zabbix < /tmp/create.sql
```
#### 启动Apache并访问Zabbix页面
启动 http服务
```shell
systemctl restart httpd
```
访问zabbix进行初始化:http://ip/zabbix
';