Centos7编译安装zabbix-4.0.1
架构组合:nginx1.9.10+php7.0.32+mysql5.7.22+zabbix4.0.1
nginx1.9.10
先装依赖
tar zxvf openssl-1.1.0f.tar.gz
cd openssl-1.1.0f
./config --prefix=/usr/local/lib/openssl-1.1.0f
make && make install
tar zxvf pcre-8.40.tar.gz
cd pcre-8.40
./configure --prefix=/usr/local/lib/pcre-8.40
make && make install
tar zxvf zlib-1.2.11.tar.gz
cd zlib-1.2.11
./configure --prefix=/usr/local/lib/zlib-1.2.11
make && make install
nginx-1.9.10
tar -zxvf nginx-1.9.10.tar.gz
cd nginx-1.9.10
编译
./configure --prefix=/usr/local/nginx-1.9.10/ --with-pcre=/usr/local/lib/pcre-8.40/ --with-openssl=/usr/local/lib/openssl-1.1.0f/ --with-zlib=/usr/local/lib/zlib-1.2.11/
安装
make && make install
php7.0.32
php使用yum方式安装
更新yum源
CentOS/RHEL 7:
rpm -Uvh https://dl.fedoraproject.org/pub/epel/epel-release-latest-7.noarch.rpm
rpm -Uvh https://mirror.webtatic.com/yum/el7/webtatic-release.rpm
url:https://centos.pkgs.org/7/webtatic-x86_64/webtatic-release-7-3.noarch.rpm.html
yum
yum install php70w-common php70w-fpm php70w-opcache php70w-gd php70w-mysqlnd php70w-mbstring php70w-pecl-redis php70w-pecl-memcached php70w-devel php70w-xml -y
验证
php -v
查看所有已安装的模块
php -m
配置文件详解
测试
mkdir -p /usr/local/zabbix-4.0.1/php
vim index.php
index.php
<?php
phpinfo();
?>
nginx+php配置
cd /usr/local/nginx-1.9.10/conf
vim zabbix.conf
zabbix.conf
server{
listen 9088;
server_name localhost;
access_log logs/zabbix.log;
error_log logs/error.log;
location / {
proxy_http_version 1.1;
root /usr/local/zabbix-4.0.1/php;
index index.html index.htm index.php;
}
location ~* \.php$ {
root /usr/local/zabbix-4.0.1/php;
fastcgi_pass 127.0.0.1:9000;
fastcgi_index index.php;
fastcgi_param SCRIPT_FILENAME /usr/local/zabbix-4.0.1/php$fastcgi_script_name;
include fastcgi_params;
}
}
在nginx.conf htpp选项中加入zabbix.conf
include zabbix.conf;
浏览器访问:ip+9088
mysql5.7.22
解压
tar -zxvf mysql-5.7.22-linux-glibc2.12-x86_64.tar.gz
新建data,logs目录用来存放数据和日志
cd /opt/mysql
mkdir data logs
my.cnf
[mysqld]
federated
datadir=/opt/mysql/data
socket=/tmp/mysql.sock
# Disabling symbolic-links is recommended to prevent assorted security risks
symbolic-links=0
# Settings user and group are ignored when systemd is used.
# If you need to run mysqld under a different user or group,
# customize your systemd unit file for mariadb according to the
# instructions in http://fedoraproject.org/wiki/Systemd
skip-grant-tables
server-id=148
log-bin=mysql-bin
lower_case_table_names=1
sql_mode = 'STRICT_TRANS_TABLES,NO_ZERO_IN_DATE,NO_ZERO_DATE,ERROR_FOR_DIVISION_BY_ZERO,NO_AUTO_CREATE_USER,NO_ENGINE_SUBSTITUTION'
[mysqld_safe]
log-error=/opt/mysql/logs/error.log
pid-file=/opt/mysql/mysql.pid
#
# include all files from the config directory
#
!includedir /etc/my.cnf.d
初始化
/opt/mysql/bin/mysqld --defaults-file=/etc/my.cnf --user=mysql --basedir=/opt/mysql --datadir=/opt/mysql/data --initialize
启动命令
/opt/mysql/bin/mysqld_safe --defaults-file=/etc/my.cnf &
登陆后重新设置root密码
修改授权远程zabbix密码
ALTER USER 'zabbix'@'%' IDENTIFIED BY 'zabbix'; 创建zabbix远程%用户
CREATE USER 'zabbix'@'%' IDENTIFIED WITH mysql_native_password BY 'zabbix'; 授权
GRANT ALL PRIVILEGES ON *.* TO 'zabbix'@'%'; 刷新
flush PRIVILEGES;
zabbix4.0.1
https://nchc.dl.sourceforge.net/project/zabbix/ZABBIX%20Latest%20Stable/4.0.1/zabbix-4.0.1.tar.gz
依赖
yum install libevent libevent-devel libaio gcc libxml* unixODBC-devel mysql-devel net-snmp-devel libxml2-devel libcurl-devel libevent-devel pcre* -y
ld.so.conf
vim /etc/ld.so.conf include ld.so.conf.d/*.conf
/opt/mysql/lib
编译
./configure --prefix=/usr/local/zabbix-4.0.1/ --enable-server --enable-agent --with-mysql=/opt/mysql/bin/mysql_config --with-net-snmp --with-libcurl --with-libxml2l
目录展示
[root@localhost etc]# cd /usr/local/zabbix-4.0.1/
[root@localhost zabbix-4.0.1]# cd sbin/
[root@localhost sbin]# ls
zabbix_agentd zabbix_server
[root@localhost sbin]# cd ../etc/
[root@localhost etc]# ls
zabbix_agentd.conf zabbix_agentd.conf.d zabbix_server.conf zabbix_server.conf.d
[root@localhost etc]#
php站点转移
cd /usr/local/zabbix/zabbix-4.0.1/frontends
cp -r php /usr/local/zabbix-4.0.1
重启nginx!
浏览器访问:ip+9088
前面还有配置图, 我当时没有截图,页面配置好进入登录界面,默认账号密码是admin/zabbix
下面就是配置添加主机分配监控之类的事了。
自家脚本一键操作
客户端启动
zagentstartall.sh
#/bin/bash
/usr/local/nginx-1.9.10/sbin/nginx
/usr/local/php/bin/php-fpm
/opt/mysql/start.sh
/usr/local/zabbix-4.0.1/sbin/zabbix_agentd
服务器启动
zserverstartall.sh
#/bin/bash
sudo -u chenglee /usr/local/nginx-1.9.10/sbin/nginx
/usr/local/php/bin/php-fpm
/opt/mysql/start.sh
/usr/local/zabbix-4.0.1/sbin/zabbix_serverl
效果
查看状态
status.sh
#/bin/bash
echo "***************************************"
echo "nginx status ..."
ps aux | grep nginx
echo "php status ..."
ps aux | grep php
echo "mysql status ..."
ps aux | grep mysql
echo "zabbix status ..."
ps aux | grep zabbix
echo "***************************************"l
效果
一键kill
stopall.sh
#/bin/bash
chengkill nginx
chengkill php
chengkill mysql
chengkill zabbix
效果
chengkill
#!/bin/sh
#pid kill thread for chenglee
#if fileformat=dos, update fileformat=unix
#code:set fileformat=unix
#check:set ff ?
if [ $# -lt 1 ]
then
echo "not procedure_name"
exit 1
fi PROCESS=`ps -ef|grep $1|grep -v grep|grep -v PPID|awk '{ print $2}'`
for i in $PROCESS
do
echo "Kill the $1 process [ $i ]"
kill -9 $i
done
把chengkill扔进/usr/bin
Centos7编译安装zabbix-4.0.1的更多相关文章
- Centos7下安装zabbix 3.0.19
参考网站: https://www.cnblogs.com/xiewenming/p/7732144.html https://www.cnblogs.com/clsn/p/7885990.html ...
- 编译安装zabbix 3.0及分开部署配置详解
实验系统:CentOS 6.6_x86_64 实验前提:提前准备好编译环境,防火墙和selinux都关闭 实验说明:本实验共有4台主机,IP及角色分配如拓扑 下载地址:试验中用到mariadb软件的下 ...
- CentOS7 编译安装 nginx-1.10.0
对于NGINX 支持epoll模型 epoll模型的优点 定义: epoll是Linux内核为处理大批句柄而作改进的poll,是Linux下多路复用IO接口select/poll的增强版本,它能显著的 ...
- centos7编译安装zabbix(附带编译安装lnmp)
先把防火墙和selinux关闭: sytemctl stop firewalld setenforce 0 1.yum安装依赖: yum -y install wget openssl* gcc gc ...
- centos7 编译安装nginx1.16.0( 完整版 )
一.安装依赖包 yum install -y gcc gcc-c++ pcre pcre-devel zlib zlib-devel openssl openssl-devel 依赖包说明: 1.编译 ...
- centos7编译安装zabbix的错误
[Z3001] connection to database 'zabbix' failed: [2002] Can't connect to local MySQL server through s ...
- CentOS7编译安装Nginx-1.8.1和编译参数
CentOS7编译安装Nginx-1.8.1和编译参数 Web服务器Nginx LNMP是一组众所周知的Web网站服务器架构环境,即由Linux+Nginx+MySQL+PHP(MySQL有时也 ...
- centos7编译安装MySQL5.7.9
title: centos7编译安装MySQL5.7.9 date: 2016-05-12 16:20:17 tags: --- Centos7编译安装mysql5.7.9 mysql5.7有更好的性 ...
- centos 6.9安装zabbix 3.0
Linux下常用的系统监控软件有Nagios.Cacti.Zabbix.Monit等,这些开源的软件,可以帮助我们更好的管理机器,在第一时间内发现,并警告系统维护人员. 今天开始研究下Zabbix,使 ...
- 一键安装 zabbix 3.0 版本 脚本
原文地址: http://blog.csdn.net/u012449196/article/details/53859068 本文修改了原文中的部分错误,此脚本适用于zabbix 2.0 或 3.0 ...
随机推荐
- 从零开始一起学习SLAM | SLAM有什么用?
SLAM是 Simultaneous Localization And Mapping的 英文首字母组合,一般翻译为:同时定位与建图.同时定位与地图构建. 「同时定位与地图构建」这几个词,乍一听起来非 ...
- 从零开始一起学习SLAM | 学习SLAM到底需要学什么?
SLAM涉及的知识面很广,我简单总结了 “SLAM知识树” 如下所示: (公众号菜单栏回复 “树” 可获得清晰版) 可以看到涉及的知识面还是比较广的.这里放出一张SLAM圈子里喜闻乐见的表达悲喜交加心 ...
- 用log4net记录日志信息
在.net中用log4net记录日志信息,已经是很平常的事情了. log4net下载:http://logging.apache.org/log4net/download_log4net.cgi 百度 ...
- UVA 11168 Airport(凸包)
Airport [题目链接]Airport [题目类型]凸包 &题解: 蓝书274页,要想到解析几何来降低复杂度,还用到点到直线的距离公式,之后向想到预处理x,y坐标之和,就可以O(1)查到距 ...
- Django配置xadmin后台模板之坑(一)
环境: Python3.6 + Django2.0 + xadmin2.0 一.安装 1.首先安装就会有一个坑,很多教程的安装是直接在虚拟环境下使用 pip install xadmin 或者 pip ...
- Oracle创建禁止DDL的触发器
create or replace trigger forbid_ddl before ddl on DATABASEbegin --if ora_dict_obj_owner = or ...
- jdbc连接oracle的几种格式
1. SID的方式.已经不推荐使用这种方式了. jdbc:oracle:thin:[<user>/<password>]@<host>[:<port>] ...
- report源码分析——report_handle和report_server和report_catcher
report_handle主要实现对message的action,severity,file的设置,然后将message传递给server: 主要的function有两个:initial和proces ...
- c++ 常用的数据结构
set // constructing sets #include <iostream> #include <set> void checkin(std::set<int ...
- sql server2000中使用convert来取得datetime数据类型样式(转)
日期数据格式的处理,两个示例: CONVERT(varchar(16), 时间一, 20) 结果:2007-02-01 08:02/*时间一般为getdate()函数或数据表里的字段*/ CONVER ...