#!/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
时间: 2024-10-12 01:13:57