1、zabbix的安装,可以采用yum安装,也可以选择从官网(www.zabbix.com/download)下载,但是yum下载的版本最多是2.2版,且需要epel的源。
这里采用wget从官网下载并安装。
[root@plinuxos src]# wget http://repo.zabbix.com/zabbix/3.4/rhel/7/x86_64/zabbix-release-3.4-2.el7.noarch.rpm --2018-01-13 20:29:34-- http://repo.zabbix.com/zabbix/3.4/rhel/7/x86_64/zabbix-release-3.4-2.el7.noarch.rpm Resolving repo.zabbix.com (repo.zabbix.com)... 162.243.159.138 Connecting to repo.zabbix.com (repo.zabbix.com)|162.243.159.138|:80... connected. HTTP request sent, awaiting response... 200 OK Length: 13572 (13K) [application/x-redhat-package-manager] Saving to: ‘zabbix-release-3.4-2.el7.noarch.rpm’ 100%[====================>] 13,572 9.98KB/s in 1.3s 2018-01-13 20:29:36 (9.98 KB/s) - ‘zabbix-release-3.4-2.el7.noarch.rpm’ saved [13572/13572] [root@plinuxos src]# rpm -ivh zabbix-release-3.4-2.el7.noarch.rpm warning: zabbix-release-3.4-2.el7.noarch.rpm: Header V4 RSA/SHA512 Signature, key ID a14fe591: NOKEY Preparing... ################################# [100%] Updating / installing... 1:zabbix-release-3.4-2.el7 ################################# [100%] [root@plinuxos src]#
2、安装服务,包含php和httpd。
[root@plinuxos src]# yum install -y zabbix-agent zabbix-get zabbix-server-mysql zabbix-web zabbix-web-mysql
3、安装mysql,可以采用yum安装,也可以编译安装。
这里采用yum安装。
[root@plinuxos src]# yum install -y mysql-server mysql-devel [root@plinuxos src]# systemctl start mysqld [root@plinuxos src]# ps aux| grep mysql root 14438 0.0 0.0 112652 968 pts/0 S+ 21:00 0:00 grep --color=auto mysql root 82080 0.0 0.0 113256 1580 ? S 2017 0:00 /bin/sh /usr/local/mysql/bin/mysqld_safe --datadir=/data/mysql --pid-file=/data/mysql/plinuxos.pid mysql 82213 0.1 14.1 1784592 471176 ? Sl 2017 248:15 /usr/local/mysql/bin/mysqld --basedir=/usr/local/mysql --datadir=/data/mysql --plugin-dir=/usr/local/mysql/lib/plugin --user=mysql --log-error=/data/mysql/plinuxos.err --pid-file=/data/mysql/plinuxos.pid
4、配置mysql
[root@plinuxos src]# vim /etc/my.cnf ...... character_set_server = utf8 ##增加改行,防止乱码 ...... [root@plinuxos src]# systemctl restart mysqld [root@plinuxos src]# /usr/local/mysql/bin/mysql -uroot ##进入mysql配置zabbix库 Welcome to the MySQL monitor. Commands end with ; or \g. Your MySQL connection id is 72 Server version: 5.6.35-log MySQL Community Server (GPL) Copyright (c) 2000, 2016, Oracle and/or its affiliates. All rights reserved. Oracle is a registered trademark of Oracle Corporation and/or its affiliates. Other names may be trademarks of their respective owners. Type 'help;' or '\h' for help. Type '\c' to clear the current input statement. mysql> create database zabbix character set utf8; Query OK, 1 row affected (0.00 sec) mysql> grant all on zabbix.* to 'zabbix'@'127.0.0.1' identified by 'juispan'; Query OK, 0 rows affected (0.00 sec) mysql> quit; Bye
5、导入自带数据库
[root@plinuxos src]# cd /usr/share/doc/zabbix-server-mysql-3.4.5/ AUTHORS ChangeLog COPYING create.sql.gz NEWS README [root@plinuxos zabbix-server-mysql-3.4.5]# gzip -d create.sql.gz [root@plinuxos zabbix-server-mysql-3.4.5]# export PATH=$PATH:/usr/local/mysql/bin/ [root@plinuxos zabbix-server-mysql-3.4.5]# mysql -uroot zabbix < create.sql
6、启动zabbix-server和httpd
[root@plinuxos ~]# systemctl start zabbix-server [root@plinuxos ~]# systemctl start httpd
7、查看zabbix日志
[root@plinuxos ~]# less /var/log/zabbix/zabbix_server.log
8、配置zabbix
[root@plinuxos ~]# vim /etc/zabbix/zabbix_server.conf …… DBHost=127.0.0.1 ##增加DBHost …… DBPassword=juispan ##增加口令 …… [root@plinuxos ~]# systemctl restart zabbix-server
9、打开游览器输入IP/zabbix自动跳转主页
10、安装完成登录系统