|
1、操作系统环境
1
2
3
4
5
6
7
| [iyunv@Server ~]# cat /etc/issue
CentOS release 6.4 (Final)
Kernel \r on an \m
[iyunv@Server ~]# uname -r
2.6.32-358.el6.x86_64
[iyunv@Server ~]# uname -m
x86_64
|
备份备份。。
1
| [iyunv@Server ~]# cp -a /usr/share/zabbix /tmp/zabbix.bak
|
备份数据库,也可以使用mysqldump命令等等。
1
| [iyunv@Server ~]# cp /var/lib/mysql /tmp/mysql.bak
|
备份zabbix_server.conf文件
1
| [iyunv@Server ~]# cp /etc/zabbix/zabbix_server.conf /tmp/zabbix_server.conf.bak
|
2、Zabbix 3.x对PHP的要求最低为5.4,而CentOS6默认为5.3.3,完全不满足要求,故需要利用第三方源,将PHP升级到5.4以上,注意,不支持PHP7
3、安装php第三方源,并安装相应php版本
这里选择php5.5版本安装
1
| [iyunv@Server ~]# yum install php55w.x86_64 php55w-cli.x86_64 php55w-common.x86_64 php55w-gd.x86_64 php55w-ldap.x86_64 php55w-mbstring.x86_64 php55w-mcrypt.x86_64 php55w-mysql.x86_64 php55w-pdo.x86_64 -y
|
查看安装后的php版本
1
2
3
4
| [iyunv@Server ~]# php -v
PHP 5.5.34 (cli) (built: Apr 2 2016 10:11:45)
Copyright (c) 1997-2015 The PHP Group
Zend Engine v2.5.0, Copyright (c) 1998-2015 Zend Technologies
|
4、zabbix3.x版本需要curl版,curl >= 7.20 (如需支持SMTP认证)
查看安装后的curl版本
1
2
3
4
| [iyunv@Server ~]# curl -V
curl 7.48.0 (x86_64-redhat-linux-gnu) libcurl/7.48.0 OpenSSL/1.0.1e zlib/1.2.3 c-ares/1.11.0 libidn/1.18 libssh2/1.7.0
Protocols: dict file ftp ftps gopher http https imap imaps ldap ldaps pop3 pop3s rtsp scp sftp smb smbs smtp smtps telnet tftp
Features: AsynchDNS IDN IPv6 Largefile GSS-API Kerberos SPNEGO NTLM NTLM_WB SSL libz UnixSockets Metalink
|
卸载第三方源,卸载不卸载自己看着办,随意
1
| [iyunv@Server ~]# rpm -e city-fan.org-release
|
官方没有提供centos6 zabbix3.0 server,我是git clone itnihao的github上。。。
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
| [iyunv@Server ~]# git clone https://github.com/zabbixcn/zabbix3.0-rpm.git
Initialized empty Git repository in /root/zabbix3.0-rpm/.git/
remote: Counting objects: 82, done.
remote: Compressing objects: 100% (54/54), done.
remote: Total 82 (delta 23), reused 82 (delta 23), pack-reused 0
Unpacking objects: 100% (82/82), done.
[iyunv@Server ~]# cd zabbix3.0-rpm/RPMS/
[iyunv@Server RPMS]# ls
zabbix-agent-3.0.0-1.el6.x86_64.rpm zabbix-proxy-sqlite3-3.0.0-1.el6.x86_64.rpm zabbix-web-japanese-3.0.0-1.el6.noarch.rpm
zabbix-get-3.0.0-1.el6.x86_64.rpm zabbix-sender-3.0.0-1.el6.x86_64.rpm zabbix-web-mysql-3.0.0-1.el6.noarch.rpm
zabbix-java-gateway-3.0.0-1.el6.x86_64.rpm zabbix-server-mysql-3.0.0-1.el6.x86_64.rpm zabbix-web-pgsql-3.0.0-1.el6.noarch.rpm
zabbix-proxy-mysql-3.0.0-1.el6.x86_64.rpm zabbix-server-pgsql-3.0.0-1.el6.x86_64.rpm
zabbix-proxy-pgsql-3.0.0-1.el6.x86_64.rpm zabbix-web-3.0.0-1.el6.noarch.rpm
[iyunv@Server RPMS]# rpm -ivh http://repo.webtatic.com/yum/el6/latest.rpm
Retrieving http://repo.webtatic.com/yum/el6/latest.rpm
Preparing... ########################################### [100%]
package webtatic-release-6-6.noarch is already installed
|
5、安装zabbix web以及mysql等
1
2
3
| [iyunv@Server RPMS]# pwd
/root/zabbix3.0-rpm/RPMS
[iyunv@Server RPMS]# yum install zabbix-web-mysql-3.0.0-1.el6.noarch.rpm zabbix-web-3.0.0-1.el6.noarch.rpm -y
|
如果yum安装过程中出现......Error Summary问题,把原来zabbix卸载即可
1
2
| [iyunv@Server RPMS]# yum remove zabbix22 -y
[iyunv@Server RPMS]# yum install zabbix-server-mysql-3.0.0-1.el6.x86_64.rpm -y
|
6、启动服务
1
2
3
4
5
| [iyunv@Server RPMS]# /etc/init.d/httpd restart
Stopping httpd: [ OK ]
Starting httpd: [ OK ]
[iyunv@Server RPMS]# /etc/init.d/mysqld start
Starting mysqld: [ OK ]
|
启动zabbix-server出现cannot open "/var/log/zabbixsrv/zabbix_server.log": [13] Permission denied
1
2
3
| [iyunv@Server web]# /etc/init.d/zabbix-server restart
Shutting down Zabbix server: [FAILED]
Starting Zabbix server: [ OK ]
|
1
| [iyunv@Server web]# zabbix_server [2285]: cannot open "/var/log/zabbixsrv/zabbix_server.log": [13] Permission denied
|
解决:
1
2
3
4
5
| [iyunv@Server zabbixsrv]# touch /var/log/zabbixsrv/zabbix_server.log
[iyunv@Server zabbixsrv]# chown zabbix zabbix_server.log
[iyunv@Server zabbixsrv]# /etc/init.d/zabbix-server restart
Shutting down Zabbix server: [FAILED]
Starting Zabbix server: [ OK ]
|
出现pid问题
1
| [iyunv@Server zabbixsrv]# tail -f zabbix_server.log
|
zabbix_server [2368]: cannot create PID file [/var/run/zabbixsrv/zabbix_server.pid]: [2] No such file or directory
创建相应目录以及相应的权限即可,最后重启服务
1
2
3
4
5
| [iyunv@Server zabbixsrv]# mkdir /var/run/zabbixsrv/
[iyunv@Server zabbixsrv]# chown zabbix /var/run/zabbixsrv/ -R
[iyunv@Server zabbixsrv]# /etc/init.d/zabbix-server restart
Shutting down Zabbix server: [FAILED]
Starting Zabbix server: [ OK ]
|
7、替换date.timezone改成Shanghai即可,操作如下
1
2
3
4
5
| [iyunv@Server ~]# cd /etc/httpd/conf.d/
[iyunv@Server conf.d]# ls
php.conf README welcome.conf zabbix.conf
[iyunv@Server conf.d]# cp zabbix.conf zabbix.conf.bak
[iyunv@Server conf.d]# sed -i "s@# php_value date.timezone Europe/Riga@php_value date.timezone Asia/Shanghai@g" /etc/httpd/conf.d/zabbix.conf
|
重启httpd服务即可
1
2
3
| [iyunv@Server conf.d]# /etc/init.d/httpd restart
Stopping httpd: [FAILED]
Starting httpd: [ OK ]
|
8、安装agent3.0版本
1
2
3
4
5
6
7
8
| [iyunv@Server RPMS]# pwd
/root/zabbix3.0-rpm/RPMS
[iyunv@Server RPMS]# ls
zabbix-agent-3.0.0-1.el6.x86_64.rpm zabbix-proxy-sqlite3-3.0.0-1.el6.x86_64.rpm zabbix-web-japanese-3.0.0-1.el6.noarch.rpm
zabbix-get-3.0.0-1.el6.x86_64.rpm zabbix-sender-3.0.0-1.el6.x86_64.rpm zabbix-web-mysql-3.0.0-1.el6.noarch.rpm
zabbix-java-gateway-3.0.0-1.el6.x86_64.rpm zabbix-server-mysql-3.0.0-1.el6.x86_64.rpm zabbix-web-pgsql-3.0.0-1.el6.noarch.rpm
zabbix-proxy-mysql-3.0.0-1.el6.x86_64.rpm zabbix-server-pgsql-3.0.0-1.el6.x86_64.rpm
zabbix-proxy-pgsql-3.0.0-1.el6.x86_64.rpm zabbix-web-3.0.0-1.el6.noarch.rpm
|
安装zabbix-agent3.0版本即可。也可以yum install *.rpm安装所有的,根据自己的情况去安装即可
1
| [iyunv@Server RPMS]# yum install zabbix-agent-3.0.0-1.el6.x86_64.rpm
|
查看zabbix-agent安装后的版本
1
2
3
| [iyunv@Server zabbix]# zabbix_agentd -V
zabbix_agentd (daemon) (Zabbix) 3.0.0
Revision 58460 15 February 2016, compilation time: Feb 17 2016 09:55:34
|
修改zabbix_agentd.conf文件连接zabbix-server服务器ip地址即可,重启服务
1
2
3
| [iyunv@Server zabbix]# /etc/init.d/zabbix-agent restart
Shutting down Zabbix agent: [FAILED]
Starting Zabbix agent: [ OK ]
|
9、登录浏览器查看
收工,下班走人。。
|
|
|