centos7.5安裝zabbix3.0

安裝zabbix3.0

系統環境

[root@centos7 ~]# cat /etc/redhat-release
CentOS Linux release 7.5.1804 (Core)
[root@centos7 ~]# uname -r
3.10.0-862.el7.x86_64
[root@centos7 ~]# systemctl status firewalld
● firewalld.service - firewalld - dynamic firewall daemon
   Loaded: loaded (/usr/lib/systemd/system/firewalld.service; disabled; vendor preset: enabled)
   Active: inactive (dead)
     Docs: man:firewalld(1)
[root@centos7 ~]# getenforce 
Disabled

如何下載zabbix服務端

官網下載地址:https://www.zabbix.com/downloadphp

 image.png

zabbix服務端安裝


配置好時間同步

cat >>/var/spool/cron/root <<EOF
#time sync 2018-08-19 by cjh
*/10 * * * * /usr/sbin/ntpdate ntp1.aliyun.com &>/dev/null
EOF

下載

官網下載地址:https://www.zabbix.com/downloadmysql

rpm -ivh https://repo.zabbix.com/zabbix/3.0/rhel/7/x86_64/zabbix-release-3.0-1.el7.noarch.rpmweb

爲何選擇zabbix-release版本:sql

   由於下載這個版本會在yum.repos.d下面生成一個zabbix.repo的文件數據庫

檢查是否下載成功:主要檢查/etc/yum.repos.d/目錄中沒有zabbix.repo這個文件centos

[root@centos7 ~]# ls /etc/yum.repos.d/
CentOS-Base.repo  CentOS-Debuginfo.repo  CentOS-Media.repo    CentOS-Vault.repo  zabbix.repo
CentOS-CR.repo    CentOS-fasttrack.repo  CentOS-Sources.repo  epel.repo

關閉防火牆

  systemctl stop firewalld瀏覽器


安裝軟件

yum install -y zabbix-server-mysql zabbix-web-mysql mariadb-serverbash


修改PHP時區設置

sed -i.ori '18a php_value date.timezone  Asia/Shanghai' /etc/httpd/conf.d/zabbix.confide


啓動mysql並建立zabbix庫與zabbix用戶

systemctl start mariadb.servicecentos7

mysql -e 'create database zabbix character set utf8 collate utf8_bin;'

mysql -e 'grant all privileges on zabbix.* to zabbix@localhost identified by "zabbix";'


導入zabbix數據至數據庫

方法一:

   gzip -d /usr/share/doc/zabbix-server-mysql-3.0.22/create.sql.gz

   mysql -uzabbix -pzabbix zabbix < /usr/share/doc/zabbix-server-mysql-3.0.22/create.sql

   #版本不一樣時

   #gzip -d /usr/share/doc/zabbix-server-mysql-3.0.*/create.sql.gz

   #mysql -uzabbix -pzabbix zabbix < /usr/share/doc/zabbix-server-mysql-3.0.*/create.sql

方法二:

   zcat /usr/share/doc/zabbix-server-mysql-3.0.22/create.sql.gz|mysql -uzabbix -pzabbix zabbix

   #版本不一樣時

   #zcat /usr/share/doc/zabbix-server-mysql-3.0.*/create.sql.gz|mysql -uzabbix -pzabbix zabbix


配置zabbix配置文件

sed -i.ori '115a DBPassword=zabbix' /etc/zabbix/zabbix_server.conf


解決中文亂碼

yum -y install wqy-microhei-fonts

\cp /usr/share/fonts/wqy-microhei/wqy-microhei.ttc /usr/share/fonts/dejavu/DejaVuSans.ttf


啓動服務

systemctl start zabbix-server

systemctl start httpd


瀏覽器訪問

訪問地址是:

   echo "瀏覽器訪問 http://`hostname -I|awk '{print $1}'`/zabbix"

image.png

 

快速安裝命令

rpm -ivh https://repo.zabbix.com/zabbix/3.0/rhel/7/x86_64/zabbix-release-3.0-1.el7.noarch.rpm
cat /etc/yum.repos.d/zabbix.repo 
yum install zabbix-server-mysql zabbix-web-mysql mariadb-server -y
rpm -qa zabbix-server-mysql zabbix-web-mysql mariadb-server
yum install zabbix-server-mysql zabbix-web-mysql mariadb-server -y
sed -i.ori '18a php_value date.timezone  Asia/Shanghai' /etc/httpd/conf.d/zabbix.conf
systemctl start mariadb.service
mysql -e 'create database zabbix character set utf8 collate utf8_bin;'
mysql -e 'grant all privileges on zabbix.* to zabbix@localhost identified by "zabbix";'
gzip -d /usr/share/doc/zabbix-server-mysql-3.0.*/create.sql.gz
mysql -uzabbix -pzabbix zabbix < /usr/share/doc/zabbix-server-mysql-3.0.*/create.sql
sed -i.ori '115a DBPassword=zabbix' /etc/zabbix/zabbix_server.conf
yum -y install wqy-microhei-fonts
\cp /usr/share/fonts/wqy-microhei/wqy-microhei.ttc /usr/share/fonts/dejavu/DejaVuSans.ttf
systemctl start zabbix-server
systemctl start httpd
相關文章
相關標籤/搜索