How to Install Keepalived on Ubuntu 18.04


Easily deploy your favorite applications in seconds at an unbeatable price for your next projects.

Installing Keepalived on Ubuntu 18.04

Keepalived is a routing software suite for Linux that provides high availability (HA) for Linux systems by monitoring health, automatically failing over, and load balancing multiple servers or network links.

To install Keepalived on Ubuntu 18.04, you can follow these steps:

sudo apt update
sudo apt install keepalived

After installation, you need to configure Keepalived according to your specific needs. The main configuration file for Keepalived is located at /etc/keepalived/keepalived.conf. You can edit this file using a text editor of your choice, such as nano or vim.

Here is a minimal example configuration to get you started:

! Configuration File for keepalived

vrrp_script chk_nginx {
    script "/etc/keepalived/nginx_check.sh"
    interval 2
    weight -3

vrrp_instance VI_1 {
    state MASTER
    interface eth0
    virtual_router_id 51
    priority 101
    unicast_peer {
    virtual_ipaddress {
    authentication {
        auth_type PASS
        auth_pass MySecretPassword
    track_script {

In this example, we define a VRRP instance named VI_1. It is set to achieve high availability for an NGINX web server. The script "/etc/keepalived/nginx_check.sh" is used to check if NGINX is running. The virtual IP address is assigned to the Master node (priority 101) and will automatically failover to the Backup node if the Master node becomes unavailable.

After making the necessary configuration changes, you can restart Keepalived to apply the new configuration:

sudo systemctl restart keepalived
  1. Update the system's package index:
  2. Install Keepalived:
  3. Configure Keepalived:
  4. Restart Keepalived:

You have now successfully installed and configured Keepalived on Ubuntu 18.04. Keepalived will monitor the health of your servers or network links and failover if necessary, providing high availability for your Linux systems.

Refer A Friend
Get $25

Installing Keepalived
Keepalived installation
Keepalived Ubuntu 18.04
how to install Keepalived
Keepalived setup
Keepalived installation guide
Keepalived tutorial
Ubuntu 18.04 Keepalived installation
keepalived configuration Ubuntu 18.04
keepalived installation steps

Why Customers Love Us

What our customers say about us

Ready To Get Started For Free?

Create your free account today.