linux運維、架構之路-CentOS6.9安裝Zabbix3.4.1


一、LAMP環境安裝

1、環境

[root@m01 ~]# cat /etc/redhat-release 
CentOS release 6.9 (Final)
[root@m01 ~]# uname -r
2.6.32-696.el6.x86_64
[root@m01 ~]# /etc/init.d/iptables status
iptables: Firewall is not running.
[root@m01 ~]# getenforce 
Disabled

2、安裝Zabbix3.4的yum源

rpm -ivh http://repo.zabbix.com/zabbix/3.4/rhel/6/x86_64/zabbix-release-3.4-1.el6.noarch.rpm

3、安裝MySQL

①修改MySQL5.6yum源

vim /etc/yum.repos.d/mysql.repo [mysql56] name=MySQL 5.6 Community Server baseurl=http://repo.mysql.com/yum/mysql-5.6-community/el/6/$basearch/ 
enabled=1 gpgcheck=1 gpgkey=file:///etc/pki/rpm-gpg/RPM-GPG-KEY-mysql

②導入gpgcheck文件

vim /etc/pki/rpm-gpg/RPM-GPG-KEY-mysql
#去官網復制然后粘貼#
https://dev.mysql.com/doc/refman/5.6/en/checking-gpg-signature.html

③卸載系統自帶舊版本MySQL,安裝MySQL5.6版本

yum remove mysql*
yum install mysql-community-server

④編輯my.conf配置文件

[mysqld]
innodb_file_per_table=1

⑤創建zabbix數據庫

mysql -e 'create database zabbix character set utf8 collate utf8_bin;'
mysql -e "grant all on zabbix.* to zabbix@'localhost' identified by 'zabbix';"

4、安裝httpd、php服務

①yum源

rpm -ivh http://repo.webtatic.com/yum/el6/latest.rpm

②安裝httpd、php

yum -y install httpd php56w php56w-gd php56w-mysqlnd php56w-bcmath php56w-mbstring php56w-xml php56w-ldap

③修改/etc/php.ini配置文件

always_populate_raw_post_data = -1#去掉注釋

sed -i.ori 's#max_execution_time = 30#max_execution_time = 300#;s#max_input_time = 60#max_input_time = 300#;s#post_max_size = 8M#post_max_size = 16M#;910a date.timezone = Asia/Shanghai' /etc/php.ini
#檢查#
egrep -n "^post_max_size|^max_execution_time|^max_input_time|^date.timezone" /etc/php.ini

二、zabbix安裝

1、創建zabbix用戶和組

groupadd zabbix
useradd -g zabbix zabbix

2、安裝zabbix服務端

yum install zabbix zabbix-agent zabbix-get zabbix-sender zabbix-server zabbix-server-mysql zabbix-web zabbix-web-mysql -y

3、配置zabbix-server連接數據庫

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

4、導入數據

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

5、配置zabbix網頁及授權

cp -R /usr/share/zabbix/ /var/www/html/
chmod -R 755 /etc/zabbix/web
chown -R apache.apache /etc/zabbix/web

6、啟動zabbix服務

echo "ServerName 127.0.0.1:80">>/etc/httpd/conf/httpd.conf
/etc/init.d/httpd start
/etc/init.d/zabbix-server start

7、加入開機啟動

cat>>/etc/rc.local<<EOF
/etc/init.d/mysqld start
/etc/init.d/httpd start
/etc/init.d/zabbix-server start
EOF

8、zabbix客戶端安裝

rpm -ivh http://repo.zabbix.com/zabbix/3.4/rhel/6/x86_64/zabbix-release-3.4-1.el6.noarch.rpm
yum install zabbix zabbix-agent zabbix-get zabbix-sender -y
sed -i 's#Server=127.0.0.1#Server=172.16.1.61#' /etc/zabbix/zabbix_agentd.conf
/etc/init.d/zabbix-agent start
Starting Zabbix agent:                                     [  OK  ]

三、zabbix網頁版配置

瀏覽器輸入http://10.0.0.61/zabbix/ 

###具體安裝配置請參照3.0的安裝:https://www.cnblogs.com/yanxinjiang/p/7715155.html


免責聲明!

本站轉載的文章為個人學習借鑒使用,本站對版權不負任何法律責任。如果侵犯了您的隱私權益,請聯系本站郵箱yoyou2525@163.com刪除。



 
粵ICP備18138465號   © 2018-2025 CODEPRJ.COM