环境架构
ZABBIX版本 | OS分布 | OS版本 | 数据库 | WEB SERVER |
---|---|---|---|---|
5.0 LTS | CentOS | 7 | MySQL | NGINX |
服务版本
服务 | 版本 | IP | 系统 |
---|---|---|---|
Nginx | 1.16.1 | 172.25.189.134 | CentOS Linux release 7.6.1810 (Core) |
PHP | 7.2.24 | ||
MySQL | 5.5 | ||
Zabbix Server | 5.0 LTS | ||
Zabbix WEB | |||
Zabbix agent |
安装 zabbix 软件源
代码语言:javascript复制rpm -Uvh https://repo.zabbix.com/zabbix/5.0/rhel/7/x86_64/zabbix-release-5.0-1.el7.noarch.rpm
yum clean all
修改 zabbix 软件源配置文件
编辑配置文件 /etc/yum.repos.d/zabbix.repo
[zabbix-frontend]
...
enabled=1
...
添加红帽软件包
代码语言:javascript复制yum install centos-release-scl
安装 Zabbix server、agent、web、nginx和php
代码语言:javascript复制yum install -y zabbix-server-mysql zabbix-agent zabbix-web-mysql-scl zabbix-nginx-conf-scl
安装mysql 数据库
代码语言:javascript复制# 安装mariadb
yum install -y mariadb-server
# 启动 mariadb 数据库
systemctl start mariadb
# 设置开机自启动
systemctl enable mariadb
# 运行初始化
mysql_secure_installation
下面是数据库初始化
代码语言:javascript复制# 开始让输入 root 密码直接回车
Enter current password for root (enter for none):
Setting the root password ensures that nobody can log into the MariaDB
root user without the proper authorisation.
# 设置 root 密码 输入两次密码
Set root password? [Y/n] y
New password:
Re-enter new password:
Password updated successfully!
Reloading privilege tables..
... Success!
By default, a MariaDB installation has an anonymous user, allowing anyone
to log into MariaDB without having to have a user account created for
them. This is intended only for testing, and to make the installation
go a bit smoother. You should remove them before moving into a
production environment.
# 是否删除匿名用户
Remove anonymous users? [Y/n] y
... Success!
Normally, root should only be allowed to connect from 'localhost'. This
ensures that someone cannot guess at the root password from the network.
# 是否设置 root 用户只允许本地登录
Disallow root login remotely? [Y/n] n
... skipping.
By default, MariaDB comes with a database named 'test' that anyone can
access. This is also intended only for testing, and should be removed
before moving into a production environment.
# 是否删除 测试数据库
Remove test database and access to it? [Y/n] y
- Dropping test database...
... Success!
- Removing privileges on test database...
... Success!
Reloading the privilege tables will ensure that all changes made so far
will take effect immediately.
# 是否刷新权限
Reload privilege tables now? [Y/n] y
... Success!
Cleaning up...
All done! If you've completed all of the above steps, your MariaDB
installation should now be secure.
Thanks for using MariaDB!
创建 Zabbix 数据库
代码语言:javascript复制# mysql -uroot -p
create database zabbix character set utf8 collate utf8_bin;
create user zabbix@localhost identified by '数据库密码';
grant all privileges on zabbix.* to zabbix@localhost;
quit;
导入初始架构和数据,系统将提示您输入新创建的密码。
代码语言:javascript复制zcat /usr/share/doc/zabbix-server-mysql*/create.sql.gz | mysql -uzabbix -p zabbix
为Zabbix server配置数据库
编辑配置文件 /etc/zabbix/zabbix_server.conf
DBPassword=数据库密码
为Zabbix前端配置PHP
编辑配置文件 /etc/opt/rh/rh-nginx116/nginx/conf.d/zabbix.conf
# 如果这台服务器只有 zabbix 可以不用设置
# listen 80;
# server_name example.com;
编辑配置文件 /etc/opt/rh/rh-php72/php-fpm.d/zabbix.conf
# 添加 nginx
listen.acl_users = apache,nginx
修改时区,复制出来一行,修改后面的时区
代码语言:javascript复制; php_value[date.timezone] = Europe/Riga
php_value[date.timezone] = Asia/Shanghai
启动 zabbix进程
代码语言:javascript复制systemctl restart zabbix-server zabbix-agent rh-nginx116-nginx rh-php72-php-fpm
systemctl enable zabbix-server zabbix-agent rh-nginx116-nginx rh-php72-php-fpm
配置Zabbix前端
连接到新安装的Zabbix前端:http://server_ip_or_name
如果不能打开网页,检查是否关闭 防火墙和 selinux
代码语言:javascript复制systemctl stop firewalld
setenforce 0
web 界面配置
•Welcome :欢迎界面•Check of pre-requisites :检查先决条件•Configure DB connection:配置数据库连接•Zabbix server details :Zabbix服务器详细信息•Pre-installation summary :预安装总结•Install :安装
输入数据库密码
登录
更改语言
安装完成