标签:mode centos 7 opacity 修改 alt oca 断点 显示 cti
ZABBIX监控平台部署(LAMP+ZABBIX.Server源码安装部署)
1、Zabbix Server端和Zabbix Agent执行如下代码:
Zabbix监控平台部署,至少需要安装四个组件,分别是Zabbix_Server、Zabbix_Web、Databases、Zabbix_Agent,如下为Zabbix监控平台安装配置详细步骤:
2、部署环境:
Server端 ————>192.168.1.59
Agent端 ————>192.168.1.60
CentOS版本 ————>CentOS 7.6.1810
ZABBIX版本 ————>Zabbix 4.0.19
3、下载zabbix版本,各个版本之间安装方法相差不大,可以根据实际情况选择安装版本,本文版本为Zabbix-4.0.19.tar.gz。
// zabbix源码下载地址(建议从官网下载):
// https://www.zabbix.com/download_sources#tab:40LTS
OR
[root@localhost ~]#
wget -c https://cdn.zabbix.com/zabbix/sources/stable/4.0/zabbix-4.0.25.tar.gz //-c断点续传
[root@localhost ~]# md5sum zabbix-4.0.19.tar.gz //查看一下它的md5值是否正确
b5b9b547cdc9d967513d3828da6e4656 zabbix-4.0.19.tar.gz
[root@localhost ~]# yum -y install gcc curl curl-devel net-snmp net-snmp-devel perl-DBI
> libxml2-devel libevent-devel pcre
[root@localhost ~]# groupadd zabbix
[root@localhost ~]# useradd -g zabbix zabbix
[root@localhost ~]# usermod -s /sbin/nologin zabbix
[root@localhost ~]# yum install -y mariadb-server // 安装数据库
[root@localhost ~]# systemctl start mariadb.service //启动Mariadb。
[root@localhost ~]# mysql_secure_installation // 设置一下MySQL root初始化密码
Enter current password for root (enter for none): //无口令,直接回车
Set root password? [Y/n] y // 设置一下root口令
New password: // 第一次输入密码
Re-enter new password: //第二次输入密码
Remove anonymous users? [Y/n]y //是否删除匿名账号
Disallow root login remotely? [Y/n] n // 是否禁用root远程登录
Remove test database and access to it? [Y/n] y // 是否删除测试账号
Reload privilege tables now? [Y/n] y // 加载特权表,是否让你设置的权限生效。
[root@localhost ~]# mysql -uroot -p123456 // 登录MySQL数据库
// 在MySQL数据库中执行如下命令:
MariaDB [(none)]> create database zabbix character set utf8 collate utf8_bin;
MariaDB [(none)]> grant all on zabbix.* to zabbix@localhost identified by ‘123456‘;
MariaDB [(none)]> flush privileges;
解压zabbix软件包并将Zabbix基础SQL文件导入数据至Zabbix数据库:
[root@localhost ~]# tar -zxvf zabbix-4.0.19.tar.gz
[root@localhost ~]# cd zabbix-4.0.19
[root@localhost zabbix]# mysql -uzabbix -p123456 zabbix <database/mysql/schema.sql
[root@localhost zabbix]# mysql -uzabbix -p123456 zabbix <database/mysql/images.sql
[root@localhost zabbix]# mysql -uzabbix -p123456 zabbix < database/mysql/data.sql
切换至Zabbix解压目录,执行如下代码,安装Zabbix_server:
[root@localhost zabbix]# ./configure --prefix=/usr/local/zabbix --enable-server
> --enable-agent --with-mysql --enable-ipv6 --with-net-snmp --with-libcurl --with-libxml2
[root@localhost zabbix]# make
[root@localhost zabbix]# make install
[root@localhost zabbix]# make && make install // 可以一起执行
[root@localhost zabbix]# ln -s /usr/local/zabbix/sbin/zabbix_* /usr/local/sbin/
[root@localhost zabbix]# make
db.c:27:20: fatal error: mysql.h: No such file or directory
# include "mysql.h" // 若报错mysql.h文件 error
[root@localhost zabbix]# yum -y install mysql-devel // 安装一下mysql-devel开发环境文件
Zabbix server安装完毕,cd /usr/local/zabbix/etc/目录
[root@localhost etc]# cp /usr/local/zabbix/etc/zabbix_server.conf zabbix_server.conf.bak
将zabbix_server.conf配置文件中代码设置为如下:
[root@localhost etc]# vim zabbix_server.conf
LogFile=/tmp/zabbix_server.log
DBHost=localhost
DBName=zabbix
DBUser=zabbix
DBPassword=123456
DBSocket=/var/lib/mysql/mysql.sock
同时cp zabbix_server启动脚本至/etc/init.d/目录,启动zabbix_server, Zabbix_server默认监听端口为10051
[root@localhost ~]# cd zabbix-4.0.19
[root@localhost zabbix]# cp misc/init.d/tru64/zabbix_server /etc/init.d/zabbix_server
[root@localhost zabbix]# chmod o+x /etc/init.d/zabbix_server
[root@localhost ~]# yum -y install php php-cli php-common php-gd php-ldap php-mbstring
> php-mcrypt php-mysql php-pdo
[root@localhost ~]# yum -y install httpd httpd-devel httpd-tools
[root@localhost zabbix]# cp -a /root/zabbix-4.0.19/frontends/php/* /var/www/html/
[root@localhost zabbix]# sed -i ‘/date.timezone/i date.timezone = PRC‘ /etc/php.ini
配置PHP:
// 下方执行思路是yum源安装教程,编译安装待整理
[root@localhost ~]# cd /etc/httpd/conf.d
[root@localhost conf.d]# vim zabbix.conf
# php_value date.timezone Europe/Riga
php_value date.timezone Asia/Shanghai
[root@localhost ~]# systemctl restart httpd.service //重启httpd服务
重新启动Zabbix Server、HTTP、MYSQL服务,代码如下:
[root@localhost ~]# /etc/init.d/zabbix_server restart
[root@localhost ~]# systemctl enable httpd.service
[root@localhost ~]# systemctl enable mariadb.service
[root@localhost ~]# systemctl restart httpd.service
[root@localhost ~]# systemctl restart mariadb.service
通过浏览器Zabbix_WEB验证,通过浏览器访问 https://192.168.1.59/
单击Next step,如果有错误提示,需要把错误依赖解决完,方可进行Next step操作。
如上异常错误解决方法代码如下,安装缺失的软包,并修改php.ini对应参数的值即可.
[root@localhost ~]# yum install php-mbstring php-bcmath php-gd php-xml -y
[root@localhost ~]# yum install gd gd-devel -y
[root@localhost ~]# sed -i ‘/post_max_size/s/8/16/g;/max_execution_time/s/30/300/g;
> /max_input_time/s/60/300/g;s/\;date.timezone.*/date.timezone \= PRC/g;s/\;
> always_populate_raw_post_data/always_populate_raw_post_data/g‘ /etc/php.ini
[root@localhost ~]# systemctl restart httpd
单击Next step,需修创建zabbix.conf.php文件,执行如下命令;
或者单击“Download the
configuration file”下载zabbix.conf.php文件,并将该文件上传至/var/www/html/conf/,并设置可写权限,刷新WEB页面,zabbix.conf.php内容代码如下,最后单击Finish即可:
<?php
// Zabbix GUI configuration file.
global $DB;
$DB[‘TYPE‘] = ‘MYSQL‘;
$DB[‘SERVER‘] = ‘localhost‘;
$DB[‘PORT‘] = ‘0‘;
$DB[‘DATABASE‘] = ‘zabbix‘;
$DB[‘USER‘] = ‘zabbix‘;
$DB[‘PASSWORD‘] = ‘123456‘;
// Schema name. Used for IBM DB2 and PostgreSQL.
$DB[‘SCHEMA‘] = ‘‘;
$ZBX_SERVER = ‘localhost‘;
$ZBX_SERVER_PORT = ‘10051‘;
$ZBX_SERVER_NAME = ‘ZABBIX监控系统‘;
$IMAGE_FORMAT_DEFAULT = IMAGE_FORMAT_PNG;
安装前摘要,若一切正常,直接单击Next step
恭喜你!你已安装ZABBIX前端;单击Finish
ZABBIX WEB登录界面
NH.A.0002__zabbix_lamp+zabbix_server源码编译安装_V2020.10.22
标签:mode centos 7 opacity 修改 alt oca 断点 显示 cti
原文地址:https://www.cnblogs.com/yanqivip/p/4a2400d3e59fb2d3d4fa174cb16cafbd.html