Centos7系統安裝Zabbix4.4步驟詳解
1. 虛擬機中安裝Centos7系統
本次實驗使用最小系統安裝,安裝完后可以先進行內核軟件更新(yum -y update)時間比較久,快速配置可以忽略此步驟。
2.關閉Centos7的SELinux和防火牆配置
關閉SELinux
[root@zabbix-server ~]# setenforce 0
[root@zabbix-server ~]# vi /etc/selinux/config
# This file controls the state of SELinux on the system.
# SELINUX= can take one of these three values:
# enforcing - SELinux security policy is enforced.
# permissive - SELinux prints warnings instead of enforcing.
# disabled - No SELinux policy is loaded.
SELINUX=disabled
# SELINUXTYPE= can take one of three values:
# targeted - Targeted processes are protected,
# minimum - Modification of targeted policy. Only selected processes are protected.
# mls - Multi Level Security protection.
SELINUXTYPE=targeted
關閉防火牆配置
[root@zabbix-server ~]# systemctl stop firewalld.service
[root@zabbix-server ~]# systemctl disable firewalld.service
3.部署zabbix4.4服務器、zabbix4.4官網教程鏈接
1.安裝 數據庫
[root@zabbix-server ~]# rpm -Uvh https://repo.zabbix.com/zabbix/4.4/rhel/7/x86_64/zabbix-release-4.4-1.el7.noarch.rpm
[root@zabbix-server ~]# yum clean all
[root@zabbix-server ~]# yum makecache
2.安裝Zabbix服務器,前端,代理(如果沒有安裝成功,需多次執行下載才能完全安裝)
[root@zabbix-server ~]# yum -y install zabbix-server-mysql zabbix-web-mysql zabbix-agent
把三個服務全部安裝完成
3. 安裝mariadb數據庫(設置開機啟動)
//更新MARIABD數據庫
[root@zabbix-server ~]# yum install -y mariadb-server
//啟動服務
[root@zabbix-server ~]# systemctl start mariadb.service
//設置開機啟動
[root@zabbix-server ~]# systemctl enable mariadb.service
4.導入Zabbix數據到Mysql數據庫
[root@zabbix-server ~]# mysql -uroot -p
Enter password: //空密碼直接按回車鍵
Welcome to the MariaDB monitor. Commands end with ; or \g.
Your MariaDB connection id is 2
Server version: 5.5.64-MariaDB MariaDB Server
Copyright (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)]> grant all privileges on zabbix.* to zabbix@localhost identified by 'zn123456';
Query OK, 0 rows affected (0.00 sec)
MariaDB [(none)]> flush privileges;
Query OK, 0 rows affected (0.00 sec)
MariaDB [(none)]> quit;
Bye
5.導入初始架構和數據,系統將提示您輸入新創建的密碼。
[root@zabbix-server ~]# zcat /usr/share/doc/zabbix-server-mysql*/create.sql.gz | mysql -uzabbix -p zabbix Enter password: ###密碼:zn123456
6.為Zabbix server配置數據庫
[root@zabbix-server ~]# vi /etc/zabbix/zabbix_server.conf
DBHost=localhost DBName=zabbix DBUser=zabbix DBPassword=zn123456
7.修改時區
[root@zabbix-server ~]# vi /etc/httpd/conf.d/zabbix.conf
#
# Zabbix monitoring system php web frontend
#
Alias /zabbix /usr/share/zabbix
<Directory "/usr/share/zabbix">
Options FollowSymLinks
AllowOverride None
Require all granted
<IfModule mod_php5.c>
php_value max_execution_time 300
php_value memory_limit 128M
php_value post_max_size 16M
php_value upload_max_filesize 2M
php_value max_input_time 300
php_value max_input_vars 10000
php_value always_populate_raw_post_data -1
# php_value date.timezone Europe/Riga
php_value date.timezone Asia/Shanghai
</IfModule>
</Directory>
<Directory "/usr/share/zabbix/conf">
Require all denied
</Directory>
<Directory "/usr/share/zabbix/app">
Require all denied
</Directory>
<Directory "/usr/share/zabbix/include">
Require all denied
</Directory>
<Directory "/usr/share/zabbix/local">
Require all denied
</Directory>
8.啟動Zabbix server和agent進程
[root@zabbix-server ~]# systemctl restart zabbix-server zabbix-agent httpd
[root@zabbix-server ~]# systemctl enable zabbix-server zabbix-agent httpd
9.為Centos7配置IP地址。
10.配置Zabbix前端
連接到新安裝的Zabbix前端:http://10.10.1.88/zabbix
zabbix網頁登錄
如果瀏覽器進不去,一直報錯,嘗試換個瀏覽器。
在瀏覽器輸入http://zabbix服務器ip/zabbix/index.php,輸入管理員用戶名Admin(區分大小寫),默認密碼zabbix,點擊登入即可。
11.設置成中文頁面