一二三部分为介绍,此处略过。转载请注明出处http://15074813712.blog.51cto.com/addblog.php
安装环境的准备
[root@localhost ~]# cat /etc/centos-release
CentOS Linux release 7.0.1406 (Core)
[root@localhost ~]# uname -r
3.10.0-123.el7.x86_64
[root@localhost bin]# systemctl status iptables
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
[root@localhost bin]# systemctl status firewalld
firewalld.service - firewalld - dynamic firewall daemon
Loaded: loaded (/usr/lib/systemd/system/firewalld.service; disabled)
Active: inactive (dead)
[root@localhost bin]# getenforce
Permissive
源码包准备:
源码安装mysql:
[root@localhost bin]# ./mysql --version
./mysql Ver 14.14 Distrib 5.6.16, for Linux (x86_64) using EditLine wrapper
yum安装http php:
[root@localhost bin]# apachectl -v
Server version: Apache/2.4.6 (CentOS)
Server built: Mar 12 2015 15:07:19
[root@localhost bin]# 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安装文档):
[root@localhost bin]# yum install gcc gcc-c++ curl-devel autoconf httpd httpd-manual mod_ssl mod_perl mod_auth_mysql
[root@localhost bin]# yum install php php-mysqlnd(php-mysql) php-gd php-xml php-mbstring php-ldap php-pear php-xmlrpc php-bcmath
[root@localhost bin]# yum install mysql-connector-odbc mysql-devel libdbi-dbd-mysql net-snmp-devel
php环境
[root@localhost bin]# 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
[root@localhost bin]# systemctl start httpd
[root@localhost bin]# systemctl enable httpd
[root@localhost bin]# /etc/init.d/mysql start
[root@localhost bin]# chkconfig mysql on
[root@localhost zabbix-2.0.3]# tar zxvf /root/7.17/zabbix-2.0.3.tar.gz
[root@localhost zabbix-2.0.3]# cd zabbix-2.0.3/
[root@localhost local]# ./configure --prefix=/usr/local/zabbix --enable-server --enable-proxy --enable-agent --with-mysql=/usr/bin/mysql_config --with-net-snmp --with-libcurl
[root@localhost local]# make
[root@localhost local]# make install
[root@localhost local]# vi /etc/services
zabbix-agent 10050/tcp # Zabbix Agent
zabbix-agent 10050/udp # Zabbix Agent
zabbix-trapper 10051/tcp # Zabbix Trapper
zabbix-trapper 10051/udp # Zabbix Trapper
[root@localhost local]# /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
[root@localhost zabbix]# cd /usr/local/zabbix-2.0.3/
[root@localhost 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.
[root@localhost zabbix-2.0.3]# /usr/local/mysql/bin/mysql -uzabbix -pzabbix zabbix < ./database/mysql/images.sql
Warning: Using a password on the command line interface can be insecure.
[root@localhost zabbix-2.0.3]# /usr/local/mysql/bin/mysql -uzabbix -pzabbix zabbix < ./database/mysql/data.sql
Warning: Using a password on the command line interface can be insecure.
[root@localhost zabbix-2.0.3]# ln -s /usr/local/zabbix/etc /etc/zabbix
[root@localhost zabbix-2.0.3]# mkdir /var/log/zabbix
[root@localhost zabbix-2.0.3]# chown zabbix.zabbix /var/log/zabbix/
[root@localhost zabbix-2.0.3]# ln -s /usr/local/zabbix/bin/* /usr/bin/
[root@localhost zabbix-2.0.3]# ln -s /usr/local/zabbix/sbin/* /usr/sbin/
[root@localhost zabbix-2.0.3]# vi /etc/init.d/zabbix_server
BASEDIR=/usr/local/zabbix
[root@localhost zabbix-2.0.3]# vi /etc/init.d/zabbix_agentd
BASEDIR=/usr/local/zabbix
[root@localhost zabbix-2.0.3]# vi /etc/zabbix/zabbix_server.conf
DBName=zabbix
DBUser=zabbix
DBPassword=zabbix
[root@localhost zabbix-2.0.3]# 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
[root@localhost zabbix-2.0.3]# cp -r frontends/php/ /var/www/html/zabbix
[root@localhost zabbix-2.0.3]# chown -R apache.apache /var/www/html/zabbix
[root@localhost zabbix-2.0.3]# chkconfig zabbix_server on
[root@localhost zabbix-2.0.3]# chkconfig zabbix_agentd on
[root@localhost zabbix-2.0.3]# /etc/init.d/zabbix_server start
Starting zabbix_server (via systemctl): [ OK ]
[root@localhost zabbix-2.0.3]# /etc/init.d/zabbix_agentd start
Starting zabbix_agentd (via systemctl): [ OK ]
在浏览器地址栏输入IP/zabbix
账号:admin 密码:zabbix
至此zabbix安装完成,详细配置与优化将于近期制作,敬请关注!谢谢!
本文出自 “centos7下zabbix安装” 博客,请务必保留此出处http://15074813712.blog.51cto.com/10530993/1675713
原文地址:http://15074813712.blog.51cto.com/10530993/1675713