centos7安装zabbix

Posted yinglai

tags:

篇首语:本文由小常识网(cha138.com)小编为大家整理,主要介绍了centos7安装zabbix相关的知识,希望对你有一定的参考价值。

 系统环境
centos7.x
nginx-1.12.2

nginx下载页面:http://nginx.org/en/download.html 官网下载页面
zabbix安装步骤
关闭selinux
临时关闭:setenforce 0
[root@localhost ~]# cat /etc/selinux/config 

# This file controls the state of SELinux on the system.
# SELINUX= can take one of these three values:
#     enforcing - SELinux security policy is enforced.
#     permissive - SELinux prints warnings instead of enforcing.
#     disabled - No SELinux policy is loaded.
SELINUX=disabled
# SELINUXTYPE= can take one of three values:
#     targeted - Targeted processes are protected,
#     minimum - Modification of targeted policy. Only selected processes are protected. 
#     mls - Multi Level Security protection.
SELINUXTYPE=targeted 

关闭防火墙

systemctl stop firewalld.service
systemctl disable firewalld.service

安装环境 LNMP

安装nginx
yum install pcre pcre-devel openssl openssl-devel gcc-c++
useradd -s /sbin/nologin -M nginx
tar -zxf nginx-1.12.2.tar.gz 
cd nginx-1.12.2
./configure --user=nginx --group=nginx --prefix=/application/nginx-1.10.1 --with-http_stub_status_module --with-http_ssl_module

make
make install
ln -s /application/nginx-1.10.1/ /application/nginx
/application/nginx/sbin/nginx #start nginx service

ps -ef|grep nginx
ss -lntup|grep nginx

[root@zabbix-server-1 conf]# pwd
/application/nginx/conf

egrep -v "#|^$" nginx.conf.default > nginx.conf
#修改部分配置
[root@zabbix-server-1 conf]# cat nginx.conf
worker_processes  1;
events {
worker_connections  1024;
}
http {
include       mime.types;
default_type  application/octet-stream;
sendfile        on;
keepalive_timeout  65;
server {
listen       80;
server_name  localhost;
location / {
root   html;
index  index.php index.html index.htm;
}
error_page   500 502 503 504  /50x.html;
location = /50x.html {
root   html;
}
location ~.(php|php5)?$ {
root /application/nginx/html;
fastcgi_pass 127.0.0.1:9000;
fastcgi_index index.php;
fastcgi_param SCRIPT_FILENAME /application/nginx/html$fastcgi_script_name;
include    fastcgi_params;
}
}
}

#杀死进程,重启服务
ps -ef|grep nginx
/application/nginx/sbin/nginx

安装mysql

yum install -y mariadb mariadb-server
Systemctl start mariadb
Systemctl enable mariadb

安装php环境

yum install -y php php-mysql

安装zabbix

下载包
rpm -ivh http://repo.zabbix.com/zabbix/3.4/rhel/7/x86_64/zabbix-release-3.4-2.el7.noarch.rpm

安装zabbix的包
yum install -y zabbix-server-mysql zabbix-get zabbix-web zabbix-web-mysql zabbix-agent zabbix-sender

创建一个zabbix库并设置为utf8的字符编码格式
create database zabbix character set utf8 collate utf8_bin;

创建账户并且授权设置密码
给来自loclhost的用户zabbxi分配可对数据库zabbix所有表进行所有操作的权限,并且设定密码为zabbix
grant all privileges on zabbix.* to zabbix@localhost identified by zabbix;


刷新
flush privileges;
 quit退出
导入表
cd /usr/share/doc/zabbix-server-mysql-3.2.10/

解压
gunzip create.sql.gz

对表进行导入
mysql
use zabbix;
source create.sql
配置zabbix server配置文件
配置文件目录
cd /etc/zabbix

对zabbix_server.conf进行配置
 DBHost = server ip
DBName=zabbix
DBUser=zabbix
DBPasswor=zabbix

运行zabbix-server服务

开机自启zabbix-server服务

systemctl start zabbix-server
systemctl enable zabbix-server

配置php

cd /etc/httpd/conf.d

vi zabbix.conf

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

    <IfModule mod_php5.c>
        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 max_input_vars 10000
        php_value always_populate_raw_post_data -1
        # php_value date.timezone Europe/Riga
        php_value date.timezone Asia/Shanghai  #修改时区
    </IfModule>
</Directory>
启动服务
systemctl restart httpd

 登陆zabbix

打开浏览器,输入以下链接

http://192.168.11.11/zabbix

 

技术图片

 

 

 

技术图片

 

 

 

技术图片

 

 

 

技术图片

 

 

 

技术图片

 

 

 

技术图片

 

 

 

技术图片

 

 

 

技术图片

 

 

 

技术图片

 

以上是关于centos7安装zabbix的主要内容,如果未能解决你的问题,请参考以下文章

Centos7安装Zabbix3.0

Centos7下安装及配置Zabbix3.0

Centos7系统安装Zabbix4.4(yum源安装)

CentOS7 Zabbix proxy 安装

CentOS7 Zabbix proxy 安装

centos7安装zabbix5.0