博客
关于我
强烈建议你试试无所不能的chatGPT,快点击我
centos 7 安装zabbix-4.0
阅读量:6078 次
发布时间:2019-06-20

本文共 5879 字,大约阅读时间需要 19 分钟。

第一步:安装nginx

############安装Nginx###########

yum localinstall http://nginx.org/packages/centos/7/noarch/RPMS/nginx-release-centos-7-0.el7.ngx.noarch.rpm

yum install -y nginx

systemctl start nginx.service

systemctl enable nginx

关闭自带firewalld 防火墙服务

systemctl stop firewalld
禁止开机启动firewalld 服务
systemctl mask firewalld

setenforce 0

第二步:安装php

 

#########安装PHP###############

检查当前安装的PHP包

yum list installed | grep php

如果有安装的PHP包,先删除他们

yum remove php.x86_64 php-cli.x86_64 php-common.x86_64 php-gd.x86_64 php-ldap.x86_64 php-mbstring.x86_64 php-mcrypt.x86_64 php-mysql.x86_64 php-pdo.x86_64

安装PHP rpm

rpm -Uvh https://mirror.webtatic.com/yum/el7/epel-release.rpm

rpm -Uvh https://mirror.webtatic.com/yum/el7/webtatic-release.rpm

yum 安装PHP

yum install php70w.x86_64 php70w-cli.x86_64 php70w-common.x86_64 php70w-gd.x86_64 php70w-ldap.x86_64 php70w-mbstring.x86_64 php70w-mcrypt.x86_64 php70w-mysql.x86_64 php70w-pdo.x86_64

安装PHP FPM

yum install php70w-fpm

systemctl start php-fpm

php -v

systemctl enable php-fpm

 

第三步安装:zabbix

###########添加EPEL源########

rpm -ivh http://mirrors.ustc.edu.cn/fedora/epel/6/x86_64/epel-release-6-8.noarch.rpm

 

########安装zabbix###########

wget http://repo.zabbix.com/zabbix/3.5/rhel/7/x86_64/zabbix-release-3.5-1.el7.noarch.rpm

rpm -ivh zabbix-release-3.5-1.el7.noarch.rpm

yum search zabbix ###查看zabbix 安装包####

yum -y install zabbix-server-mysql zabbix-web-mysql zabbix-get

第四步:安装mysql

#######安装mysql数据库#########

wget http://repo.mysql.com/yum/mysql-5.7-community/el/7/x86_64/mysql57-community-release-el7-7.noarch.rpm

rpm -vhi mysql57-community-release-el7-7.noarch.rpm

yum install -y mysql-community-server

systemctl start mysqld

systemctl enable mysqld

vi /etc/my.cnf ###在最后一行添加 validate_password = off ######

systemctl restart mysqld

grep 'temporary password' /var/log/mysqld.log #####查看mysql默认生成的密码######

mysql_secure_installation #初始化数据库信息

######创建zabbix用户#########

mysql -uroot -p

root

mysql> create database zabbix character set utf8 collate utf8_bin;

mysql> grant all privileges on zabbix.* to 'zabbix'@'localhost' identified by 'zabbix';

mysql> flush privileges;

exit

######创建zabbix 数据库########

zcat /usr/share/doc/zabbix-server-mysql-4.0.0/create.sql.gz | mysql zabbix -uzabbix -pzabbix

#########修改zabbix配置文件#######

vi /etc/zabbix/zabbix_server.conf

 

########查看zabbix配置文件########

[root@localhost ~]# grep ^DB /etc/zabbix/zabbix_server.conf
DBHost=localhost 
DBName=zabbix 
DBUser=zabbix
DBPassword=zabbix

########################

#######修改配置文件php.ini 文件########

sed -i "s/max_execution_time = 30/max_execution_time = 300/" /etc/php.ini

sed -i 's/max_input_time = 60/max_input_time = 300/' /etc/php.ini

sed -i 's/post_max_size = 8M/post_max_size = 16M/' /etc/php.ini

sed -i 's/post_max_size = 8M/post_max_size = 16M/' /etc/php.ini
sed -i 's_;date.timezone =_date.timezone =Asia/Shanghai_' /etc/php.ini

systemctl restart php-fpm

第五步:整合nginx与php

