在CentOS 7上快速构建Zabbix服务器

今天的目标是什么? rì de mù shì me?)

整理構建Zabbix服务器的步骤。

环境

CentOS7 和 Zabbix 4.0

禁用SElinux

vi /etc/selinux/config

SElinux=disabled

为了使设置生效,将重新启动。

# reboot

Zabbix的安装

# yum update

这次我们要安装Zabbix 4.0的RPM仓库。

# rpm -Uvh https://repo.zabbix.com/zabbix/4.0/rhel/7/x86_64/zabbix-release-4.0-2.el7.noarch.rpm
# yum clean all

请同时安装这个工具。

# yum -y install yum-utils
# yum-config-manager --enable rhel-7-server-optional-rpms
# yum -y install zabbix-server-mysql zabbix-proxy-mysql zabbix-web-mysql zabbix-agent

安装数据库。

# yum install mariadb mariadb-server 

将Maria DB设置为自动启动。

# systemctl enable mariadb.service
# systemctl start mariadb.service

进行数据库的初始设置。

# mysql_secure_installation

Enter current password for root (enter for none):
Set root password? [Y/n] Y
New password:なんか適当に
Re-enter new password:なんか適当に
Remove anonymous users? [Y/n] Y
Disallow root login remotely? [Y/n] n
Remove test database and access to it? [Y/n] Y
Reload privilege tables now? [Y/n] Y
mysql -uroot -p
Enter password:

MariaDB [(none)]> create database zabbix character set utf8 collate utf8_bin;

Query OK, 1 row affected (0.01 sec)

grant all privileges on zabbix.* to zabbix@localhost identified by 'password'; --なんか適当にパスワード

MariaDB [(none)]> quit;
Bye

导入初始数据和模式

zcat /usr/share/doc/zabbix-server-mysql*/create.sql.gz | mysql -uzabbix -p zabbix
Enter password: # 上記のパスワード

进行Zabbix服务器的数据库配置

vi /etc/zabbix/zabbix_server.conf
DBPassword= #上記のパスワードを入力

设置Zabbix前端的时区

# vi /etc/httpd/conf.d/zabbix.conf
↓をよしなに変更
php_value date.timezone Asia/Tokyo

重启Zabbix服务器

systemctl restart zabbix-server httpd zabbix-agent
systemctl enable zabbix-server httpd zabbix-agent

访问Zabbix

image.png
image.png

請輸入資料庫密碼(設定的密碼)。

image.png

默认情况下,主机名是“localhost”,但可以更改为“zabbix”。

image.png

确认设置内容

image.png

确认安装顺利完成

image.png

默认的用户名是Admin,密码是zabbix。

image.png
image.png

参考资料

计算机星队

bannerAds