zabbix6.0安装环境:Lamp(linux httpd mysql8.0 php)
注意:
1. 关闭防火墙(firewalld
),取消开机启动
systemctl stop firewalld && systemctl disable firewalld
2. 永久关闭selinux
安全机制
首先编辑配置文件(/etc/selinux/config
),将SELINUX=enforcing
改为SELINUX=disabled
,然后重启服务器
vim /etc/selinux/config#SELINUX=disabled
1. 配置mysql源
#下载MySQL源wget https://dev.mysql.com/get/mysql80-community-release-el7-5.noarch.rpm#配置MySQL源yum -y install mysql80-community-release-el7-5.noarch.rpm
2. 安装依赖
#安装MySQL相关依赖yum -y install gcc-c++ mysql-devel net-snmp-devel libevent-devel mariadb-devel
3. 下载MySQL和zabbix安装包
#下载zabbixwget https://cdn.zabbix.com/zabbix/sources/stable/6.0/zabbix-6.0.1.tar.gz#下载MySQLwget https://dev.mysql.com/get/Downloads/MySQL-8.0/mysql-8.0.28-1.el7.x86_64.rpm-bundle.tar
4. 解压并安装下载好的MySQL安装包到指定目录
#创建MySQL目录mkdir /usr/local/mysql#解压MySQL安装包tar xf mysql-8.0.28-1.el7.x86_64.rpm-bundle.tar -C /usr/local/mysql#移动到mysql目录cd /usr/local/mysql/#RPM方式安装MySQLrpm -ivh mysql-community-* --force --nodeps
5. 检查MySQL的个RPM包是否被安装
rpm -qa |grep mysql
6. 启动MySQL并加入开机自启
#启动MySQLsystemctl start mysqld#MySQL加入开启自启systemctl enable mysqld
7. 检查MySQL服务是否启动
#方法一systemctl status mysqld.service#方法二netstat -anptu |grep mysql#方法三ps -ef |grep mysql
8. 启动mysql后会初始化 查找mysql密码
cat /var/log/mysqld.log | grep password
9. 修改MySQL的root密码
#1. 先登录,密码为上一步查出来的#语法: mysql -u用户 -p密码mysql -uroot -p#2. 必须先修改密码,由于mysql安全机制,密码需要设置复杂点,不然修改不成功#语法: ALTER USER '用户'@'localhost' IDENTIFIED BY '密码';ALTER USER 'root'@'localhost' IDENTIFIED BY 'Asd123!!!';#3. 如果不想设置太复杂的密码,先修改为一个复杂的密码,然后修改安全机制,再设置为简单的密码ALTER USER 'root'@'localhost' IDENTIFIED BY 'Asd123!!!';# 密码检查等级,0/LOW、1/MEDIUM、2/STRONGset global validate_password.policy=0;# 密码的最短长度set global validate_password.length=6;# 密码至少要包含的小写字母个数和大写字母个数set global validate_password.mixed_case_count=0;#重新设置密码ALTER USER 'root'@'localhost' IDENTIFIED BY '123456';
11. 创建zabbix库
# 创建zabbix库create database zabbix character set utf8 collate utf8_bin;# 创建zabbix用户create user zabbix@localhost identified by '123456'; # 授权grant all privileges on zabbix.* to zabbix@localhost;
- 解压zabbix源码包到指定路径
#创建zabbix目录mkdir /usr/local/zabbix#解压tar -zxvf zabbix-6.0.1.tar.gz -C /usr/local/zabbix/
- 创建用户账户
#创建zabbix组groupadd zabbix#创建zabbix用户useradd -g zabbix -M -s /sbin/nologin zabbix
- 在zabbix目录中编译安装
#移动到zabbix目录cd /usr/local/zabbix/zabbix-6.0.1/#编译./configure --prefix=/usr/local/zabbix/ --enable-server --enable-agent --with-net-snmp --with-mysqlmake install
1. 由于CentOS7自带PHP版本为5.6,所以需要安装额外的库,也是remi的库
yum -y install https://rpms.remirepo.net/enterprise/remi-release-7.rpm yum -y install yum-utils yum-config-manager --disable 'remi-php*' yum-config-manager --enable remi-php74 yum -y install php php-bcmath php-gd php-xml php-mbstring php-mysqlnd php-ldap yum -y install curl-devl libxml2 libxml2-devel
2. 需要修改php参数(网页预配置必要条件)
vim /etc/php.ini 修改post_max_size为16M修改max_execution_time为300修改max_input_time为300
1. 安装httpd
yum -y install httpd
2. 移动前端文件至web服务的根目录并授权
cp -r /usr/local/zabbix/zabbix-6.0.1/ui/* /var/www/html/chown apache:apache /var/www/html -R
3. 导入数据库架构及数据
#/usr/local/zabbix/zabbix-6.0.1/database/mysql,目录执行mysql -uzabbix -p密码 zabbix < /usr/local/zabbix/zabbix-6.0.1/database/mysql/schema.sql mysql -uzabbix -p密码 zabbix < /usr/local/zabbix/zabbix-6.0.1/database/mysql/images.sqlmysql -uzabbix -p密码 zabbix < /usr/local/zabbix/zabbix-6.0.1/database/mysql/data.sql
4. 修改配置zabbix_server文件数据库密码
vim /usr/local/zabbix/etc/zabbix_server.conf # DBPassword= 修改为MySQL的zabbix用户密码DBPassword=123456
5. 启动zabbix-server,httpd
service httpd start && systemctl enable httpd.service cd /usr/local/zabbix/sbin/ && ./zabbix_server
登录地址:IP+端口(默认80)
- 修改
/etc/php.ini
文件,修改date.timezone = Asia/Shanghai
date.timezone = Asia/Shanghai
- 重启
http服务
systemctl restart httpd
来源地址:https://blog.csdn.net/dontYouWorry/article/details/130574297