server {

#listen 8080;
listen 80;
server_name zabbix.nuoya.ph;
root /usr/share/zabbix;
index index.html index.htm index.php;
include /etc/nginx/default.d/*.conf;
#rewrite ^(.*) https://$server_name$1 permanent;
# return 301 https://zabbix.aoyoujiasu88.com$request_uri;

location / {try_files $uri $uri/ /index.php?$query_string;

}
#监控PHP状态 
location ~ ^/(status|ping)$
{
include fastcgi_params;
fastcgi_pass 127.0.0.1:9000;
fastcgi_param SCRIPT_FILENAME $fastcgi_script_name;
}
#监控nginx 状态
location /ngx_status 
{
stub_status on;
access_log off;
}
location ~ \.php$ {
include fastcgi.conf;
#try_files $uri /index.php =404;
#fastcgi_split_path_info ^(.+\.php)(/.+)$;
fastcgi_pass 127.0.0.1:9000;
#fastcgi_index index.php;
fastcgi_param SCRIPT_FILENAME $document_root$fastcgi_script_name;
include fastcgi_params;
}
error_page 404 /404.html;
location = /40x.html {
}

error_page 500 502 503 504 /50x.html;

location = /50x.html {
}
}

# Settings for a TLS enabled server.

#
# server {
# listen 443;
#server_name zabbix.aoyoujiasu88.com ;
# root /usr/share/zabbix;
# ssl on;
# ssl_certificate /etc/nginx/conf.d/certificate.crt;
# ssl_certificate_key /etc/nginx/conf.d/private.key;
# ssl_session_cache shared:SSL:1m;
# ssl_session_timeout 10m;
# ssl_ciphers HIGH:!aNULL:!MD5;
# ssl_prefer_server_ciphers on;

# # Load configuration files for the default server block.

# include /etc/nginx/default.d/*.conf;

# error_page 404 /404.html;
# location = /40x.html {
# }

# error_page 500 502 503 504 /50x.html;

# location = /50x.html {
# }
# }

启动nginx 

systemctl start nginx

systemctl enable nginx

启动zabbix

systemctl start zabbix-server

systemctl enable zabbix-server

http://本机IP/zabbix

####用户名:Admin 密码:登入时候设置的密码######

 

zabbix中文显示优化

安装方法如下:

wget https://github.com/echohn/zabbix-zh_CN/archive/master.zip
unzip master.zip
rm /usr/share/zabbix/locale/zh_CN/LC_MESSAGES/frontend.mo
cp zabbix-zh_CN-master/frontend.mo /usr/share/zabbix/locale/zh_CN/LC_MESSAGES/frontend.mo
systemctl restart nginx
systemctl restart zabbix-server
把Windows系统中找到C:\Windows\Fonts中的楷体(常规)复制到windows桌面上
cd /usr/share/zabbix/fonts/
导入simkai.ttf(常规字体)
chmod 777 simkai.ttf
cp graphfont.ttf graphfont.ttf.bak
mv simkai.ttf graphfont.ttf

mv:是否覆盖"graphfont.ttf"? y

######centos 7 zabbix agnet 安装####

wget http://repo.zabbix.com/zabbix/3.5/rhel/7/x86_64/zabbix-release-3.5-1.el7.noarch.rpm

rpm -ivh zabbix-release-3.5-1.el7.noarch.rpm

yum -y install zabbix-agent

iptables -I INPUT -p tcp --dport 10050 -j ACCEPT
service iptables save

###配置/etc/zabbix/zabbix_agentd.conf 文件里面的Server 地址###

#Server= zabbix sever IP ###

##启动 zabbix agent ####

systemctl start zabbix-agent
systemctl enable zabbix-agent
#####centos 6 zabbix agnet 安装####
wget http://repo.zabbix.com/zabbix/3.5/rhel/6/x86_64/zabbix-agent-4.0.0-1.1alpha2.el6.x86_64.rpm

rpm -ivh zabbix-agent-4.0.0-1.1alpha2.el6.x86_64.rpm

###配置/etc/zabbix/zabbix_agentd.conf 文件里面的Server 地址### 

#Server= zabbix sever IP ###

##启动 zabbix agent ####

service zabbix-agent start

转载于:https://www.cnblogs.com/iantest/p/9618727.html

你可能感兴趣的文章
【转】【C#】在 Windows 窗体 DataGridView 单元格中承载控件
查看>>
【Based Android】让你的android应用使用可爱的iphone备忘录字体
查看>>
第二部分:开发简要指南-第三章 Hello,本地化
查看>>
好胜决定态度 态度决定成败
查看>>
主机访问虚拟机中linux上的web服务
查看>>
poj 3253:Fence Repair(堆排序应用)
查看>>
Entity Framework系列
查看>>
Android控件GridView之仿支付宝钱包首页带有分割线的GridView九宫格的完美实现
查看>>
如何制作一款HTML5 RPG游戏引擎——第一篇,地图类的实现
查看>>
Android 之使用LocalBroadcastManager解决BroadcastReceiver安全问题
查看>>
破解物联网落地困境-阿里云硬件接入最佳实践
查看>>
POJ 2503 字符串(两种方法)
查看>>
ArcGIS API for Flex 调用天地图、e都市瓦片地图
查看>>
【Yaml】Yaml学习笔记
查看>>
Mockito教程
查看>>
筛选并保留最后一次记录(如筛选最后一次缴纳电费的记录 )
查看>>
亚马逊开源 Neo-AI 框架,可优化 AI 模型提升部署速度
查看>>
新网盘时代,私有云斐讯天天链N1开启智能家居新生活!
查看>>
《西游伏妖篇》明星全阵容曝光 相约大年初一
查看>>
有一种手机能让你一见钟情,华为P20 Pro亮黑色图赏
查看>>