centos 7 安装zabbix2.4

1 Installing repository configuration package

Install the repository configuration package. This package contains yum configuration files.

-- 查看centos 版本
cat /etc/redhat-release 
rpm -q centos-release

-- Zabbix 2.4 for RHEL7, Oracle Linux 7, CentOS 7:
sudo rpm -ivh http://repo.zabbix.com/zabbix/2.4/rhel/7/x86_64/zabbix-release-2.4-1.el7.noarch.rpm

2 Installing Zabbix packages

Install Zabbix packages. Example for Zabbix server and web frontend with mysql database.

Zabbix official repository provides fping, iksemel, libssh2 packages as well. These packages are located in the non-supported directory.

sudo yum install zabbix-server-mysql zabbix-web-mysql
sudo yum install zabbix-agent
3 Creating initial database
ls /usr/share/doc/zabbix-server-mysql-2.4.8/create/
此目录下有三个数据库脚步文件:schema.sql, images.sql and data.sql

** 注意 :For a Zabbix proxy database, only schema.sql should be imported (no images.sql nor data.sql)

shell> mysql -uroot -p<password>
mysql> create database zabbix character set utf8 collate utf8_bin;
mysql> grant all privileges on zabbix.* to zabbix@localhost identified by '<password>';
mysql> quit;
shell> mysql -uzabbix -p<password> zabbix < database/mysql/schema.sql

=>mysql -u zabbix -p zabbix < /usr/share/doc/zabbix-server-mysql-2.4.8/create/schema.sql 
( shell 提示 Enter password: )


** 注意 :stop here if you are creating database for Zabbix proxy
shell> mysql -uzabbix -p<password> zabbix < database/mysql/images.sql
shell> mysql -uzabbix -p<password> zabbix < database/mysql/data.sql
3 Starting Zabbix server process

Edit database configuration in zabbix_server.conf

sudo vi /etc/zabbix/zabbix_server.conf

DBHost=localhost
DBName=zabbix
DBUser=zabbix
DBPassword=zabbix

Start Zabbix server process:
sudo service zabbix-server start
或者sudo systemctl start zabbix-server.service
查看服务状态 systemctl status  zabbix-server
4 Editing PHP configuration for Zabbix frontend

Apache configuration file for Zabbix frontend is located in /etc/httpd/conf.d/zabbix.conf.

php_value max_execution_time 300
php_value memory_limit 128M
php_value post_max_size 16M
php_value upload_max_filesize 2M
php_value max_input_time 300
#php_value date.timezone Europe/Riga -- 去掉注释,本地化为PRC 

按照官网配置以上内容,启动zabbix服务,即搭建完成zabbix(zabbix站点);在浏览器访问http://zabbix-serser-hostname(ip)/zabbix

问题汇总

1、参考手册完成安装后,在浏览器访问http://zabbix-serser-hostname(ip)/zabbix ,出现 “Forbidden ->You don't have permission to access /zabbix/ on this server.”;访问http://zabbix-serser-hostname(ip)/zabbix/index.php时,页面显示php源码。
分析:apache 无法解析php网页
解决方案:sudo vi /etc/httpd/conf.d/zabbix.conf
添加如下配置
<IfModule mod_php5.c>
# If php is turned on, we respect .php and .phps files.
AddType application/x-httpd-php .php
AddType application/x-httpd-php-source .phps

# Since most users will want index.php to work we
# also automatically enable index.php
<IfModule mod_dir.c>
    DirectoryIndex index.html index.php
</IfModule>
</IfModule>
重启apache

** 2、/etc/httpd/conf.d/zabbix.conf 文件**
Alias /zabbix /usr/share/zabbix (zabbix php 文件目录)

<Directory "/usr/share/zabbix">
Options FollowSymLinks
AllowOverride None
Require all granted

<IfModule mod_php5.c>
    # If php is turned on, we respect .php and .phps files.

    AddType application/x-httpd-php .php
    AddType application/x-httpd-php-source .phps
    php_value max_execution_time 300
    php_value memory_limit 128M
    php_value post_max_size 16M
    php_value upload_max_filesize 2M
    php_value max_input_time 300
    php_value date.timezone PRC

    # <IfModule mod_dir.c>
    # DirectoryIndex index.html index.php
    # </IfModule>
</IfModule>
</Directory>

<Directory "/usr/share/zabbix/conf">
Require all denied
</Directory>

<Directory "/usr/share/zabbix/include">
Require all denied
</Directory>

相关截图

centos 7 安装zabbix2.4

centos 7 安装zabbix2.4

centos 7 安装zabbix2.4

centos 7 安装zabbix2.4

上一篇:autocommit和start transaction


下一篇:Python学习(28)--tkinter图形界面编程1