zabbix3.4版本的安装
1、安装yum源
[root@zabbix-server ~]# rpm -ivh https://mirrors.aliyun.com/zabbix/zabbix/3.4/rhel/7/x86_64/zabbix-release-3.4-1.el7.centos.noarch.rpm
2、创建名为/etc/yum.repos.d/zabbix.repo的文件,编写内容如下:
[root@zabbix-server ~]#vim /etc/yum.repos.d/zabbix.repo
[zabbix]
name=Zabbix Official Repository - \$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=https://mirrors.aliyun.com/zabbix/non-supported/rhel/7/\$basearch/
enabled=1
gpgkey=file:///etc/pki/rpm-gpg/RPM-GPG-KEY-ZABBIX
gpgcheck=1
3、下载安装
[root@zabbix-server ~]#yum install zabbix-server-mysql zabbix-web-mysql zabbix-agent -y
[root@zabbix-server ~]#systemctl start zabbix-server //监控端
[root@zabbix-server ~]#systemctl enable zabbix-server
4、安装设置数据库
[root@zabbix-server ~]# yum install -y mariadb mariadb-server
[root@zabbix-server ~]# systemctl start mariadb
[root@zabbix-server ~]# systemctl enable mariadb
[root@zabbix-server ~]# mysqladmin -u root password 'zabbix' #设置root密码
5、创建数据库并授权账号
[root@zabbix-server ~]# mysql -uroot -p'zabbix'
MariaDB [(none)]> create database zabbix character set utf8 collate utf8_bin; # 创建zabbix数据库
MariaDB [(none)]> grant all privileges on zabbix.* to zabbix@localhost identified by 'zabbix'; # 注意授权网段
MariaDB [(none)]> flush privileges; # 刷新授权
MariaDB [(none)]> \q #退出
Bye
6、导入表
[root@zabbix-server ~]# zcat /usr/share/doc/zabbix-server-mysql*/create.sql.gz | mysql -uzabbix -p zabbix
Enter password: #输入密码‘zabbix’
7、修改server端的配置文件
[root@zabbix-server ~]# cd /etc/zabbix/
[root@zabbix-server zabbix]# ls
web zabbix_agentd.conf zabbix_agentd.d zabbix_server.conf
[root@zabbix-server zabbix]# vim zabbix_server.conf
找到这四行,修改如下:
DBHost=localhost #数据库对外的主机
DBName=zabbix #数据库名称
DBUser=zabbix #数据库用户
DBPassword=zabbix #数据库密码
[root@zabbix-server zabbix]# systemctl start zabbix-server
[root@zabbix-server zabbix]# netstat -lntp | grep 10051
tcp 0 0 0.0.0.0:10051 0.0.0.0:* LISTEN 1574/zabbix_server
tcp6 0 0 :::10051 :::* LISTEN 1574/zabbix_server
8、配置 web GUI
[root@zabbix-server zabbix]# vim /etc/httpd/conf.d/zabbix.conf
找到这一行,修改如下:
php_value date.timezone Asia/Shanghai //修改时区
[root@zabbix-server zabbix]# systemctl start httpd
[root@zabbix-server zabbix]# systemctl enable httpd
9、浏览器访问并进行初始化设置,访问http://监控端ip/zabbix
输入账号密码登录
10、被监控端下载安装zabbix-agent(另一台机器)
安装yum源
[root@zabbix-agent-none1 ~]# rpm -ivh https://mirrors.aliyun.com/zabbix/zabbix/3.4/rhel/7/x86_64/zabbix-release-3.4-1.el7.centos.noarch.rpm
创建名为/etc/yum.repos.d/nginx.repo的文件,编写内容如下:
[root@zabbix-agent-none1 ~]#vim /etc/yum.repos.d/zabbix.repo
[zabbix]
name=Zabbix Official Repository - \$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=https://mirrors.aliyun.com/zabbix/non-supported/rhel/7/\$basearch/
enabled=1
gpgkey=file:///etc/pki/rpm-gpg/RPM-GPG-KEY-ZABBIX
gpgcheck=1
下载安装
[root@zabbix-agent-none1 ~]#yum install zabbix-agent -y
[root@zabbix-agent-none1 ~]#systemctl start zabbix-agent
[root@zabbix-agent-none1 ~]#systemctl enable zabbix-agent
11、去修改配置文件:
[root@zabbix-agent-none1 ~]# vim /etc/zabbix/zabbix_agent.conf
修改内容如下:
Server=192.168.246.228 //zabbix服务端的地址
ServerActive=192.168.246.228 //主动模式 zabbix-server-ip
Hostname=zabbix-agent-none1
UnsafeUserParameters=1 //是否限制用户自定义 keys 使用特殊字符 1是可以启用特殊字符 0是不可以启用特殊字符
EnableRemoteCommands=0 //是否允许别人执行远程操作命令,默认是禁用的,打开的话会有安全风险.
:wq
保存并退出
[root@zabbix-agent-none1 zabbix]# systemctl start zabbix-agent
[root@zabbix-agent-none1 zabbix]# netstat -lntp | grep 10050
tcp 0 0 0.0.0.0:10050 0.0.0.0:* LISTEN 9369/zabbix_agentd
tcp6 0 0 :::10050 :::* LISTEN 9369/zabbix_agentd
到这里监控端和被监控端的zabbix3.4都安装完成了。