zabbix-server安装
1.环境准备
关闭防火墙和selinux
主机名设置
[root@localhost ~]# hostnamectl set-hostname zabbix_server
2.登录zabbix官网进行进行安装下载对应软件
(官网下载很慢,建议阿里镜像站下载)
[root@zabbix_server ~]# vi /etc/yum.repos.d/zabbix.repo
[zabbix]
name=alibaba_zabbix
baseurl= https://mirrors.aliyun.com/zabbix/zabbix/5.0/rhel/7/x86_64/
gpgcheck=0
enabled=1[zabbix2]
name=alibaba_zabbix_frontend
baseurl= https://mirrors.aliyun.com/zabbix/zabbix/5.0/rhel/7/x86_64/frontend/
gpgcheck=0
enabled=1
加载软件源
安装centos-release-scl, 安装zabbix server、web前端、agent
Zabbix-server-mysql:数据库
Zabbix-agent:代理程序(上报信息的程序)
[root@zabbix_server ~]# yum -y install centos-release-scl[root@zabbix_server ~]# yum -y install epel-release[root@zabbix_server ~]# yum -y install zabbix-server-mysql zabbix-agent
安装数据库
#安装数据库
[root@zabbix_server ~]# yum -y install mariadb mariadb-server#启动数据库
[root@zabbix_server ~]# systemctl enable mariadb
Created symlink from /etc/systemd/system/multi-user.target.wants/mariadb.service to /usr/lib/systemd/system/mariadb.service.
[root@zabbix_server ~]# systemctl start mariadb授权zabbix账号,设置账号密码
[root@zabbix_server ~]# mysql -uroot
Welcome to the MariaDB monitor. Commands end with ; or \g.
Your MariaDB connection id is 2
Server version: 5.5.68-MariaDB MariaDB ServerCopyright (c) 2000, 2018, Oracle, MariaDB Corporation Ab and others.Type 'help;' or '\h' for help. Type '\c' to clear the current input statement.MariaDB [(none)]> create database zabbix character set utf8 collate utf8_bin;
Query OK, 1 row affected (0.00 sec)MariaDB [(none)]> create user zabbix@localhost identified by 'yang123';Query OK, 0 rows affected (0.00 sec)MariaDB [(none)]> grant all privileges on zabbix.* to zabbix@localhost;
Query OK, 0 rows affected (0.01 sec)
初始化Zabbix
#导入初始架构和数据
[root@zabbix_server ~]# zcat /usr/share/doc/zabbix-server-mysql-5.0.36/create.sql.gz | mysql -uzabbix -p'liuyang123' zabbix#配置zabbix配置文件里面的数据库密码
[root@zabbix_server ~]# vi /etc/zabbix/zabbix_server.conf
DBPassword=yang123#启动zabbix
[root@zabbix_server opt]# systemctl start zabbix-server