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 

關閉防火牆php

systemctl stop firewalld.service
systemctl disable firewalld.service

安裝環境 LNMPhtml

安裝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

安裝mysqlmysql

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

安裝php環境linux

yum install -y php php-mysql

安裝zabbixnginx

下載包
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

配置phpc++

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

 登錄zabbixweb

打開瀏覽器,輸入如下連接sql

http://192.168.11.11/zabbix數據庫

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

相關文章
相關標籤/搜索