rpm -ivh http://repo.webtatic.com/yum/el6/latest.rpm

安装jdk
rpm -ivh (自行在网上下载rpm包)

安装php并修改相应参数
yum -y install php56w php56w-gd php56w-mysqlnd php56w-bcmath php56w-mbstring php56w-xml php56w-ldap

vim /etc/php.ini
post_max_size = 16M
max_execution_time = 300
max_input_time = 300
date.timezone = Asia/Shanghai
always_populate_raw_post_data = -1


安装apache
yum -y install httpd

vim /etc/httpd/conf.d/zabbix.conf
<VirtualHost *:80>
    DocumentRoot /var/www/html/zabbix
#    ServerName www.weiyanxt.com
#    ServerAlias weiyanxt.com    
    ErrorLog /var/www/html/logs/error_log
    CustomLog /var/www/html/logs/access_log common
        DirectoryIndex index.html index.html.var index.php
</VirtualHost>


编译安装zabbix
groupadd zabbix
useradd -g zabbix zabbix

yum install -y gcc* libxml2-devel net-snmp* curl-devel unixODBC-devel libssh2-devel openldap openldap-devel OpenIPMI OpenIPMI-devel mysql-devel libevent-devel pcre*
 
cd /root/zabbix-3.4.15
chmod +x configure
./configure --enable-server --enable-agent --with-mysql --enable-ipv6 --enable-java --with-net-snmp --with-libcurl --with-libxml2 --with-unixodbc --with-ssh2 --with-openipmi --with-openssl --prefix=/usr/local/zabbix

make install


mkdir /var/www/html/zabbix
mkdir /var/www/html/logs
cp -r zabbix-3.4.15/frontends/php/* /var/www/html/zabbix

chown -R apache:apache /var/www/html/zabbix/
chmod +x /var/www/html/zabbix/conf/

设置zabbix  db账户
vim /usr/local/zabbix/etc/zabbix_server.conf
DBHost=localhost
DBName=zabbix
DBUser=zabbix
DBPassword=zabbix
#ListenIP=192.168.40.135

cp zabbix-3.4.15/misc/init.d/fedora/core/zabbix_server /etc/init.d/zabbix_server
cp zabbix-3.4.15/misc/init.d/fedora/core/zabbix_agentd /etc/init.d/zabbix_agentd

安装mysql
yum -y install mysql-server
service mysqld start
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> use zabbix;
mysql> source /root/zabbix-3.4.15/database/mysql/schema.sql;
mysql> source /root/zabbix-3.4.15/database/mysql/images.sql;
mysql> source /root/zabbix-3.4.15/database/mysql/data.sql;
mysql> quit


service httpd start
启动httpd遇到的报错
Starting httpd: httpd: Could not reliably determine the server's fully qualified domain name, using localhost.localdomain for ServerName

解决:在/etc/httpd/conf/httpd.conf 中添加
ServerName localhost:80

chmod +x zabbix*
/etc/init.d/zabbix_server start
启动报错
Starting zabbix_server:  /etc/init.d/functions: line 722: /usr/local/sbin/zabbix_server: No such file or directory

解决:编辑 /etc/init.d/zabbix_server  修改BASEDIR路径为 /usr/local/zabbix

chkconfig httpd on
chkconfig mysqld on
chkconfig --add /etc/init.d/zabbix_server
chkconfig zabbix_server on

打开ip网页 进行zabbix安装

12-19 09:09