Pada kesempatan kali ini kami akan berbagi bagaimana cara melakukan instalasi HAProxy menggunakan repository default dari CentOS 7.

Versi HAProxy yang ada pada repository default CentOS 7 yaitu versi 1.5.18.

Sebelum ke tahapan instalasi kami harapkan Anda sudah mengerti terkait pengenalan dasar tentang HAProxy yang dapat Anda ketahui melalui link berikut: Pengenalan Dasar HAProxy

Berikut ini tahapan - tahapan untuk instalasinya:

  1. Akses server Anda masing - masing. Di sini kami menggunakan CentOS 7
  2. Lakukan update pada CentOS 7 Anda gunakan perintah berikut:

    [[email protected] ~]# 
    [[email protected] ~]# yum update -y
  3. Memeriksa versi dan ketersediaan HAProxy berikut perintahnya

    [[email protected] ~]#
    [[email protected] ~]# yum info haproxy
    Failed to set locale, defaulting to C
    Loaded plugins: fastestmirror
    Loading mirror speeds from cached hostfile
    * base:
    * extras: 
    * updates:
    Available Packages
    Name        : haproxy
    Arch        : x86_64
    Version     : 1.5.18
    Release     : 9.el7
    Size        : 834 k
    Repo        : base/7/x86_64
    Summary     : TCP/HTTP proxy and load balancer for high availability environments      
    URL         :
    License     : GPLv2+
    Description : HAProxy is a TCP/HTTP reverse proxy which is particularly suited for high
            : availability environments. Indeed, it can:
            :  - route HTTP requests depending on statically assigned cookies
            :  - spread load among several servers while assuring server persistence   
            :    through the use of HTTP cookies
            :  - switch to backup servers in the event a main server fails
            :  - accept connections to special ports dedicated to service monitoring   
            :  - stop accepting connections without breaking existing ones
            :  - add, modify, and delete HTTP headers in both directions
            :  - block requests matching particular patterns
            :  - report detailed status to authenticated users from a URI
            :    intercepted by the application
    [[email protected] ~]# 
  4. Untuk instalasi HAProxy gunakan satu baris perintah berikut

    [[email protected] ~]#
    [[email protected] ~]# yum install haproxy   
    Failed to set locale, defaulting to C
    Loaded plugins: fastestmirror
    Loading mirror speeds from cached hostfile
    * base:   
    * extras: 
    * updates:
    Resolving Dependencies
    --> Running transaction check
    ---> Package haproxy.x86_64 0:1.5.18-9.el7 will be installed
    --> Finished Dependency Resolution
    Dependencies Resolved
    ====================================================================================================== Package                Arch                  Version                       Repository           Size 
    haproxy                x86_64                1.5.18-9.el7                  base                834 k 
    Transaction Summary
    ======================================================================================================Install  1 Package
    Total download size: 834 k
    Installed size: 2.6 M
    Is this ok [y/d/N]: y 
    Downloading packages:
    haproxy-1.5.18-9.el7.x86_64.rpm                                                | 834 kB  00:00:00     
    Running transaction check
    Running transaction test
    Transaction test succeeded
    Running transaction
    Installing : haproxy-1.5.18-9.el7.x86_64                                                        1/1 
    Verifying  : haproxy-1.5.18-9.el7.x86_64                                                        1/1 
    haproxy.x86_64 0:1.5.18-9.el7
    [[email protected] ~]# 
  5. Untuk melihat versi HAProxy yang sudah berhasil di install gunakan perintah

    [[email protected] ~]#
    [[email protected] ~]# haproxy -v            
    HA-Proxy version 1.5.18 2016/05/10
    Copyright 2000-2016 Willy Tarreau <[email protected]>
    [[email protected] ~]#
  6. Mengaktifkan (running) HAProxy jalankan perintah berikut

    [[email protected] ~]# 
    [[email protected] ~]# systemctl start haproxy
    [[email protected] ~]# systemctl enable haproxy
    Created symlink from /etc/systemd/system/ to /usr/lib/systemd/system/haproxy.service.
    [[email protected] ~]# 
  7. Untuk melihat status HAProxy gunakan perintah berikut

    [[email protected] ~]#
    [[email protected] ~]# systemctl status haproxy
    ● haproxy.service - HAProxy Load Balancer
    Loaded: loaded (/usr/lib/systemd/system/haproxy.service; enabled; vendor preset: disabled)
    Active: active (running) since Sat 2019-11-16 18:56:54 UTC; 2min 20s ago
    Main PID: 15147 (haproxy-systemd)
    CGroup: /system.slice/haproxy.service
           ├─15147 /usr/sbin/haproxy-systemd-wrapper -f /etc/haproxy/haproxy.cfg -p /run/
           ├─15148 /usr/sbin/haproxy -f /etc/haproxy/haproxy.cfg -p /run/ -Ds
           └─15149 /usr/sbin/haproxy -f /etc/haproxy/haproxy.cfg -p /run/ -Ds
    Nov 16 18:56:54 nur-srv-lb.novalocal systemd[1]: Started HAProxy Load Balancer.
    [[email protected] ~]#

Saat ini instalasi HAProxy menggunkana repository default CentOS 7 telah berhasil di lakukan.

Selamat Mencoba semoga bermanfaat !

See You >.<