搭建zabbix5.0lts,自己做个笔记
- 搭建zabbix 按照官方的文档
- Install and configure Zabbix server for your platform
- ~~~~注意点:::::::::::::::::::::::::::::: 必须要做的~
- ~~~~~注意点:::::::::::::::::::::::::::::::
- a. Install Zabbix repository
- b. Install Zabbix server and agent
- c. Install Zabbix frontend
- d. Create initial database
- e. Configure the database for Zabbix server
- 解决zabbix-server 服务端默认乱码的问题
- 踩过的坑
搭建zabbix 按照官方的文档
以下是直接复制官网的首页部分,选的是版本zabbix 5.0 LTS
Install and configure Zabbix server for your platform
~~~~注意点:::::::::::::::::::::::::::::: 必须要做的~
首先要关闭自带的防火墙,还有内核防火墙
systemctl disble --now firewalld.service
sudo vim /etc/selinux/config
将SELINUX=enforcing改为SELINUX=disabled即可
~~~~~注意点:::::::::::::::::::::::::::::::
a. Install Zabbix repository
# rpm -Uvh https://repo.zabbix.com/zabbix/5.0/rhel/7/x86_64/zabbix-release-5.0-1.el7.noarch.rpm
# yum clean all
b. Install Zabbix server and agent
# sudo yum install zabbix-server-mysql zabbix-agent
c. Install Zabbix frontend
Enable Red Hat Software Collections
# yum install centos-release-scl
centos-release-sc的用途是可以把多个版本的软件共存于centos 上,安装多个版本的软件不会破坏系统的依赖
Edit file /etc/yum.repos.d/zabbix.repo and enable zabbix-frontend repository.
[zabbix-frontend]
...
enabled=1
...
开启zabbix的前端源
Install Zabbix frontend packages.
# yum install zabbix-web-mysql-scl zabbix-apache-conf-scl
安装数据库
sudo yum install mariadb*
sudo systemctl enable --now mariadb.service
sudo mysql_secure_installation
d. Create initial database
Make sure you have database server up and running.
Run the following on your database host.
# mysql -uroot -p
password #这是你刚才执行mysql_secure_installation设置的密码
mysql> create database zabbix character set utf8 collate utf8_bin;
mysql> create user zabbix@localhost identified by 'password';
mysql> grant all privileges on zabbix.* to zabbix@localhost;
mysql> quit;
On Zabbix server host import initial schema and data. You will be prompted to enter your newly created password.
# zcat /usr/share/doc/zabbix-server-mysql*/create.sql.gz | mysql -uzabbix -p zabbix
e. Configure the database for Zabbix server
Edit file /etc/zabbix/zabbix_server.conf
DBPassword=password #你要设置的密码
f. Configure PHP for Zabbix frontend
Edit file /etc/opt/rh/rh-php72/php-fpm.d/zabbix.conf, uncomment and set the right timezone for you.
; php_value[date.timezone] = Europe/Riga
g. Start Zabbix server and agent processes
Start Zabbix server and agent processes and make it start at system boot.
# systemctl restart zabbix-server zabbix-agent httpd rh-php72-php-fpm
# systemctl enable zabbix-server zabbix-agent httpd rh-php72-php-fpm
h. Configure Zabbix frontend
Connect to your newly installed Zabbix frontend: http://server_ip_or_name/zabbix
Follow steps described in Zabbix documentation: Installing frontend
解决zabbix-server 服务端默认乱码的问题
可以看到图中框框的图示
1.安装字体 sudo yum install wqy-microhei-fonts -y
2.sudo cp /usr/share/fonts/wqy-microhei/wqy-microhei.ttc /usr/share/fonts/dejavu/DejaVuSans.ttf
乱码问题解决。
踩过的坑
安装zabbix 的时候,我把web服务器选择为了nginx,但是装好后不能打开前端页面,选择了apache之后可以打开前端页面了。
以下是zabbix 的官网