0
点赞
收藏
分享

微信扫一扫

虚拟机安装ZABBIX5.0

Xin_So 2022-04-27 阅读 41

安装CentOS 7 64位

关闭SeLinux
vi /etc/selinux/config
selinux=disabled

关闭防火墙
systemctl stop firewalld.service       //停止防火墙
systemctl disable firewalld.service   //永久关闭防火墙

sed -i 's/SELINUX=enforcing/SELINUX=disabled/' /etc/selinux/config
systemctl disable --now firewalld
reboot

虚拟机下修改网卡上网
ls  /etc/sysconfig/network-scripts
ifcfg-ens33
vi  /etc/sysconfig/network-scripts/ifcfg-ens33
ONBOOT=no改为yes即可
键入:wq保存并退出
reboot

安装apache
yum install -y httpd
systemctl enable httpd  //开机自动启动http服务
Systemctl start httpd     //启动httpd服务

安装mysql
yum install -y mariadb mariadb-server
systemctl enable mariadb  //开机自启动
systemctl start mariadb     //启动mysql

安装php环境
yum install -y php php-mysql

安装zabbix

rpm -Uvh https://mirrors.aliyun.com/zabbix/zabbix/5.0/rhel/7/x86_64/zabbix-release-5.0-1.el7.noarch.rpm
sed -i 's#http://repo.zabbix.com#https://mirrors.aliyun.com/zabbix#' /etc/yum.repos.d/zabbix.repo
yum clean all
yum install -y zabbix-server-mysql zabbix-get zabbix-web zabbix-web-mysql zabbix-agent zabbix-sender
//多运行几次,直到出现Complete!

创建一个zabbix库并设置为utf8的字符编码格式
mysql
create database zabbix character set utf8 collate utf8_bin;
show databases;  //查看数据库

创建账户并且授权设置密码
grant all privileges on zabbix.* to zabbix@localhost identified by 'zabbix';
//给来自loclhost的用户zabbxi分配可对数据库zabbix所有表进行所有操作的权限,并且设定密码为zabbix
flush privileges;   //刷新数据库

cd /usr/share/doc/zabbix-server-mysql-3.2.10/  //进入目录
gunzip create.sql.gz   //解压文件

导入表

mysql
use zabbix;   //进入zabbix库
source create.sql    //导入数据

配置文件目录
cd /etc/zabbix
vi zabbix_server.conf
DBHost=localhost
DBName=zabbix
DBUser=zabbix
DBPassword=zabbix
DBSocket=/var/lib/mysql/mysql.sock

运行zabbix-server服务
systemctl start zabbix-server.service

开机自启zabbix-server服务
systemctl enable zabbix-server.service

配置php
cd /etc/httpd/conf.d
vi zabbix.conf
php_value date.timezone Asia/Shanghai

systemctl restart httpd //重启apache

举报

相关推荐

0 条评论