更改主機名php
[root@zabbix-server ~] hostnamectl set-hostname zabbix-server //設置主機名
配置IP地址mysql
[root@ zabbix-server ~] nmcli connection modify ens33 ipv4.addresses 192.168.139.132 //設置IP地址 [root@ zabbix-server ~] nmcli connection up ens33 //激活網卡
添加主機映射 linux
[root@ zabbix-server ~] vim /etc/hosts 192.168.139.132 zabbix zabbix-server.com //在vim中寫入該指令 另起一行
檢查是否可以ping通設置的網站web
[root@ zabbix-server ~] ping zabbix-server.com //ping剛纔在vim寫入的網址 PING zabbix (192.168.139.132) 56(84) bytes of data. 64 bytes from zabbix (192.168.139.132): icmp_seq=1 ttl=64 time=0.032 ms 64 bytes from zabbix (192.168.139.132): icmp_seq=2 ttl=64 time=0.034 ms
安裝LAMP組件sql
[root@ zabbix-server ~] yum -y ×××tall httpd mariadb mariadb-server php php-mysql //安裝軟件包 已安裝: httpd.x86_64 0:2.4.6-89.el7.centos mariadb.x86_64 1:5.5.60-1.el7_5 mariadb-server.x86_64 1:5.5.60-1.el7_5 php.x86_64 0:5.4.16-46.el7 php-mysql.x86_64 0:5.4.16-46.el7
檢查是否安裝成功數據庫
[root@zabbix-server ~]# yum list httpd mariadb mariadb-server php php-mysql 已加載插件:fastestmirror, langpacks Loading mirror speeds from cached hostfile * base: mirrors.aliyun.com * extras: ap.stykers.moe * updates: mirrors.aliyun.com 已安裝的軟件包 httpd.x86_64 2.4.6-89.el7.centos @updates mariadb.x86_64 1:5.5.60-1.el7_5 @base mariadb-server.x86_64 1:5.5.60-1.el7_5 @base php.x86_64 5.4.16-46.el7 @base php-mysql.x86_64 5.4.16-46.el7
啓用LAMP服務vim
[root@zabbix-server ~] systemctl restart httpd mariadb //重啓服務 [root@zabbix-server ~] systemctl enable httpd mariadb //設置開機自啓 Created symlink from /etc/systemd/system/multi-user.target.wants/httpd.service to /usr/lib/systemd/system/httpd.service. Created symlink from /etc/systemd/system/multi-user.target.wants/mariadb.service to /usr/lib/systemd/system/mariadb.s
關閉防火牆centos
[root@zabbix-server ~] systemctl stop firewalld.service //關閉防火牆 [root@zabbix-server ~] systemctl disable firewalld.service //進制開機自啓 Removed symlink /etc/systemd/system/multi-user.target.wants/firewalld.service. Removed symlink /etc/systemd/system/dbus-org.fedoraproject.FirewallD1.service.
關閉SELinux機制瀏覽器
[root@zabbix-server ~] setenforce 0 //使SELinux失效 [root@zabbix-server ~] vim /etc/selinux/config //開機時禁止 // 進入到vim編輯模式 更改第一個SELinux的值 # 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 ×××tead 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
確認軟件包
可使用XFTP連上CentOS 7 將準備好的zabbix-server文件傳到/root 目錄下
安裝zabbix服務器依賴包服務器
[root@ zabbix-server ~] ls /root/zabbix-server/ [root@ zabbix-server ~] yum -y ×××tall zabbix-server/ *.rpm [root@zabbix-server ~] yum list "zabbix*" 已安裝的軟件包 zabbix-agent.x86_64 3.4.15-1.el7 @zabbix zabbix-release.noarch 3.4-2.el7 ×××talled zabbix-server-mysql.x86_64 3.4.15-1.el7 @zabbix zabbix-server-pgsql.x86_64 3.4.15-1.el7 @zabbix zabbix-web.noarch 3.4.15-1.el7 @zabbix zabbix-web-mysql.noarch 3.4.15-1.el7
修改zabbix的web服務器配置
[root@zabbix-server ~] vim /etc/httpd/conf.d/zabbix.conf ... php_value date.timezone Asia/Shanghai //刪掉#號 將時區改成上海 ... [root@zabbix-server ~] systemctl restart httpd //重啓web服務
新建zabbix庫 受權用戶zabbix訪問 密碼爲pwd@123
[root@zabbix-server ~] mysql -uroot MariaDB [(none)]> create database zabbix character set utf8 collate utf8_bin; MariaDB [(none)]> grant all on zabbix.* to zabbix@localhost identified by 'pwd@123'; MariaDB [(none)]> quit;
導入zabbix服務提供的初始庫
[root@zabbix-server ~] zcat /usr/share/doc/zabbix-server-mysql*/create.sql.gz | mysql -uzabbix -ppwd@123 zabbix
設置數據庫鏈接
[root@zabbix-server ~] vim /etc/zabbix/zabbix_server.conf ... DBName=zabbix //數據庫名 DBUser=zabbix //數據庫用戶 DBPassword=pwd@123 //鏈接密碼
啓動zabbix-serer、zabbix-agent
[root@zabbix-server ~] systemctl restart zabbix-server zabbix-agent [root@zabbix-server ~] systemctl enable zabbix-server zabbix-agent
確認httpd網站服務已開啓
[root@zabbix-server ~] systemctl restart httpd
訪問部署好的zabbix監控系統頁面
在瀏覽器中訪問 http://192.168.139.132/zabbix/
點擊 Next Step 按鈕
確認各項狀態無誤後點擊 Next Step
設置庫名zabbix、用戶名zabbix、密碼pwd@123 點擊Next Step
name這裏起個名字 再次點擊Next Step
再點一次Next Step 點Finish
回到登陸界面 開始登錄
使用默認管理員的帳號登錄
Username:Admin
Password:zabbix
登陸成功後 顯示zabbix監控的網頁
更改語言設置 點擊zabbix監控平臺右上方的頭像標識
在language選項中選擇Chinese
能夠更換一個炫酷一點的主題 在剛纔設置中文下面的選項中選擇dark
下面這些問題是我我的這幾天遇到的 但願能讓大家少走彎路
這個問題多是yum倉庫設置的時候有問題
兩種解決方法
設置完yum源必定要repolist檢查一下看看數據正不正常
理論上說 --add後面不加-repo也行 可是我就是不行 仍是加上吧
[root@zabbix-server ~] yum-config-manager --add-repo file:///repo/cos7dvd/
[root@zabbix-server ~] yum -y remove httpd-tools php-common mariadb-libs [root@zabbix-server ~] yum -y ×××tall httpd mariadb mariadb-server php php-mysql [root@zabbix-server ~] yum -y ×××tall postfix
多是linux的版本跟zabbix-server的版本不一致致使的
CentOS 7-1804版本的是9個包 16版本的包更多一點 須要下載對應的包
這個錯誤指令應該是數據庫沒啓動
若是啓動了仍是這樣的話 可能跟上面的問題緣由同樣
16版本的話安裝不是mariadb包 應該是:mysql-community-server.x86_64
解決方法:
[root@zabbix-server ~] wget http://dev.mysql.com/get/mysql57-community-release-el7-8.noarch.rpm [root@zabbix-server ~] yum local×××tall mysql57-community-release-el7-8.noarch.rpm [root@zabbix-server ~] yum repolist enabled |grep "mysql.*-community.*" [root@zabbix-server ~] yum -y ×××tall mysql-community-server.x86_64 [root@zabbix-server ~] systemctl start mysqld [root@zabbix-server ~] systemctl status mysqld [root@zabbix-server ~] systemctl enable mysqld
因爲曾經升級過數據庫,升級完成後沒有使用mysql_upgrade升級數據結構形成
解決方法:
[root@zabbix-server ~] mysql_upgrade -uroot
被上面這幾個問題卡了好幾天,慢慢琢磨,百度才解決這些問題,但願可以幫助到大家搭建zabbix仍是頗有必要的,不少公司都在用zabbix,也是運維必備技能通常容易出錯的地方就是在yum源 版本這塊 每每也是不起眼的小問題每每容易被忽略有任何問題和文中錯誤的地方能夠評論或私信告訴我