Centos6.8编译安装keepalived-1.3.5步骤

前端之家收集整理的这篇文章主要介绍了Centos6.8编译安装keepalived-1.3.5步骤前端之家小编觉得挺不错的,现在分享给大家,也给大家做个参考。

Centos6.8编译安装keepalived-1.3.5步骤

keepalived-1.3.5 下载http://keepalived.org/software/keepalived-1.3.5.tar.gz

一 首先安装依赖和编译器

 
 
  • 1
  • 2
  • 3
  • 4
yum -y update kernel kernel-headers #升级内核 reboot #重新启动电脑 yum -y install gcc make kernel-devel yum -y install curl libnl3-devel iptables-devel libnfnetlink-devel ipset-devel openssl-devel net-snmp-devel

二 编译keepalived

  
  
  • 1
  • 2
  • 3
  • 4
  • #安装在/usr/local/keepalived目录 ./configure --prefix=/usr/local/keepalived \ --with-kernel-dir=/usr/src/kernels/`uname -r` make

    三 安装keepalived

      
      
  • 1
  • 2
  • 3
  • 4
  • 5
  • 6
  • 7
  • make install cp /usr/local/keepalived/etc/sysconfig/keepalived /etc/sysconfig/ mkdir /etc/keepalived ln -s /usr/local/keepalived/sbin/keepalived /usr/sbin/ touch /etc/init.d/keepalived chmod +x /etc/init.d/keepalived vi /etc/init.d/keepalived

    keepalived脚本内容如下

      
      
  • 1
  • 2
  • 3
  • 4
  • 5
  • 6
  • 7
  • 8
  • 9
  • 10
  • 11
  • 12
  • 13
  • 14
  • 15
  • 16
  • 17
  • 18
  • 19
  • 20
  • 21
  • 22
  • 23
  • 24
  • 25
  • 26
  • 27
  • 28
  • 29
  • 30
  • 31
  • 32
  • 33
  • 34
  • 35
  • 36
  • 37
  • 38
  • 39
  • 40
  • 41
  • 42
  • 43
  • 44
  • 45
  • 46
  • 47
  • 48
  • 49
  • 50
  • 51
  • 52
  • 53
  • 54
  • 55
  • 56
  • 57
  • 58
  • 59
  • 60
  • 61
  • 62
  • 63
  • 64
  • 65
  • 66
  • 67
  • 68
  • 69
  • 70
  • 71
  • 72
  • 73
  • 74
  • 75
  • 76
  • 77
  • 78
  • 79
  • 80
  • 81
  • 82
  • 83
  • 84
  • 85
  • 86
  • 87
  • 88
  • 89
  • 90
  • 91
  • 92
  • 93
  • 94
  • 95
  • 96
  • 97
  • 98
  • 99
  • 100
  • 101
  • 102
  • 103
  • 104
  • 105
  • 106
  • 107
  • 108
  • 109
  • #!/bin/sh # # keepalived High Availability monitor built upon LVS and VRRP # chkconfig: - 86 14 # description: Robust keepalive facility to the Linux Virtual Server project \ # with multilayer TCP/IP stack checks. ### BEGIN INIT INFO # Provides: keepalived # required-Start: $local_fs $network $named $syslog # required-Stop: $local_fs $network $named $syslog # Should-Start: smtpdaemon httpd # Should-Stop: smtpdaemon httpd # Default-Start: # Default-Stop: 0 1 2 3 4 5 6 # Short-Description: High Availability monitor built upon LVS and VRRP # Description: Robust keepalive facility to the Linux Virtual Server # project with multilayer TCP/IP stack checks. ### END INIT INFO # Source function library. . /etc/rc.d/init.d/functions exec="/usr/sbin/keepalived" prog="keepalived" config="/etc/keepalived/keepalived.conf" [ -e /etc/sysconfig/$prog ] && . /etc/sysconfig/$prog lockfile=/var/lock/subsys/keepalived start() { [ -x $exec ] || exit 5 [ -e $config ] || 6 echo -n $"Starting $prog: " daemon $exec $KEEPALIVED_OPTIONS retval=$? echo [ $retval -eq 0 ] && touch $lockfile return $retval } stop() { "Stopping $prog: " killproc $prog retval=$? 0 ] && rm -f $retval } restart() { stop start } reload() { "Reloading $prog -1 retval=$? echo $retval } force_reload() { restart } rh_status() { status $prog } rh_status_q() { rh_status &>/dev/null } case "$1" in start) rh_status_q && 0 $1 ;; stop) rh_status_q || $1 ;; restart) $1 ;; reload) rh_status_q || 7 $1 ;; force-reload) force_reload ;; status) rh_status ;; condrestart|try-restart) rh_status_q || 0 restart ;; *) echo $"Usage: $0 {start|stop|status|restart|condrestart|try-restart|reload|force-reload}" 2 esac exit $?

    四 配置和运行keepalived

      
      
  • 1
  • 2
  • 3
  • 4
  • vi /etc/keepalived/keepalived.conf #配置正确 chkconfig --add keepalived chkconfig keepalived on service keepalived start

    五 查看keepalived运行日志

    more /var/log/messages |grep -E "\\[" |grep keepalived
    原文链接:https://www.f2er.com/centos/375744.html

    猜你在找的CentOS相关文章