1.關閉selinux和firewallphp
1.1檢測selinux是否關閉html
[root@localhost ~]# getenforce
Disabled #Disabled 爲關閉mysql
1.1.1臨時關閉
[root@localhost ~]# setenforce 0 #設置SELinux 成爲enforcing模式
1.1.2永久關閉linux
[root@localhost ~]# vi /etc/selinux/config:
將SELINUX=enforcing改成SELINUX=disabled
設置後須要重啓才能生效web
1.2查看默認防火牆狀態sql
[root@localhost ~]# firewall-cmd --state
not running #關閉後顯示not running,開啓後顯示running數據庫
1.2.1中止firewall瀏覽器
[root@localhost ~]# systemctl stop firewalld.service服務器
1.2.2禁止firewall開機啓動
[root@localhost ~]# systemctl disable firewalld.servicefrontend
2.Zabbix3.4程序安裝
2.1配置zabbix的yum源
[root@localhost ~]# rpm -ivh http://repo.zabbix.com/zabbix/3.4/rhel/7/x86_64/zabbix-release-3.4-2.el7.noarch.rpm
2.2安裝zabbix程序包,安裝mysql、zabbxi-agent
[root@localhost ~]# yum install -y zabbix-server-mysql zabbix-web-mysql zabbix-agent mariadb-server
2.3啓動mariadb並設置開機啓動,建立數據庫實例,受權
[root@localhost ~]# systemctl start mariadb #啓動mariadb
[root@localhost ~]# systemctl enable mariadb #設置開機啓動
[root@localhost ~]# mysql #登入數據庫
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@'%' identified by 'zabbix'; #受權全部主機訪問數據庫實例zabbix,用戶名/密碼:zabbix/zabbix
Query OK, 0 rows affected (0.00 sec)
MariaDB [(none)]> grant all privileges on zabbix.* to zabbix@localhost identified by 'zabbix'; #受權localhost主機名訪問數據庫實例zabbix,用戶名/密碼:zabbix/zabbix
Query OK, 0 rows affected (0.00 sec)
MariaDB [(none)]> grant all privileges on zabbix.* to zabbix@localhost.localdomain identified by 'zabbix'; #受權localhost.localdomain主機訪問數據庫實例zabbix,用戶名/密碼:zabbix/zabbix
Query OK, 0 rows affected (0.00 sec)
導入初始模式和數據
[root@localhost ~]# cd /usr/share/doc/zabbix-server-mysql-3.4.4/ #進入create.sql.gz所在目錄
[root@localhost zabbix-server-mysql-3.4.4]# zcat create.sql.gz |mysql -uroot zabbix #導入出事模式
2.4啓動zabbix-server服務
2.4.1配置zabbix-server的配置文件zabbix_server.conf
[root@localhost zabbix-server-mysql-3.4.4]# vi /etc/zabbix/zabbix_server.conf
DBHost=localhost # 數據主機名
DBName=zabbix # 數據庫實例
DBUser=zabbix # 用戶名
DBPassword=zabbix # 密碼
2.4.2啓動zabbix-server服務
[root@localhost zabbix-server-mysql-3.4.4]# systemctl start zabbix-server #啓動zabbix-server服務
[root@localhost zabbix-server-mysql-3.4.4]# systemctl enable zabbix-server #設置zabbix-server服務開機自啓動
2.5編輯Apache的配置文件,消註釋設置正確的時區
[root@localhost zabbix-server-mysql-3.4.4]# vi /etc/httpd/conf.d/zabbix.conf
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 always_populate_raw_post_data -1
php_value date.timezone Asia/Shanghai
啓動httpd服務 ,設置開機啓動httpd服務
[root@localhost ~]# systemctl start httpd #啓動httpd服務
[root@localhost ~]# systemctl enable httpd #設置開機啓動httpd服務
3.啓動zabbix-agent並設置開機自啓動
[root@localhost ~]# systemctl start zabbix-agent # 啓動zabbix-agent服務
[root@localhost ~]# systemctl enable zabbix-agent # 設置zabbix-agent服務開機自啓動
4.Zabbix Web網頁安裝
4.1.在瀏覽器輸入地址http://服務器ip/zabbix/setup.php,出現歡迎界面,點擊下一步;
4.2.出現必要條件檢測界面,正常都是OK,點擊下一步
4.3.配置DB鏈接,與zabbix_server.conf文件中主機、數據庫名稱、用戶名、密碼保持一致,點擊下一步
4.4.zabbix服務器詳細信息,點擊下一步
4.5.安裝前彙總,檢查信息無誤,點擊下一步安裝
4.6.安裝成功
Congratulations! You have successfully installed Zabbix frontend.
配置文件目錄
Configuration file "/etc/zabbix/web/zabbix.conf.php" created.
5zabbix網頁登陸
在瀏覽器輸入http://zabbix服務器ip/zabbix/index.php,輸入管理員用戶名Admin(區分大小寫),默認密碼zabbix,點擊登入便可。