码迷,mamicode.com
首页 > 其他好文 > 详细

ipvsadm+keepalived+inotify-tools自动安装脚本

时间:2014-06-28 06:08:16      阅读:373      评论:0      收藏:0      [点我收藏+]

标签:inotify-tools、keepalived、rsync、自动安装、ipvsadm

#!/bin/bash
#
#
#this is install keepalived+lvs-DR
#
#
tar_dir=/usr/src
configure_yum()
{
	echo "[rhel-local]">/etc/yum.repos.d/rhel-local.repo
	echo "baseurl=file:///media/Server">>/etc/yum.repos.d/rhel-local.repo
	echo "enabled=1">>/etc/yum.repos.d/rhel-local.repo
	echo "gpgcheck=1">>/etc/yum.repos.d/rhel-local.repo
	echo "gpgkey=file:///etc/pki/rpm-gpg/RPM-GPG-KEY-redhat-release">>/etc/yum.repos.d/rhel-local.repo
	mount /dev/cdrom /media
}
install_keepalived()
{
	keepalived_dir=/usr/local/keepalived
	kernel=$(uname -r)
	yum install gcc gcc-c++ autoconf automake wget openssl-devel kernel-devel  -y
	cd /root/software	
	tar -zxf keepalived-*.tar.gz -C $tar_dir
	cd /usr/src/keepalived-*
	./configure --prefix=$keepalived_dir --sysconf=/etc --with-kernel-dir=/usr/src/kernels/$kernel*
	make && make install
	if [ $? -eq 0 ];then
		 echo "keepalived install is ok!!!"
	else
		 echo "keepalived install is no!!!"
            	 exit
        fi
}
configure_keepalived()
{
	cp /usr/local/keepalived/sbin/keepalived /usr/sbin
	cp /usr/local/keepalived/bin/genhash /usr/sbin/
	/etc/init.d/keepalived start
	chkconfig --add keepalived
	chkconfig keepalived on
}
install_ipvsadm()
{
	kernel=$(uname -r)
	ln -s /usr/src/kernels/$kernel* /usr/src/linux
	cd /root/software
	tar -zxf ipvsadm-*.tar.gz -C $tar_dir
	cd $tar_dir/ipvsadm-*
	make && make install

	if [ $? -eq 0 ];then
        	echo "ipvsadm install is ok!!!"
        else
                echo "ipvsadm install is no!!!"
                exit
        fi

}
install_inotify-tools()
{
	cd /root/software
	tar -zxf inotify-tools-* -C $tar_dir
	cd $tar_dir/inotify-tools-*
	./configure --prefix=/usr/local/inotify_tools
	make && make install
	
	if [ $? -eq 0 ];then
                echo "inotify-tools install is ok!!!"
        else
                echo "inotify-tools install is no!!!"
                exit
        fi

	cp /usr/local/inotify_tools/bin/inotifywait /usr/sbin/
	cp /usr/local/inotify_tools/bin/inotifywatch /usr/sbin/
}
configure_yum
install_keepalived
configure_keepalived
install_ipvsadm
install_inotify-tools


本文出自 “小杩的幸福生活” 博客,谢绝转载!

ipvsadm+keepalived+inotify-tools自动安装脚本,布布扣,bubuko.com

ipvsadm+keepalived+inotify-tools自动安装脚本

标签:inotify-tools、keepalived、rsync、自动安装、ipvsadm

原文地址:http://friendlinux.blog.51cto.com/6249249/1431378

(0)
(0)
   
举报
评论 一句话评论(0
登录后才能评论!
© 2014 mamicode.com 版权所有  联系我们:gaon5@hotmail.com
迷上了代码!