一、Centos 6.5 下的Zabbix Server安装
上篇文章记录的是centos 7 下安装zabbix ,很简单。但是6.5上面没有可用的源直接安装zabbix,所以需要从别处下载。感谢itnihao团队的制作。
二、基础环境
zabbix server:系统:最小化安装 centos6.5 + Development Tools
内存:2G
IP: 10.8.0.22/16
zabbix agent:系统:最小化安装 centos6.5 + Development Tools
内存:2G
IP:10.8.0.11/16
三、安装步骤:
1.安装epel源:
[root@zabbix-6 ~]# rpm -Uvh https://dl.fedoraproject.org/pub/epel/epel-release-latest-6.noarch.rpm
Retrieving https://dl.fedoraproject.org/pub/epel/epel-release-latest-6.noarch.rpm
warning: /var/tmp/rpm-tmp.M3toD5: Header V3 RSA/SHA256 Signature, key ID 0608b895: NOKEY
Preparing... ########################################### [100%]
1:epel-release ########################################### [100%]
2.安装php
[root@zabbix-6 ~]# yum install php -y
3.安装php5.6 源
[root@zabbix-6 ~]# rpm -Uvh https://mirror.webtatic.com/yum/el6/latest.rpm
Retrieving https://mirror.webtatic.com/yum/el6/latest.rpm
warning: /var/tmp/rpm-tmp.9Dr1A3: Header V4 DSA/SHA1 Signature, key ID cf4c4ff9: NOKEY
Preparing... ########################################### [100%]
1:webtatic-release ########################################### [100%]
4.安装yum replace 插件
[root@zabbix-6 ~]# yum install yum-plugin-replace –y
5.更新php 为php-5.6版本
[root@zabbix-6 ~]# rpm -Uvh http://rpms.famillecollet.com/enterprise/remi-release-6.rpm
[root@zabbix-6 ~]# yum --enablerepo=remi install php php-fpm -y
[root@zabbix-6 ~]# yum replace php-common --replace-with=php56w-common -y
......
......
Removed:
php.x86_64 0:5.4.45-7.el6.remi php-cli.x86_64 0:5.4.45-7.el6.remi php-common.x86_64 0:5.4.45-7.el6.remi php-fpm.x86_64 0:5.4.45-7.el6.remi
Installed:
php56w.x86_64 0:5.6.19-1.w6 php56w-cli.x86_64 0:5.6.19-1.w6 php56w-common.x86_64 0:5.6.19-1.w6 php56w-fpm.x86_64 0:5.6.19-1.w6
Complete!
检查下php的版本
[root@zabbix-6 ~]# php -v
PHP 5.6.19 (cli) (built: Mar 5 2016 00:06:38)
Copyright (c) 1997-2016 The PHP Group
Zend Engine v2.6.0, Copyright (c) 1998-2016 Zend Technologies
[root@zabbix-6 ~]# php-fpm -v
PHP 5.6.19 (fpm-fcgi) (built: Mar 5 2016 00:09:12)
Copyright (c) 1997-2016 The PHP Group
Zend Engine v2.6.0, Copyright (c) 1998-2016 Zend Technologies
修改php.ini
[root@zabbix-6 ~]# sed -i 's/;always_populate_raw_post_data = -1/always_populate_raw_post_data = -1/g' /etc/php.ini
安装libcurl,这里需要注意下,设置dns 为8.8.8.8,修改/etc/resolv.conf. 不然安装会找不到服务器。
[root@zabbix-6 ~]# rpm -ivh http://mirror.city-fan.org/ftp/contrib/yum-repo/city-fan.org-release-1-13.rhel6.noarch.rpm
Retrieving http://mirror.city-fan.org/ftp/contrib/yum-repo/city-fan.org-release-1-13.rhel6.noarch.rpm
warning: /var/tmp/rpm-tmp.sbmz6D: Header V3 DSA/SHA1 Signature, key ID b56a8bac: NOKEY
Preparing... ########################################### [100%]
1:city-fan.org-release ########################################### [100%]
[root@zabbix-6 ~]# yum install libcurl -y
......
Updated:
libcurl.x86_64 0:7.48.0-1.0.cf.rhel6
Dependency Updated:
curl.x86_64 0:7.48.0-1.0.cf.rhel6 libssh2.x86_64 0:1.7.0-5.0.cf.rhel6
Complete!
[root@zabbix-6 ~]# rpm -e city-fan.org-release
6.下面是mysql的安装。
[root@zabbix-6 ~]# rpm -ivh http://dev.mysql.com/get/mysql-community-release-el6-5.noarch.rpm
Retrieving http://dev.mysql.com/get/mysql-community-release-el6-5.noarch.rpm
Preparing... ########################################### [100%]
1:mysql-community-release########################################### [100%]
[root@zabbix-6 ~]# yum install mysql-server -y
......
Installed:
mysql-community-libs.x86_64 0:5.6.29-2.el6 mysql-community-libs-compat.x86_64 0:5.6.29-2.el6 mysql-community-server.x86_64 0:5.6.29-2.el6
Dependency Installed:
mysql-community-client.x86_64 0:5.6.29-2.el6 mysql-community-common.x86_64 0:5.6.29-2.el6 perl-DBI.x86_64 0:1.609-4.el6
Dependency Updated:
postfix.x86_64 2:2.6.6-6.el6_7.1
Replaced:
mysql-libs.x86_64 0:5.1.71-1.el6
Complete!
修改mysql配置文件. /etc/my.cnf,在[mysqld]中添加innodb_file_per_table=1,并登录数据库,创建zabbix 数据库以及授权zabbix用户。
[root@zabbix-6 ~]# grep -v "^#" /etc/my.cnf | grep -v "^$"
[mysqld]
datadir=/var/lib/mysql
socket=/var/lib/mysql/mysql.sock
innodb_file_per_table=1
symbolic-links=0
sql_mode=NO_ENGINE_SUBSTITUTION,STRICT_TRANS_TABLES
[mysqld_safe]
log-error=/var/log/mysqld.log
pid-file=/var/run/mysqld/mysqld.pid
[root@zabbix-6 ~]# service mysqld start
[root@zabbix-6 ~]# mysql -uroot -p
Enter password:
mysql> create database zabbix character set utf8 collate utf8_bin;
mysql> grant all privileges on zabbix.* To zabbix@localhost identified by 'testzabbix'; (testzabbix 密码根据自己要求设置,后期安装zabbix-server需要)
7.现在开始安装zabbix-server 软件了。等不及了吧
[root@zabbix-6 ~]# git clone https://github.com/zabbixcn/zabbix3.0-rpm.git
[root@zabbix-6 RPMS]# pwd
/root/zabbix3.0-rpm/RPMS
[root@zabbix-6 RPMS]# ls
epel-release-6-8.noarch.rpm zabbix-proxy-mysql-3.0.0-1.el6.x86_64.rpm zabbix-server-pgsql-3.0.0-1.el6.x86_64.rpm
remi-release-6.rpm zabbix-proxy-pgsql-3.0.0-1.el6.x86_64.rpm zabbix-web-3.0.0-1.el6.noarch.rpm
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
[root@zabbix-6 RPMS]# yum install zabbix-server-mysql-3.0.0-1.el6.x86_64.rpm zabbix-web-3.0.0-1.el6.noarch.rpm
zabbix-web-mysql-3.0.0-1.el6.noarch.rpm httpd php56w-gd php56w-mysql php56w-bcmath php56w-mbstring php56w-xml -y......
Installed:
php56w-bcmath.x86_64 0:5.6.19-1.w6 php56w-gd.x86_64 0:5.6.19-1.w6 php56w-mbstring.x86_64 0:5.6.19-1.w6 php56w-mysql.x86_64 0:5.6.19-1.w6
php56w-xml.x86_64 0:5.6.19-1.w6 zabbix-web.noarch 0:3.0.0-1.el6 zabbix-web-mysql.noarch 0:3.0.0-1.el6
Dependency Installed:
dejavu-fonts-common.noarch 0:2.33-1.el6 dejavu-sans-fonts.noarch 0:2.33-1.el6 fontpackages-filesystem.noarch 0:1.41-1.1.el6
libXpm.x86_64 0:3.5.10-2.el6 libxslt.x86_64 0:1.1.26-2.el6_3.1 php56w-ldap.x86_64 0:5.6.19-1.w6
php56w-pdo.x86_64 0:5.6.19-1.w6 t1lib.x86_64 0:5.1.2-6.el6_2.1
Complete!
zabbix-server 也要安装zabbix-agent客户端
[root@zabbix-6 RPMS]# yum install zabbix-agent-3.0.0-1.el6.x86_64.rpm -y
修改http的时区
[root@zabbix-6 ~]# sed -i "s@# php_value date.timezone Europe/Riga@php_value date.timezone Asia/Shanghai@g" /etc/httpd/conf.d/zabbix.conf
初始化zabbix 数据库,建表。文件目录在/usr/share/zabbix-server-mysql-3.0.0
[root@zabbix-6 zabbix-server-mysql-3.0.0]# pwd
/usr/share/zabbix-server-mysql-3.0.0
[root@zabbix-6 zabbix-server-mysql-3.0.0]# ls
create.sql.gz
[root@zabbix-6 zabbix-server-mysql-3.0.0]# zcat create.sql.gz | mysql -uzabbix -ptestzabbix zabbix
Warning: Using a password on the command line interface can be insecure.
建完后,修改zabbix-server 端的配置,主要改动下面这4处
[root@zabbix-6 ~]# vim /etc/zabbix/zabbix_server.conf
......
DBHost=localhost
DBName=zabbix
DBUser=zabbix
DBPassword=testzabbix
启动httpd、zabbix-server、zabbix-agent服务
[root@zabbix-6 ~]# /etc/init.d/httpd start
[root@zabbix-6 ~]# /etc/init.d/zabbix-server start
[root@zabbix-6 ~]# /etc/init.d/zabbix-agent start
8.现在可以去web页面设置了进行安装了。简单配下图。
安装完成后,可以添加主机了。添加主机篇幅可以参考上一篇文章。
本文章属于本作者原创,遵循开源协议,如有转载,请注明本链接的源地址。谢谢 继续更新中!!