Zabbix 是一个高度集成的网络监控解决方案,可以提供企业级的开源分布式监控解决方案,由一个国外的团队持续维护更新,软件可以自由下载使用,运作团队靠提供收费的技术支持赢利。 CentOS Linux release 7.5.1804 (Core) [root@bogon ~]# yum install net-snmp-devel libevent-devel -y [root@bogon data]# mysql -uroot -p mysql> set global validate_password_policy=0; mysql> show variables like “%validate%”; [root@bogon mysql]# find / -name zabbix_server.conf [root@bogon data]# vim /etc/ld.so.conf [Service] [Install] [root@bogon zabbix-5.0.1]# systemctl daemon-reload [root@bogon data]# wget https://nginx.org/download/nginx-1.9.9.tar.gz [root@bogon zabbix-5.0.1]# find / -name php.ini Deion=nginx – high performance web server Documentation=https://nginx.org/en/docs/ After=network-online.target remote-fs.target nss-lookup.target Wants=network-online.target [Service] Type=forking PIDFile=/usr/local/nginx/logs/nginx.pid ExecStart=/usr/local/nginx/sbin/nginx -c /usr/local/nginx/conf/nginx.conf ExecReload=/bin/kill -s HUP $MAINPID ExecStop=/bin/kill -s TERM $MAINPID [Install] WantedBy=multi-user.target 验证nginx配置文件语法错误Zabbix详细安装部署(最全)
Zabbix详细安装部署
环境准备
下载地址 https://mirrors.sohu.com/centos/7.5.1804/isos/x86_64/CentOS-7-x86_64-DVD-1804.iso
Zabbix5.0源码包
下载地址 https://cdn.zabbix.com/zabbix/sources/stable/5.0/zabbix-5.0.1.tar.gz安装依赖组件
创建zabbix用户组和用户
[root@bogon ~]# groupadd zabbix
[root@bogon ~]# useradd -r -g zabbix zabbix
安装zabbix服务
[root@bogon ~]# cd /usr/local/src/
[root@bogon src]# wget https://cdn.zabbix.com/zabbix/sources/stable/5.0/zabbix-5.0.1.tar.gz
或者通过上传的方式上传文件
[root@bogon src]# mkdir /usr/local/data/
[root@bogon src]# tar -xzf zabbix-5.0.1.tar.gz -C /usr/local/data/
[root@bogon src]# cd /usr/local/data/zabbix-5.0.1/[root@bogon zabbix-5.0.1]# ./configure --prefix=/usr/local/data/zabbix --enable-server --enable-agent --with-mysql=/usr/local/data/mysql/bin/mysql_config --with-net-snmp --with-libcurl --with-libxml2 此处报错: checking for mysql_config... /usr/local/data/mysql/bin/mysql_config configure: error: MySQL library not found 解决办法: 互联网状态下 Centos7.5安装MySQL57 [root@bogon zabbix-5.0.1]# cd .. [root@bogon data]# wget https://repo.mysql.com/mysql57-community-release-el7-10.noarch.rpm [root@bogon data]# ls mysql57-community-release-el7-10.noarch.rpm zabbix-5.0.1 [root@bogon data]# rpm -Uvh mysql57-community-release-el7-10.noarch.rpm [root@bogon data]# yum install -y mysql-community-server 非互联网状态下 安装MySql57 必要以下几个包安装就可以了 mysql-community-client-5.7.30-1.el7.x86_64 mysql-community-libs-compat-5.7.30-1.el7.x86_64 mysql57-community-release-el7-10.noarch mysql-community-server-5.7.30-1.el7.x86_64 mysql-community-common-5.7.30-1.el7.x86_64 mysql-community-libs-5.7.30-1.el7.x86_64 启动MySQL服务 [root@bogon data]# systemctl start mysqld.service 查看MySQL状态 [root@bogon data]# systemctl status mysqld.service 获取MySQL临时用户名密码 [root@bogon data]# grep 'temporary password' /var/log/mysqld.log A temporary password is generated for root@localhost: nc(9k0u;Fzff 输入MySQL的临时密码 [root@bogon data]# mysql -uroot -p Enter password: Welcome to the MySQL monitor. Commands end with ; or g. Your MySQL connection id is 2 Server version: 5.7.30 因为MySQL的密码规则需要很复杂,我们一般自己设置的不会设置成这样,所以我们全局修改一下 mysql> set global validate_password_policy=0; Query OK, 0 rows affected (0.00 sec) mysql> set global validate_password_length=1; Query OK, 0 rows affected (0.00 sec) 设置自己想要的密码 mysql> ALTER USER 'root'@'localhost' IDENTIFIED BY '123456'; Query OK, 0 rows affected (0.00 sec) 授权其他机器远程登录 mysql> GRANT ALL PRIVILEGES ON *.* TO 'root'@'%' IDENTIFIED BY '123456' WITH GRANT OPTION; Query OK, 0 rows affected, 1 warning (0.00 sec) mysql> FLUSH PRIVILEGES; Query OK, 0 rows affected (0.01 sec) mysql> exit Bye 开启开机自启动 [root@bogon data]# systemctl enable mysqld [root@bogon data]# systemctl daemon-reload 设置MySQL的字符集为UTF-8,令其支持中文 [root@bogon data]# vim /etc/my.cnf 改成如下,然后保存 # For advice on how to change settings please see # https://dev.mysql.com/doc/refman/5.7/en/server-configuration-defaults.html [mysql] default-character-set=utf8 [mysqld] datadir=/var/lib/mysql socket=/var/lib/mysql/mysql.sock default-storage-engine=INNODB character_set_server=utf8 symbolic-links=0 log-error=/var/log/mysqld.log pid-file=/var/run/mysqld/mysqld.pid 重启一下MySQL,令配置生效 [root@bogon data]# systemctl restart mysqld 永久关闭selinux和防火墙 [root@bogon data]# vi /etc/selinux/config 将SELINUX=enforcing改为SELINUX=disabled 设置后需要重启才能生效 [root@bogon data]# systemctl stop firewalld.service [root@bogon data]# systemctl disable firewalld.service 再次执行部署zabbix服务 [root@bogon zabbix-5.0.1]# ./configure --prefix=/usr/local/data/zabbix --enable-server --enable-agent --with-mysql --with-net-snmp --with-libcurl --with-libxml2 Package libxml-2.0 was not found in the pkg-config search path. Perhaps you should add the directory containing `libxml-2.0.pc' to the PKG_CONFIG_PATH environment variable No package 'libxml-2.0' found Package libxml-2.0 was not found in the pkg-config search path. Perhaps you should add the directory containing `libxml-2.0.pc' to the PKG_CONFIG_PATH environment variable No package 'libxml-2.0' found checking for xmlReadMemory in -lxml2... no configure: error: Not found libxml2 library 解决办法: 互联网状态下 [root@bogon zabbix-5.0.1]# yum install libxml2 libxml2-devel -y 非互联网状态下 安装以下包 libxml2-python-2.9.1-6.el7.4.x86_64 libxml2-devel-2.9.1-6.el7.4.x86_64 libxml2-2.9.1-6.el7.4.x86_64 再次执行部署zabbix服务 [root@bogon zabbix-5.0.1]# ./configure --prefix=/usr/local/data/zabbix --enable-server --enable-agent --with-mysql --with-net-snmp --with-libcurl --with-libxml2 configure: error: Curl library not found 解决办法: 互联网状态下 [root@bogon zabbix-5.0.1]# yum install curl-devel 非互联网状态下 安装以下包 libcurl-7.29.0-57.el7.x86_64 libcurl-devel-7.29.0-57.el7.x86_64 python-pycurl-7.19.0-19.el7.x86_64 curl-7.29.0-57.el7.x86_64 再次执行部署zabbix服务 [root@bogon zabbix-5.0.1]# ./configure --prefix=/usr/local/data/zabbix --enable-server --enable-agent --with-mysql --with-net-snmp --with-libcurl --with-libxml2 [root@bogon zabbix-5.0.1]# make [root@bogon zabbix-5.0.1]# make install [root@bogon data]# vim /etc/profile 添加以下内容 # Zabbix Environment export PATH=$PATH:/usr/local/data/zabbix/sbin/:/usr/local/data/zabbix/bin/ [root@localhost zabbix-4.2.6]# source /etc/profile
创建用户导入数据库
mysql> create database zabbix character set utf8 collate utf8_bin;
Query OK, 1 row affected (0.00 sec)
mysql> grant all privileges on zabbix.* to zabbix@‘localhost’ identified by ‘123456’;
ERROR 1819 (HY000): Your password does not satisfy the current policy requirements
解决办法:
mysql> show variables like “%validate%”;
±————————————-±——-+
| Variable_name | Value |
±————————————-±——-+
| query_cache_wlock_invalidate | OFF |
| validate_password_check_user_name | OFF |
| validate_password_dictionary_file | |
| validate_password_length | 8 |
| validate_password_mixed_case_count | 1 |
| validate_password_number_count | 1 |
| validate_password_policy | MEDIUM |
| validate_password_special_char_count | 1 |
±————————————-±——-+
8 rows in set (0.00 sec)
mysql> set global validate_password_length=6;
Query OK, 0 rows affected (0.00 sec)
Query OK, 0 rows affected (0.00 sec)
±————————————-±——+
| Variable_name | Value |
±————————————-±——+
| query_cache_wlock_invalidate | OFF |
| validate_password_check_user_name | OFF |
| validate_password_dictionary_file | |
| validate_password_length | 6 |
| validate_password_mixed_case_count | 1 |
| validate_password_number_count | 1 |
| validate_password_policy | LOW |
| validate_password_special_char_count | 1 |
±————————————-±——+
8 rows in set (0.00 sec)
mysql> grant all privileges on zabbix.* to zabbix@‘localhost’ identified by ‘123456’;
Query OK, 0 rows affected, 1 warning (0.01 sec)
mysql> flush privileges;
Query OK, 0 rows affected (0.00 sec)
mysql> set names utf8;
Query OK, 0 rows affected (0.00 sec)
mysql> use zabbix;
Database changed
mysql> source /usr/local/data/zabbix-5.0.1/database/mysql/schema.sql
mysql> source /usr/local/data/zabbix-5.0.1/database/mysql/data.sql
mysql> source /usr/local/data/zabbix-5.0.1/database/mysql/images.sql编辑zabbix_server的配置文件
/usr/local/data/zabbix-5.0.1/conf/zabbix_server.conf
/usr/local/data/zabbix/etc/zabbix_server.conf
[root@bogon mysql]# vim /usr/local/data/zabbix/etc/zabbix_server.conf
###Option: LogFile
LogFile=/usr/local/data/zabbix/logs/zabbix_server.log
###Option: LogFileSize
LogFileSize=0
###Option: DBHost
DBHost=localhost
###Option: DBName
DBName=zabbix
###Option: DBUser
DBUser=zabbix
###Option: DBPassword
DBPassword=lixiaozhe
###Option: DBSocket
DBSocket=/tmp/mysql.sock
###Option: DBPort
DBPort=3306
###Option: Timeout
Timeout=30
###Option: AlertScriptsPath
AlertScriptsPath=/usr/local/data/zabbix/alertscripts
###Option: ExternalScripts
ExternalScripts=/usr/local/data/zabbix/externalscripts
###Option: LogSlowQueries
LogSlowQueries=3000
授权建立相关文件夹
[root@bogon mysql]# mkdir /usr/local/data/zabbix/logs
[root@bogon mysql]# mkdir /usr/local/data/zabbix/pid
[root@bogon mysql]# chown -R zabbix:zabbix /usr/local/data/zabbix/
安装PHP73
互联网状态下
首先安装 EPEL 源
yum install epel-release
安装 REMI 源
yum install https://rpms.remirepo.net/enterprise/remi-release-7.rpm
安装 Yum 源管理工具:
yum install yum-utils
非互联网状态下
安装remi-release-7.rpm
安装 PHP7.3:
yum install -y php73-php-fpm php73-php-cli php73-php-bcmath php73-php-gd php73-php-json php73-php-mbstring php73-php-mcrypt php73-php-mysqlnd php73-php-opcache php73-php-pdo php73-php-pecl-crypto php73-php-pecl-mcrypt php73-php-pecl-geoip php73-php-recode php73-php-snmp php73-php-soap php73-php-xmll
设置开机自启
systemctl enable php73-php-fpm
启动PHP服务
systemctl start php73-php-fpm
/usr/local/lib /添加此路径/
[root@bogon data]# ldconfig
启动zabbix
[root@bogon data]# zabbix_server
杀死进程
[root@bogon data]# ps -ef | grep zabbix_server | grep -v grep | awk ‘{print $2}’ | xargs kill -9
创建服务文件
[root@bogon data]# vim /usr/lib/systemd/system/zabbix-server.service
[Unit]
Description=Zabbix
After=network.target
Environment=“CONFFILE=/usr/local/data/zabbix/etc/zabbix_server.conf”
Type=forking
Restart=on-failure
PIDFile=/tmp/zabbix_server.pid
KillMode=control-group
ExecStart=/usr/local/data/zabbix/sbin/zabbix_server -c $CONFFILE
ExecStop=/bin/kill -SIGTERM $MAINPID
RestartSec=10s
WantedBy=multi-user.target
[root@bogon zabbix-5.0.1]# systemctl enable zabbix-server
[root@bogon zabbix-5.0.1]# systemctl stop zabbix-server
[root@bogon zabbix-5.0.1]# systemctl start zabbix-server
[root@bogon zabbix-5.0.1]# systemctl restart zabbix-server安装nginx
[root@bogon data]# tar -zxvf nginx-1.9.9.tar.gz
[root@bogon data]# cd nginx-1.9.9/
[root@bogon data]# ./configure
[root@bogon data]# make
[root@bogon data]# make install
[root@bogon data]# cd /usr/local/nginx/sbin/
[root@bogon data]# ./nginx
[root@bogon data]# ps -ef | grep nginx
[root@bogon zabbix-5.0.1]# mkdir -p /usr/local/nginx/html/zabbix
[root@bogon zabbix-5.0.1]# cp -a /usr/local/data/zabbix-5.0.1/ui/* /usr/local/nginx/html/zabbix/zabbix_web需要php配置优化,编辑php.ini文件
/etc/opt/remi/php73/php.ini
修改如下内容:
max_execution_time = 30 修改为350-(zabbix_web优化)
max_input_time = 60 修改为350-(zabbix_web优化)
post_max_size = 8M 修改为32M-(zabbix_web优化)
date.timezone = Asia/Shanghai 添加-(zabbix_web优化)
找到设置cgi.fix_pathinfo的参数, 这将用分号(;)注释掉,默认设置为“1”
cgi.fix_pathinfo=0
[root@bogon zabbix-5.0.1]# systemctl restart php73-php-fpm
[root@bogon zabbix-5.0.1]# vim /lib/systemd/system/nginx.service
[UNIT]
[root@bogon zabbix-5.0.1]# systemctl daemon-reload
[root@bogon zabbix-5.0.1]# systemctl enable nginx
[root@bogon zabbix-5.0.1]# systemctl stop nginx
[root@bogon zabbix-5.0.1]# systemctl start nginx
若启动失败,重启服务器
[root@bogon zabbix-5.0.1]# systemctl restart nginx
配置nginx文件使PHP页面生效
[root@bogon zabbix-5.0.1]# vim /usr/local/nginx/conf/nginx.conf
listen – 定义Nginx将侦听的端口。
root – 定义存储网站服务的文档根目录。
index- 配置Nginx请求索引文件时优先处理index.php命名的文件。
server_name – 将此指令指向服务器的域名或公共IP地址。
location /- 第一个位置块包括一个try_files指令,该指令检查是否存在满足URI请求的文件。如果Nginx找不到合适的文件,则会返回404错误。
location ~ .php$- 此位置块通过将Nginx指向fastcgi-php.conf配置文件和php7.2-fpm.sock文件来处理实际的PHP处理,该文件声明了与哪个套接字相关联php-fpm。检查/etc/php/7.0/fpm/pool.d/www.conf文件并查找“listen”行。
location ~ /.ht- 通过添加deny all指令,如果任何.htaccess文件碰巧进入文档根目录,它们将不会被提供给访问者。
修改如下内容:
user root;
server {
listen 80;
server_name localhost; #charset koi8-r; #access_log logs/host.access.log main; root /usr/local/nginx/html/zabbix; index index.php index.html index.htm; location / { } #error_page 404 /404.html; # redirect server error pages to the static page /50x.html # #error_page 500 502 503 504 /50x.html; #location = /50x.html { # root /usr/local/nginx/html; #} # proxy the PHP scripts to Apache listening on 127.0.0.1:80 # #location ~ .php$ { # proxy_pass https://127.0.0.1; #} # pass the PHP scripts to FastCGI server listening on 127.0.0.1:9000 # location ~ .php$ { # root html; fastcgi_pass 127.0.0.1:9000; # fastcgi_index index.php; fastcgi_param SCRIPT_FILENAME $document_root$fastcgi_script_name; include fastcgi_params; } # deny access to .htaccess files, if Apache's document root # concurs with nginx's one # location ~ /.ht { deny all; } }
[root@bogon zabbix-5.0.1]# sudo nginx -t
[root@bogon zabbix-5.0.1]# systemctl reload nginx
[root@bogon zabbix-5.0.1]# nginx -s reload #重新加载配置文件
[root@bogon zabbix-5.0.1]# systemctl restart nginx 然后访问https://IP 默认点击下一步 出现报错 PHP xmlwriter extension missing zabbix PHP xmlreader extension missing zabbix 解决办法: 检查/etc/php.ini 修改内容如下: 找到自己的xmlwriter.so和xmlreader.so路径位置 extension=/usr/lib64/php/modules/xmlwriter.so extension=/usr/lib64/php/modules/xmlreader.so 再次启动 查看是否有报错 [root@bogon zabbix-5.0.1]# php73 -v 最终保存文件需要上传到服务器本地路径 字体显示异常 解决办法: /usr/local/nginx/html/zabbix/assets/fonts 将Win10操作系统C:WindowsFonts目录下的任意字体,拷贝到此目录,更改后缀为’.ttf’ 修改php脚本文件/usr/local/nginx/html/zabbix/include/defines.inc.php define('ZBX_GRAPH_FONT_NAME', 'msyh'); // font file name define('ZBX_FONT_NAME', 'msyh'); 重启zabbix服务 重启nginx服务 [root@bogon zabbix-5.0.1]# systemctl restart zabbix-server [root@bogon zabbix-5.0.1]# systemctl restart nginx
本网页所有视频内容由 imoviebox边看边下-网页视频下载, iurlBox网页地址收藏管理器 下载并得到。
ImovieBox网页视频下载器 下载地址: ImovieBox网页视频下载器-最新版本下载
本文章由: imapbox邮箱云存储,邮箱网盘,ImageBox 图片批量下载器,网页图片批量下载专家,网页图片批量下载器,获取到文章图片,imoviebox网页视频批量下载器,下载视频内容,为您提供.
阅读和此文章类似的: 全球云计算