1.8 开始知道
2.0
2.2LTS 火爆
2.4
3.0 LTS
3.2 标准版
3.4 标准版
4.0 LTS
4.2 标准版
4.4 标准版
5.0 LTS
LTS:长期支持版 大约支持五年
标准版:支持七个月
学习4.0版本,因为4.0是长期支持版本之一,比较新,企业常用。学完时进行4.0到5.0的升级。
主机:zabbix
ip: 10.0.0.71
操作系统版本:centos 7.6
方法一
rpm -Uvh https://repo.zabbix.com/zabbix/4.0/rhel/7/x86_64/zabbix-release-4.0-2.el7.noarch.rpm
yum clean all
方法二
wget https://repo.zabbix.com/zabbix/4.0/rhel/7/x86_64/zabbix-release-4.0-2.el7.noarch.rpm
rpm -ivh zabbix-release-4.0-2.el7.noarch.rpm
yum clean all
所有gpgcheck都设置为0
[root@zabbix ~]# vim /etc/yum.repos.d/zabbix.repo
[zabbix]
name=Zabbix Official Repository - $basearch
baseurl=http://repo.zabbix.com/zabbix/4.0/rhel/7/$basearch/
enabled=1
gpgcheck=0
gpgkey=file:///etc/pki/rpm-gpg/RPM-GPG-KEY-ZABBIX-A14FE591
[zabbix-debuginfo]
name=Zabbix Official Repository debuginfo - $basearch
baseurl=http://repo.zabbix.com/zabbix/4.0/rhel/7/$basearch/debuginfo/
enabled=0
gpgkey=file:///etc/pki/rpm-gpg/RPM-GPG-KEY-ZABBIX-A14FE591
gpgcheck=0
[zabbix-non-supported]
name=Zabbix Official Repository non-supported - $basearch
baseurl=http://repo.zabbix.com/non-supported/rhel/7/$basearch/
enabled=1
gpgkey=file:///etc/pki/rpm-gpg/RPM-GPG-KEY-ZABBIX
gpgcheck=0
[root@zabbix ~]# yum install -y zabbix-server-mysql zabbix-web-mysql
[root@zabbix ~]# yum install -y mariadb-server.x86_64
[root@zabbix ~]# yum install zabbix-agent.x86_64 -y
[root@zabbix ~]# systemctl start mariadb.service
[root@zabbix ~]# systemctl enable mariadb.service
[root@zabbix ~]# mysql_secure_installation
Enter current password for root (enter for none): 数据库密码,刚下载,默认没有密码,直接回车
Set root password? [Y/n] 是否设置用户密码,y设置密码
Remove anonymous users? [Y/n] 是否删除匿名用户,y
Disallow root login remotely? [Y/n] 是否禁止root用户远程登录,y
Remove test database and access to it? [Y/n] 是否删除任何人都可以访问的text测试库,y
Reload privilege tables now? [Y/n] 重新加载授权表,y
[root@zabbix ~]# mysql -p
Enter password:
MariaDB [(none)]> show databases;
+--------------------+
| Database |
+--------------------+
| information_schema |
| mysql |
| performance_schema |
+--------------------+
3 rows in set (0.00 sec)
MariaDB [(none)]> select user,host from mysql.user;
+------+-----------+
| user | host |
+------+-----------+
| root | 127.0.0.1 |
| root | ::1 |
| root | localhost |
+------+-----------+
[root@zabbix ~]# mysql -p
Enter password:
建库
MariaDB [(none)]> create database zabbix character set utf8 collate utf8_bin;
授权
MariaDB [(none)]> grant all on zabbix.* to zabbix@localhost identified by '123456';
[root@zabbix ~]# rpm -ql zabbix-server-mysql |grep create.sql
/usr/share/doc/zabbix-server-mysql-4.0.29/create.sql.gz
[root@zabbix ~]# zcat /usr/share/doc/zabbix-server-mysql-4.0.29/create.sql.gz | mysql -uzabbix -p123456 zabbix
无需查找通用命令
zcat /usr/share/doc/zabbix-server-mysql*/create.sql.gz | mysql -uzabbix -p123456 zabbix
MariaDB [(none)]> use zabbix
MariaDB [zabbix]> show tables;
或
[root@zabbix ~]# mysql zabbix -p -e 'show tables';
Enter password:
修改以下信息
[root@zabbix ~]# vim /etc/zabbix/zabbix_server.conf
DBHost=localhost
DBName=zabbix
DBUser=zabbix
DBPassword=123456
[root@zabbix ~]# systemctl start zabbix-server.service
[root@zabbix ~]# systemctl enable zabbix-server.service
[root@zabbix ~]# netstat -lntup
Active Internet connections (only servers)
Proto Recv-Q Send-Q Local Address Foreign Address State PID/Program name
tcp 0 0 0.0.0.0:3306 0.0.0.0:* LISTEN 2210/mysqld
tcp 0 0 0.0.0.0:22 0.0.0.0:* LISTEN 1400/sshd
tcp 0 0 127.0.0.1:25 0.0.0.0:* LISTEN 1561/master
tcp 0 0 0.0.0.0:10051 0.0.0.0:* LISTEN 18523/zabbix_server
tcp6 0 0 :::22 :::* LISTEN 1400/sshd
tcp6 0 0 ::1:25 :::* LISTEN 1561/master
tcp6 0 0 :::10051 :::* LISTEN 18523/zabbix_server
[root@zabbix ~]# vim /etc/httpd/conf.d/zabbix.conf
php_value date.timezone Asia/Shanghai
或
[root@zabbix ~]# vim /etc/php.ini
date.timezone = Asia/Shanghai
[root@zabbix ~]# systemctl start httpd.service
[root@zabbix ~]# systemctl enable httpd.service
Created symlink from /etc/systemd/system/multi-user.target.wants/httpd.service to /usr/lib/sys
原创声明:本文系作者授权腾讯云开发者社区发表,未经许可,不得转载。
如有侵权,请联系 cloudcommunity@tencent.com 删除。
原创声明:本文系作者授权腾讯云开发者社区发表,未经许可,不得转载。
如有侵权,请联系 cloudcommunity@tencent.com 删除。
扫码关注腾讯云开发者
领取腾讯云代金券
Copyright © 2013 - 2025 Tencent Cloud. All Rights Reserved. 腾讯云 版权所有
深圳市腾讯计算机系统有限公司 ICP备案/许可证号:粤B2-20090059 深公网安备号 44030502008569
腾讯云计算(北京)有限责任公司 京ICP证150476号 | 京ICP备11018762号 | 京公网安备号11010802020287
Copyright © 2013 - 2025 Tencent Cloud.
All Rights Reserved. 腾讯云 版权所有