centos 7 安装zabbix2.4-阿里云开发者社区

开发者社区> 数据库> 正文
登录阅读全文

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>

相关截图

Installing repository configuration package

Installing Zabbix packages

dbscript

start zabbix server

版权声明:本文内容由阿里云实名注册用户自发贡献,版权归原作者所有,阿里云开发者社区不拥有其著作权,亦不承担相应法律责任。具体规则请查看《阿里云开发者社区用户服务协议》和《阿里云开发者社区知识产权保护指引》。如果您发现本社区中有涉嫌抄袭的内容,填写侵权投诉表单进行举报,一经查实,本社区将立刻删除涉嫌侵权内容。

分享:
数据库
使用钉钉扫一扫加入圈子
+ 订阅

分享数据库前沿,解构实战干货,推动数据库技术变革

其他文章