官方文档
https://www.zabbix.com/documentation/3.4/zh/manual/installation/requirements
http://www.52wiki.cn/docs/zabbix/zabbix-1albesfpt7t53
简介:
特点:
zabbix安装:
安装zabbix 需要LNMP(Linux + Nginx + Mysql +PHP)环境
1)linux 安装略: 使用Redhat7.4
2)nginx 安装
依赖:
yum install pcre openssl
安装方式1:
yum install -y nginx
配置文件默认在/etc/nginx/nginx.conf
启动nginx: service nginx start
安装方式2:
wget http://nginx.org/download/nginx-1.6.2.tar.gz
tar zxvf nginx-1.6.2.tar.gz
cd nginx-1.6.2
./configure --prefix=/usr/local/nginx
make && make install
启动nginx: /usr/local/nginx/sbin/nginx
3)安装mysql
wget -i -c http://dev.mysql.com/get/mysql57-community-release-el7-10.noarch.rpm
yum -y install mysql57-community-release-el7-10.noarch.rpmyum -y install mysql-community-serversystemctl start mysqld.servicesystemctl status mysqld.servicegrep pass /var/log/mysqld.logalter user 'root'@'localhost' identified by '123qweASD!';
4)安装PHP
依赖包安装:
yum install php-mbstring php-bcmath
链接:https://pan.baidu.com/s/16DlyLJWVzZfVRjrkffLA9g
提取码:uc3b版本下载:php-5.6.39
./configure
--prefix=/usr/local/php-5.5.0 --with-config-file-path=/usr/local/php-5.5.0/etc--with-bz2 --with-curl --enable-ftp --enable-sockets --disable-ipv6 --with-gd --with-jpeg-dir=/usr/local --with-png-dir=/usr/local --with-freetype-dir=/usr/local --enable-gd-native-ttf --with-iconv-dir=/usr/local --enable-mbstring --enable-calendar --with-gettext --with-libxml-dir=/usr/local --with-zlib --with-pdo-mysql=mysqlnd --with-mysqli=mysqlnd --with-mysql=mysqlnd --enable-dom --enable-xml --enable-fpm--enable-bcmath
--with-libdir=lib64make && make install
#配置PHP
cp php.ini-production /usr/local/php-5.5.0/etc/php.ini
修改内容如下:
post_max_size=16M
max_execution_time=300
always_populate_raw_post_data = -1
date.timezone = Asia/Shanghai
mv /usr/local/php-5.5.0/etc/php-fpm.conf.default /usr/local/php-5.5.0/etc/php-fpm.conf
#启动php-fpm
/usr/local/php-5.5.0/sbin/php-fpm
#检查端口是否启动
netstat -lnt | grep 9000
zabbix安装:
#####mysql-devel libevent-devel 需要安装
https://www.zabbix.com/download_sources 下载
tar zxvf zabbix-4.0.3.tar.gz
cd zabbix-4.0.3
./configure --prefix=/usr/local/zabbix/ --enable-server --enable-agent --with-mysql --with-net-snmp --with-libcurl --with-libxml2
make && make install
####创建用户&组
groupadd zabbix
useradd -g zabbix zabbix
######数据库初始化
mysql -u root -p
mysql> create database zabbix default charset utf8;
mysql>quit
cd /opt/software/zabbix/database/mysql ===> /opt/software/zabbix/是我的解压目录
mysql -u root -p123qweASD! zabbix < schema.sql
mysql -u root -p123qweASD! zabbix < images.sql
mysql -u root -p123qweASD! zabbix < data.sql
#zabbix配置
mkdir /etc/zabbix
cp conf/zabbix_server.conf /etc/zabbix/ ===>当前目录都在/opt/software/下
vim /etc/zabbix/zabbix_server.conf vim /usr/local/zabbix/etc/zabbix_server.conf ===>修改登陆MySQL用户名和密码
内容如下:
LogFile=/tmp/zabbix_server.log
DBName=zabbixDBUser=root =====》MySQL用户名DBPassword=123qweASD! ====》MySQL密码DBPort=3306 ===》MySQL端口Timeout=4LogSlowQueries=3000
启动zabbix server
/usr/local/zabbix/sbin/zabbix_server
zabbix客户端安装
tar zxvf zabbix_agent-4.0.0-centos7-i386.tar.gz
cd zabbix_agent-4.0.0-centos7-i386
cp conf/zabbix_agentd.conf /usr/local/zabbix/etc/
vim /usr/local/zabbix/etc/zabbix_agentd.conf
内容如下:
LogFile=/tmp/zabbix_agentd.log
Server=127.0.0.1ServerActive=127.0.0.1Hostname=Zabbix server
#zabbix 客户端启动
/usr/local/zabbix/sbin/zabbix_agentd
修改服务端的网络配置文件
cd /opt/software/zabbix/
cp -rp frontends/php/* /usr/local/nginx/html/
vim 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; # access_log logs/host.access.log main; index index.html index.php index.html; location / { try_files $uri $uri/ /index.php?$args; } error_page 500 502 503 504 /50x.html; location ~ ^(.+.php)(.*)$ { fastcgi_split_path_info ^(.+.php)(.*)$; include fastcgi.conf; fastcgi_pass 127.0.0.1:9000; fastcgi_index index.php; fastcgi_param PATH_INFO $fastcgi_path_info; } }}
############登陆
http://10.2.177.35/php/setup.php
#开始在线配置zabbix
连接数据库报:error connecting to database:No such file or directory
解决:ln -s /var/lib/mysql/mysql.sock /tmp
默认即可,直接下一步