Pacemaker and Corosync is one of the mostly used high availability cluster stack. pcs or Pacemaker/Corosync Configuration System on the other hand is a tool to easily configure both Pacemaker and Corosync.

Pacemaker, Corosync and pcs are all available in Ubuntu and Debian default apt repository, and can easily be installed and configured at the terminal.

Steps to install Pacemaker, Corosync and pcs on Ubuntu or Debian:

  1. Open terminal application.
  2. Update apt's package list from the repository.

    $ sudo apt update [sudo] password for user: Hit:1 http://jp.archive.ubuntu.com/ubuntu focal InRelease Get:2 http://jp.archive.ubuntu.com/ubuntu focal-updates InRelease [111 kB] Get:3 http://jp.archive.ubuntu.com/ubuntu focal-backports InRelease [98.3 kB] Get:4 http://jp.archive.ubuntu.com/ubuntu focal-security InRelease [107 kB] Get:5 http://jp.archive.ubuntu.com/ubuntu focal-updates/main amd64 Packages [255 kB] Get:6 http://jp.archive.ubuntu.com/ubuntu focal-updates/universe amd64 Packages [132 kB] Fetched 704 kB in 2s (322 kB/s) Reading package lists... Done Building dependency tree Reading state information... Done All packages are up to date.

  3. Install pacemaker, corosync and pcs packages using apt.

    $ sudo apt install --assume-yes pacemaker corosync pcs Reading package lists... Done Building dependency tree Reading state information... Done The following additional packages will be installed:   cluster-glue crmsh fonts-dejavu-core fonts-lato fonts-liberation javascript-common libcfg7 libcib27 libcmap4 libcorosync-common4 libcpg4 libcrmcluster29 libcrmcommon34 libcrmservice28 libjs-jquery libknet1 liblrm2 liblrmd28 libmysqlclient21 libnet1   libnl-route-3-200 libnozzle1 libnspr4 libnss3 libopenhpi3 libopenipmi0 libpacemaker1 libpe-rules26 libpe-status28 libpils2 libplumb2 libplumbgpl2 libqb-dev libqb0 libquorum5 libruby2.7 libsensors-config libsensors5 libsnmp-base libsnmp35   libstatgrab10 libstonith1 libstonithd26 libtimedate-perl libvotequorum8 libxml2-utils mysql-common net-tools openhpid pacemaker-cli-utils pacemaker-common pacemaker-resource-agents python3-bs4 python3-dateutil python3-html5lib python3-lxml   python3-parallax python3-pycurl python3-soupsieve python3-tornado python3-webencodings rake resource-agents ruby ruby-backports ruby-ethon ruby-ffi ruby-mime-types ruby-mime-types-data ruby-minitest ruby-mustermann ruby-net-telnet ruby-open4   ruby-power-assert ruby-rack ruby-rack-protection ruby-sinatra ruby-test-unit ruby-tilt ruby-xmlrpc ruby2.7 rubygems-integration unzip xsltproc zip Suggested packages:   ipmitool csync2 ocfs2-tools sbd vim-addon-manager apache2 | lighttpd | httpd libqb-doc lm-sensors snmp-mibs-downloader fence-agents python3-genshi python3-lxml-dbg python-lxml-doc libcurl4-gnutls-dev python-pycurl-doc python3-pycurl-dbg   python-tornado-doc python3-googleapi ri ruby-dev bundler The following NEW packages will be installed:   cluster-glue corosync crmsh fonts-dejavu-core fonts-lato fonts-liberation javascript-common libcfg7 libcib27 libcmap4 libcorosync-common4 libcpg4 libcrmcluster29 libcrmcommon34 libcrmservice28 libjs-jquery libknet1 liblrm2 liblrmd28   libmysqlclient21 libnet1 libnl-route-3-200 libnozzle1 libnspr4 libnss3 libopenhpi3 libopenipmi0 libpacemaker1 libpe-rules26 libpe-status28 libpils2 libplumb2 libplumbgpl2 libqb-dev libqb0 libquorum5 libruby2.7 libsensors-config libsensors5   libsnmp-base libsnmp35 libstatgrab10 libstonith1 libstonithd26 libtimedate-perl libvotequorum8 libxml2-utils mysql-common net-tools openhpid pacemaker pacemaker-cli-utils pacemaker-common pacemaker-resource-agents pcs python3-bs4 python3-dateutil   python3-html5lib python3-lxml python3-parallax python3-pycurl python3-soupsieve python3-tornado python3-webencodings rake resource-agents ruby ruby-backports ruby-ethon ruby-ffi ruby-mime-types ruby-mime-types-data ruby-minitest ruby-mustermann   ruby-net-telnet ruby-open4 ruby-power-assert ruby-rack ruby-rack-protection ruby-sinatra ruby-test-unit ruby-tilt ruby-xmlrpc ruby2.7 rubygems-integration unzip xsltproc zip 0 upgraded, 88 newly installed, 0 to remove and 0 not upgraded. Need to get 20.9 MB of archives. After this operation, 90.3 MB of additional disk space will be used.

  4. Make sure pcsd service is started.

    $ sudo systemctl start pcsd

  5. Configure pacemaker, corosync and pcsd services to automatically start during system boot.

    $ sudo systemctl enable pacemaker corosync pcsd Synchronizing state of pacemaker.service with SysV service script with /lib/systemd/systemd-sysv-install. Executing: /lib/systemd/systemd-sysv-install enable pacemaker Synchronizing state of corosync.service with SysV service script with /lib/systemd/systemd-sysv-install. Executing: /lib/systemd/systemd-sysv-install enable corosync Synchronizing state of pcsd.service with SysV service script with /lib/systemd/systemd-sysv-install. Executing: /lib/systemd/systemd-sysv-install enable pcsd

  6. Configure password for hacluster user.

    $ sudo passwd hacluster New password: Retype new password: passwd: password updated successfully

  7. Configure firewall rules for required ports using ufw (optional, if firewall is enabled).

    $ sudo ufw allow 2224,3121,21064/tcp Rules updated Rules updated (v6) $ sudo ufw allow 5405/udp Rules updated Rules updated (v6) $ sudo ufw reload Firewall not enabled (skipping reload)

  8. Proceed with Pacemaker cluster configuration.