您好,登錄后才能下訂單哦!
使用源碼先安裝keepalived 1.2.6
cd/usr/local/src
wget http://www.keepalived.org/software/keepalived-1.2.6.tar.gz
tarzxf keepalived-1.2.6.tar.gz
cdkeepalived-1.2.6
./configure--prefix=/usr/local/keepalived
make
makeinstall
所設keepalived安裝到/usr/local/keepalived,則所有配置文件均位于此目錄之下。我一直沒搞明白一個問題,Linux默認總是將程序安裝到/usr/local目錄下,所有程序共享了/usr/local/sbin目錄。這對一些人的操作習慣是有影響的。為何不考慮使用每個軟件一個獨立的目錄呢?
1. 建立服務啟動腳本,以便使用service命令控制之
cp /usr/local/keepalived/etc/rc.d/init.d/keepalived /etc/init.d/keepalived
chmod+x /etc/init.d/keepalived
因為我們使用非默認路徑(/usr/local)安裝keepalived, 故需要修改幾處路徑,以保證keepalived能正常啟動, 需要修改的文件如下:
2. 修改/etc/init.d/keepalived,尋找大約15行左右的./etc/sysconfig/keepalived, 修改為:
. /usr/local/keepalived/etc/sysconfig/keepalived, 即指向正確的文件位置
同時在上述行下添加以下內容(將keepavlied主程序所在路徑導入到環境變量PATH中):
PATH="$PATH:/usr/local/keepalived/sbin"
exportPATH
3. 修改/usr/local/keepalived/etc/sysconfig/keepalived文件,設置正確的服務啟動參數
KEEPALIVED_OPTIONS="-D -f/usr/local/keepalived/etc/keepalived/keepalived.conf"
4. 經過以上修改,keepalived基本安裝即可完成,啟動測試之:
service keepalived restart
5. 切勿忘記將此服務設置為開機啟動
chkconfigkeepalived on
免責聲明:本站發布的內容(圖片、視頻和文字)以原創、轉載和分享為主,文章觀點不代表本網站立場,如果涉及侵權請聯系站長郵箱:is@yisu.com進行舉報,并提供相關證據,一經查實,將立刻刪除涉嫌侵權內容。