Get the App
SLTechnology News&Howtos  ›  Network Security  › 

Keepalived compilation and installation

Shulou Source: shulou.com Published: 2022-06-01 10:23:35 10月02日 Update

Compile and install keepalived

Install keepalived 1.2.6 first using source code

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

If the keepalived you set up is installed to / usr/local/keepalived, all configuration files are located in this directory. One problem I haven't figured out is that Linux always installs programs in the / usr/local directory by default, and all programs share the / usr/local/sbin directory. This has an impact on some people's operating habits. Why not consider using a separate directory for each software?

1. Create a service startup script to control it using the service command

Cp / usr/local/keepalived/etc/rc.d/init.d/keepalived / etc/init.d/keepalived

Chmod+x / etc/init.d/keepalived

Because we use a non-default path (/ usr/local) to install keepalived, we need to modify several paths to ensure that keepalived can start properly. The files that need to be modified are as follows:

two。 Modify / etc/init.d/keepalived, look for about 15 lines of. / etc/sysconfig/keepalived, change to:

. / usr/local/keepalived/etc/sysconfig/keepalived, that is, point to the correct file location

Also add the following under the above line (import the path of the keepavlied main program into the environment variable PATH):

PATH= "$PATH:/usr/local/keepalived/sbin"

ExportPATH

3. Modify the / usr/local/keepalived/etc/sysconfig/keepalived file to set the correct service startup parameters

KEEPALIVED_OPTIONS= "- D-f/usr/local/keepalived/etc/keepalived/keepalived.conf"

4. After the above modifications, the basic installation of keepalived can be completed, and start the test:

Service keepalived restart

5. Don't forget to set this service to boot

Chkconfigkeepalived on

Tags: Files directories paths services programs compilers main programs locations contents parameters variables at the same time commands locations points source code environment scripts software problems Apple Docker Huawei Linux macOS MariaDB Microsoft MySQL NVidia OPPO Reno Docker Linux Huawei vpn Apple