#!/bin/bash ########################################################################################## # #0、定制配置文件所需参数 # ########################################################################################## mysql_root_pw=root_pw mysql_zabbix_pw=zabbix_pw DBPassword=$mysql_zabbix_pw CacheSize=256M ZBX_SERVER_NAME=My-Zabbix-Server ########################################################################################## # #1、安装Zabbix及MySQL # ########################################################################################## #rpm -ivh http://repo.zabbix.com/zabbix/2.2/rhel/6/x86_64/zabbix-release-2.2-1.el6.noarch.rpm rpm -ivh http://repo.zabbix.com/zabbix/2.4/rhel/6/x86_64/zabbix-release-2.4-1.el6.noarch.rpm rpm -ivh http://dl.fedoraproject.org/pub/epel/6/x86_64/epel-release-6-8.noarch.rpm yum install -y zabbix zabbix-get zabbix-server zabbix-web-mysql zabbix-web zabbix-agent yum install -y mysql-server ########################################################################################## # #2、配置MySQL # ########################################################################################## sed -i '/^symbolic-links=0/a character-set-server=utf8\ninnodb_file_per_table=1' /etc/my.cnf chkconfig mysqld on /etc/init.d/mysqld start mysqladmin -uroot password $mysql_root_pw mysql -h localhost -uroot -p$mysql_root_pw -e "create database zabbix character set utf8;" mysql -h localhost -uroot -p$mysql_root_pw -e "grant all privileges on zabbix.* to zabbix@localhost identified by '$mysql_zabbix_pw';" mysql -h localhost -uroot -p$mysql_root_pw -e "flush privileges;" #mysql -h localhost -uzabbix -p$mysql_zabbix_pw -Dzabbix < /usr/share/doc/zabbix-server-mysql-2.2.10/create/schema.sql #mysql -h localhost -uzabbix -p$mysql_zabbix_pw -Dzabbix < /usr/share/doc/zabbix-server-mysql-2.2.10/create/p_w_picpaths.sql #mysql -h localhost -uzabbix -p$mysql_zabbix_pw -Dzabbix < /usr/share/doc/zabbix-server-mysql-2.2.10/create/data.sql mysql -h localhost -uzabbix -p$mysql_zabbix_pw -Dzabbix < /usr/share/doc/zabbix-server-mysql-2.4.6/create/schema.sql mysql -h localhost -uzabbix -p$mysql_zabbix_pw -Dzabbix < /usr/share/doc/zabbix-server-mysql-2.4.6/create/p_w_picpaths.sql mysql -h localhost -uzabbix -p$mysql_zabbix_pw -Dzabbix < /usr/share/doc/zabbix-server-mysql-2.4.6/create/data.sql ########################################################################################## # #3、配置Zabbix # ########################################################################################## sed -i "/^# DBPassword=/a DBPassword=$DBPassword" /etc/zabbix/zabbix_server.conf sed -i "/^# CacheSize=8M/a CacheSize=$CacheSize" /etc/zabbix/zabbix_server.conf sed -i 's/# php_value date.timezone Europe\/Riga/php_value date.timezone Asia\/Shanghai/' /etc/httpd/conf.d/zabbix.conf cp /usr/share/zabbix/conf/zabbix.conf.php.example /etc/zabbix/web/zabbix.conf.php sed -i "10c \$DB[\"PASSWORD\"] = '$DBPassword';" /etc/zabbix/web/zabbix.conf.php sed -i "16c \$ZBX_SERVER_NAME = '$ZBX_SERVER_NAME';" /etc/zabbix/web/zabbix.conf.php chkconfig zabbix-server on chkconfig httpd on /etc/init.d/zabbix-server start /etc/init.d/httpd start iptables -I INPUT -m state --state NEW -p tcp --dport 10050 -j ACCEPT iptables -I INPUT -m state --state NEW -p tcp --dport 80 -j ACCEPT /etc/init.d/iptables save setenforce 0 sed -i 's/SELINUX=enforcing/SELINUX=permissive/' /etc/sysconfig/selinux
脚本安装zabbix2.4(#2.2),基于centos6.6 basic server
原创
©著作权归作者所有:来自51CTO博客作者www1707的原创作品,请联系作者获取转载授权,否则将追究法律责任
提问和评论都可以,用心的回复会被更多人看到
评论
发布评论
相关文章
-
zabbix2.4安装笔记
zabbix2.4安装笔记
安装 zabbix2.4