標籤:centos 6.4x64安裝部署zabbix
一.部署環境
系統:CentOS 6.4x64 迷你安裝
Server:192.168.3.28
Client:192.168.3.29
二.基礎軟體包安裝
在server安裝基礎軟體包,這裡的環境使用yum安裝,如果使用源碼安裝也是可以的。
[[email protected] ~]# yum -y install wget vim tree gcc gcc-c++ autoconf httpd php mysql mysql-server php-mysql httpd-manual mod_ssl mod_perl mod_auth_mysql php-gd php-xml php-mbstring php-ldap php-pear php-xmlrpc php-bcmath mysql-connector-odbc mysql-devel libdbi-dbd-mysql net-snmp net-snmp-devel curl-devel
啟動httpd、mysql並設定成開機自動啟動
[[email protected] ~]# service httpd start[[email protected] ~]# service mysqld start[[email protected] ~]# chkconfig httpd on[[email protected] ~]# chkconfig mysqld on
在iptables中允許存取80,3306連接埠。
[[email protected] ~]# iptables -I INPUT -p tcp -m multiport --destination-port 80,10050:10051 -j ACCEPT#查看防火牆結果[[email protected] ~]# iptables -L -nChain INPUT (policy ACCEPT)target prot opt source destination ACCEPT tcp -- 0.0.0.0/0 0.0.0.0/0 multiport dports 80,10050:10051 ACCEPT all -- 0.0.0.0/0 0.0.0.0/0 state RELATED,ESTABLISHED ACCEPT icmp -- 0.0.0.0/0 0.0.0.0/0 ACCEPT all -- 0.0.0.0/0 0.0.0.0/0 ACCEPT tcp -- 0.0.0.0/0 0.0.0.0/0 state NEW tcp dpt:22 REJECT all -- 0.0.0.0/0 0.0.0.0/0 reject-with icmp-host-prohibited Chain FORWARD (policy ACCEPT)target prot opt source destination REJECT all -- 0.0.0.0/0 0.0.0.0/0 reject-with icmp-host-prohibited Chain OUTPUT (policy ACCEPT)target prot opt source destination #儲存iptables規則[[email protected] ~]# service iptables saveiptables: Saving firewall rules to /etc/sysconfig/iptables:[ OK ]
三.配置PHP參數
zabbix的運行需要特定的php參數支援,修改如下
[[email protected] ~]# sed -i "[email protected];date.timezone [email protected] = Asia/[email protected]" /etc/php.ini[[email protected] ~]# sed -i "[email protected]_execution_time = [email protected]_execution_time = [email protected]" /etc/php.ini[[email protected]abbix-server ~]# sed -i "[email protected]_max_size = [email protected]_max_size = [email protected]" /etc/php.ini[[email protected] ~]# sed -i "[email protected]_input_time = [email protected]_input_time = [email protected]" /etc/php.ini[[email protected] ~]# sed -i "[email protected]_limit = [email protected]_limit = [email protected]" /etc/php.ini[[email protected] ~]# sed -i "[email protected];mbstring.func_overload = [email protected]_overload = [email protected]" /etc/php.ini
修改httpd的FQDN錯誤,重啟httpd服務
[[email protected] ~]# echo "ServerName localhost:80" >>/etc/httpd/conf/httpd.conf[[email protected] ~]# /etc/init.d/httpd restartStopping httpd: [ OK ]Starting httpd: [ OK ]
四.下載zabbix-2.4.5.tar.gz
[[email protected] ~]# wget http://jaist.dl.sourceforge.net/project/zabbix/ZABBIX%20Latest%20Stable/2.4.5/zabbix-2.4.5.tar.gz
五.添加zabbix使用者和組
[[email protected] ~]# groupadd -g 201 zabbix[[email protected] ~]# useradd -g zabbix -u 201 -s /sbin/nologin zabbix
六.安裝zabbix
[[email protected] ~]# tar xf zabbix-2.4.5.tar.gz[[email protected] ~]# cd zabbix-2.4.5[[email protected] zabbix-2.4.5]# ./configure --prefix=/usr/local/zabbix --enable-server --enable-proxy --enable-agent --with-mysql=/usr/bin/mysql_config --with-net-snmp --with-libcurl[[email protected] zabbix-2.4.5]# make && make install#建立zabbix資料庫以及相關表[[email protected] zabbix-2.4.5]# mysql -e "create database zabbix ;"[[email protected] zabbix-2.4.5]# mysql -e "grant all on zabbix.* to [email protected] identified by ‘zabbix‘;"[[email protected] zabbix-2.4.5]# mysql -uzabbix -pzabbix zabbix<./database/mysql/schema.sql[[email protected] zabbix-2.4.5]# mysql -uzabbix -pzabbix zabbix<./database/mysql/images.sql[[email protected] zabbix-2.4.5]# mysql -uzabbix -pzabbix zabbix<./database/mysql/data.sql#配置軟串連和開機檔案資訊[[email protected] zabbix-2.4.5]# mkdir /var/log/zabbix[[email protected] zabbix-2.4.5]# chown zabbix.zabbix /var/log/zabbix[[email protected] zabbix-2.4.5]# ln -s /usr/local/zabbix/etc/ /etc/zabbix[[email protected] zabbix-2.4.5]# ln -s /usr/local/zabbix/bin/* /usr/bin/[[email protected] zabbix-2.4.5]# ln -s /usr/local/zabbix/sbin/* /usr/sbin/ [[email protected] zabbix-2.4.5]# cp /root/zabbix-2.4.5/misc/init.d/fedora/core/zabbix_* /etc/init.d[[email protected] zabbix-2.4.5]# chmod 755 /etc/init.d/zabbix_*#修改/etc/init.d目錄下的zabbix_server和zabbix_agentd開機檔案[[email protected] zabbix-2.4.5]# sed -i "[email protected]=/usr/[email protected]=/usr/local/[email protected]" /etc/init.d/zabbix_server[[email protected] zabbix-2.4.5]# sed -i "[email protected]=/usr/[email protected]=/usr/local/[email protected]" /etc/init.d/zabbix_agent#修改/etc/zabbix/zabbix_server.conf[[email protected] zabbix-2.4.5]# sed -i "[email protected][email protected][email protected]" /etc/zabbix/zabbix_server.conf[[email protected] zabbix-2.4.5]# sed -i "[email protected]#[email protected][email protected]" /etc/zabbix/zabbix_server.conf[[email protected] zabbix-2.4.5]# sed -i "[email protected]# [email protected][email protected]" /etc/zabbix/zabbix_server.conf#修改/etc/zabbix/zabbix_agentd.conf[[email protected] zabbix-2.4.5]# sed -i "[email protected][email protected]=127.0.0.1,[email protected]" /etc/zabbix/zabbix_agentd.conf[[email protected] zabbix-2.4.5]# sed -i "[email protected][email protected]=$IP:[email protected]" /etc/zabbix/zabbix_agentd.conf[[email protected] zabbix-2.4.5]# sed -i "[email protected]/[email protected]/log/zabbix/[email protected]" /etc/zabbix/zabbix_agentd.conf[[email protected] zabbix-2.4.5]# sed -i "[email protected]^# [email protected]=1\[email protected]" /etc/zabbix/zabbix_agentd.conf
本文出自 “ly36843營運” 部落格,請務必保留此出處http://ly36843.blog.51cto.com/3120113/1640289
CentOS 6.4x64安裝部署zabbix