sdhgf 发表于 2015-7-20 10:02:26

centos7下zabbix2.0安装

                安装环境的准备
4系统环境# cat /etc/centos-release
CentOS Linux release 7.0.1406 (Core)

# uname -r
3.10.0-123.el7.x86_64

5关闭防火墙与selinux# systemctlstatusiptables
iptables.service - IPv4 firewall with iptables
   Loaded: loaded (/usr/lib/systemd/system/iptables.service; enabled)
   Active: inactive (dead) since Fri 2015-07-17 10:58:54 EDT; 16s ago

# systemctlstatusfirewalld
firewalld.service - firewalld - dynamic firewall daemon
   Loaded: loaded (/usr/lib/systemd/system/firewalld.service; disabled)
   Active: inactive (dead)

# getenforce
Permissive
6程序运行环境源码包准备:

源码安装mysql:
# ./mysql --version
./mysqlVer 14.14 Distrib 5.6.16, for Linux (x86_64) usingEditLine wrapper

yum安装http php:
# apachectl-v
Server version: Apache/2.4.6 (CentOS)
Server built:   Mar 12 2015 15:07:19
# php -v
PHP 5.4.16 (cli) (built: Jun 23 2015 21:17:27)
Copyright (c) 1997-2013 The PHP Group
Zend Engine v2.4.0, Copyright (c) 1998-2013 Zend Technologies
http php mysql相关组件安装方法(安装php之前需要安装epel,参考phpMyAdmin安装文档):
# yum install gcc gcc-c++ curl-devel autoconf httpd httpd-manual mod_ssl mod_perl mod_auth_mysql
# yum install phpphp-mysqlnd(php-mysql)php-gd php-xmlphp-mbstring php-ldap php-pear php-xmlrpc php-bcmath
# yum installmysql-connector-odbc mysql-devel libdbi-dbd-mysql net-snmp-devel

7相关环境的配置php环境
# vi /etc/php.ini
date.timezone = Asia/Shanghai
max_execution_time = 300
post_max_size = 32M
max_input_time = 300
memory_limit = 128M
mbstring.func_overload = 2

8http mysql开启# systemctl start httpd
# systemctl enable httpd
# /etc/init.d/mysql start
# chkconfigmysql on
Zabbix源码安装与配置9安装# tar zxvf /root/7.17/zabbix-2.0.3.tar.gz
# cd zabbix-2.0.3/
# ./configure--prefix=/usr/local/zabbix --enable-server --enable-proxy --enable-agent --with-mysql=/usr/bin/mysql_config --with-net-snmp --with-libcurl
# make
# make install
10添加zabbix到系统服务文件# vi /etc/services
zabbix-agent    10050/tcp               # Zabbix Agent
zabbix-agent    10050/udp               # Zabbix Agent
zabbix-trapper10051/tcp               # Zabbix Trapper
zabbix-trapper10051/udp               # Zabbix Trapper

11导入zabbix数据库# /usr/local/mysql/bin/mysql -uroot -p
Enter password:
mysql> create database zabbix character set utf8;
Query OK, 1 row affected (0.00 sec)
mysql> grant all privileges on zabbix.* to "zabbix"@"localhost" identified by"zabbix";
Query OK, 0 rows affected (0.02 sec)
mysql> flush privileges;
Query OK, 0 rows affected (0.00 sec)
mysql> exit
Bye

# cd /usr/local/zabbix-2.0.3/
# /usr/local/mysql/bin/mysql -uzabbix -pzabbix zabbix < ./database/mysql/schema.sql
Warning: Using a password on the command line interface can be insecure.
# /usr/local/mysql/bin/mysql -uzabbix -pzabbix zabbix < ./database/mysql/images.sql
Warning: Using a password on the command line interface can be insecure.
# /usr/local/mysql/bin/mysql -uzabbix -pzabbix zabbix < ./database/mysql/data.sql
Warning: Using a password on the command line interface can be insecure.

12创建zabbix配置文件与执行文件软链接# ln -s /usr/local/zabbix/etc   /etc/zabbix
# mkdir /var/log/zabbix
# chown zabbix.zabbix /var/log/zabbix/
# ln -s /usr/local/zabbix/bin/*   /usr/bin/
# ln -s /usr/local/zabbix/sbin/*   /usr/sbin/

# vi /etc/init.d/zabbix_server   
BASEDIR=/usr/local/zabbix
# vi /etc/init.d/zabbix_agentd
BASEDIR=/usr/local/zabbix

13修改zabbix_server.conf文件# vi /etc/zabbix/zabbix_server.conf
DBName=zabbix
DBUser=zabbix
DBPassword=zabbix

14配置被监测主机文件(由于zabbix-server也属于被监控范围,故修改此文件)# vi /etc/zabbix/zabbix_agentd.conf
Server=127.0.0.1   #被动模式连接的zabbix-server
ServerActive=127.0.0.1:20051#主动模式连接的zabbix-server及端口号
LogFile=/tmp/zabbix_agentd.log
UnsafeUserParameters=1 #启用自定义脚本功能,自定义key时需开启,加上自定义配置文件时,在该变量后追加:
Include=/etc/zabbix/filename.conf

15复制页面文件# cp -r frontends/php/ /var/www/html/zabbix
# chown -R apache.apache/var/www/html/zabbix

16开启服务# chkconfigzabbix_server on
# chkconfigzabbix_agentdon
# /etc/init.d/zabbix_serverstart
Starting zabbix_server (via systemctl):                  
# /etc/init.d/zabbix_agentdstart
Starting zabbix_agentd (via systemctl):                  



web界面下配置zabbix17登陆在浏览器地址栏输入IP/zabbix


18账号登陆账号:admin 密码:zabbix

至此zabbix安装完成,详细配置与优化将于近期制作,敬请关注!谢谢!

页: [1]
查看完整版本: centos7下zabbix2.0安装