CentOS 6.8下部署Zabbix3.0环境要求
PHP >= 5.4 (CentOS6默认为5.3.3,需要更新)
curl >= 7.20 (如需支持SMTP认证,需更新)
安装MySQL(已安装的忽略此步骤,最好5.6以上版本)
rpm -ivh
yum install mysql-server –y
启动:
设置root密码:
mysql_secure_installation
Enter current password for root (enter for none):
Set root password? [Y/n]
Remove anonymous users? [Y/n]
Disallow root login remotely? [Y/n]
Remove test database and access to it? [Y/n]
Reload privilege tables now? [Y/n]
创建zabbix数据库:
mysql -uroot -p
mysql> CREATE DATABASE zabbix CHARACTER SET utf8 COLLATE utf8_bin;
mysql> GRANT ALL PRIVILEGES ON zabbix.* TO zabbix@localhost IDENTIFIED BY 'zabbix';
mysql> show databases;
+--------------------+
| Database |
+--------------------+
| information_schema |
| mysql |
| performance_schema |
| zabbix |
+--------------------+
其中localhost是允许的IP,不设置的话可以改为‘%’
安装PHP:
安装软件源:rpm -ivh
卸载旧版本:yum erase php php-mysql php-gd php-imap php-ldap php-odbc php-pear php-xml php-xmlrpc php-mcrypt php-mbstring php-devel php-pecl-memcached php-pecl-memcache php-common php-pdo php-cli php-fpm libmemcached
安装PHP5.6:
yum install httpd php56w php56w-mysql php56w-gd php56w-imap php56w-ldap php56w-odbc php56w-pear php56w-xml php56w-xmlrpc php56w-mcrypt php56w-mbstring php56w-devel php56w-pecl-memcached php56w-common php56w-pdo php56w-cli php56w-pecl-memcache php56w-bcmath php56w-fpm
修改时区:
sed –i "s@# php_value date.timezone Europe/Riga@php_value date.timezone Asia/Shanghai@g" /etc/httpd/conf.d/zabbix.conf
升级CURL
git clone https://github.com/zabbixcn/curl-rpm
cd curl-rpm/RPMS
yum install curl-7.29.0-25.el6.x86_64.rpm libcurl-7.29.0-25.el6.x86_64.rpm libcurl-devel-7.29.0-25.el6.x86_64.rpm
未安装git请执行:yum install –y git
验证:
curl -V
curl 7.29.0 (x86_64-RedHat-linux-gnu) libcurl/7.29.0 NSS/3.16.1 Basic ECC zlib/1.2.3 libidn/1.18 libssh2/1.4.2
Protocols: dict file ftp ftps gopher http https imap imaps ldap ldaps pop3 pop3s rtsp scp sftp smtp smtps telnet tftp
Features: AsynchDNS GSS-Negotiate IDN IPv6 Largefile NTLM NTLM_WB SSL libz
安装zabbix-server:
yum localinstall zabbix-server-mysql-3.0.0-1.el6.x86_64.rpm
初始化Zabbix数据库
cd /usr/share/zabbix-server-mysql-3.0.0
zcat create.sql.gz | mysql -uzabbix -pzabbix zabbix
远程:zcat create.sql.gz | mysql -h 10.16.37.101 -P 3306 -uzabbix -pzabbix zabbix
配置数据库连接信息
vi /etc/zabbix/zabbix_server.conf
DBHost=localhost
DBName=zabbix
DBUser=zabbix
DBPassword=zabbix
启动zabbix-server:
/etc/init.d/zabbix-server restart
或者service zabbix-server start
如果一切正常,日志会如下:
配置Apache:
/etc/init.d/httpd start
访问zabbix web:
浏览器访问${IP}/zabbix,进行配置即可,此处不再详解!
默认用户名/密码:Admin/zabbix(区分大小写)
客户端安装:
直接rpm –ivh zabbix-agent-3.0.0-2.el6.x86 64.rpm
可能提示缺少lib,这时yum install –y unixODBC 之后执行上述命令
然后配置:
Vi /etc/zabbix/zabbix-agentd.cnf
修改这二个地方 然后启动:
把zabbix-agent加入开机启动项:
查看:
防火墙设置:
开放端口
保存
重启
安装过程中遇到的问题:
安装yum只能找到2.4版本 经过git clone解决
安装PHP5.6 显示没有libmysqlclient.so 忽略解决 --skip-broken
zcat create.sql.gz | mysql -uzabbix -pzabbix zabbix初始化zabbix数据库失败:
进入mysql数据库删了zabbix重新create解决
/etc/init.d/zabbix-server restart
tail -n 100 /var/log/zabbix/zabbix_server.log报错 permission denied
selinux 关闭 重启 解决
/etc/init.d/httpd start
80端口被占用 改为8080解决之后登录IP是nginx
gedit /etc/zabbix/zabbix_server.conf
ListenIP=192.168.255.129改了之后后面加8080端口解决
PHPtimezone出错:重启之后好了
一些Zabbix相关教程集合:
CentOS 7.2 安装部署 Zabbix 3.0.4 详解