This guide will explain how to install etcd on RHEL / CentOS 8. Etcd is a simple, reliable, fast and secure open source key-value store written in Go. It uses the Raft consensus algorithm to manage a highly-available replicated log. The installation shared here is not for use in Production environments as it is on a single node (one member etcd).

Note: This is a single node cluster setup, for three node cluster, refer to the guide below.

Setup Etcd Cluster on Ubuntu/Debian/CentOS

Install etcd on RHEL / CentOS 8

Being written in Go, etcd is distributed as a binary package but installation from source is also available. In this guide, we’re going to download a pre-built binary package.

Ensure you have vim and wget installed on your RHEL / CentOS 8 server.

sudo dnf -y install curl vim

Step 1: Download Etcd binary

Check the latest release on releases page before you proceed to get the latest release tag.

export RELEASE="3.3.13"

Extract downloaded archive file.

tar xvf etcd-v${RELEASE}-linux-amd64.tar.gz

Change to new file directory

cd etcd-v${RELEASE}-linux-amd64

Move etcd and etcdctl binary files to /usr/local/bin directory.

sudo mv etcd etcdctl /usr/local/bin 

Confirm version.

$ etcd --version
etcd Version: 3.3.13
Git SHA: 98d3084
Go Version: go1.10.8
Go OS/Arch: linux/amd64

Step 2: Configure Etcd Systemd service

We’re going to use systemd to manage etcd service. First, create data directory for etcd.

sudo mkdir -p /var/lib/etcd/
sudo mkdir /etc/etcd

Create etcd system user

sudo groupadd --system etcd
sudo useradd -s /sbin/nologin --system -g etcd etcd

Set /var/lib/etcd/ directory ownership to etcd user.

sudo chown -R etcd:etcd /var/lib/etcd/

Configure Systemd and start etcd service

Create a new systemd service file for etcd.

 sudo vim /etc/systemd/system/etcd.service

Paste below contents to the file.

Description=etcd key-value store



Reload systemd service and start etcd on CentOS / RHEL system.

sudo systemctl daemon-reload
sudo systemctl start etcd.service

If you have SELinux running in enforcing mode, then generate a local policy module to allow access to data directories.

sudo ausearch -c '(etcd)' --raw | audit2allow -M my-etcd

To make this policy package active, execute:

sudo semodule -X 300 -i my-etcd.pp
sudo restorecon -Rv /usr/local/bin/etcd

Restart etcd service.

sudo systemctl restart etcd

Check service status to confirm it is running.

[[email protected] ~]# systemctl status etcd
 ● etcd.service - etcd key-value store
    Loaded: loaded (/etc/systemd/system/etcd.service; disabled; vendor preset: disabled)
    Active: active (running) since Fri 2019-03-22 22:38:07 EAT; 36s ago
  Main PID: 1938 (etcd)
     Tasks: 10 (limit: 11510)
    Memory: 3.7M
    CGroup: /system.slice/etcd.service
            └─1938 /usr/local/bin/etcd
 Mar 22 22:38:05 rhel8.local etcd[1938]: enabled capabilities for version 3.3
 Mar 22 22:38:07 rhel8.local etcd[1938]: 8e9e05c52164694d is starting a new election at term 2
 Mar 22 22:38:07 rhel8.local etcd[1938]: 8e9e05c52164694d became candidate at term 3
 Mar 22 22:38:07 rhel8.local etcd[1938]: 8e9e05c52164694d received MsgVoteResp from 8e9e05c52164694d at term 3
 Mar 22 22:38:07 rhel8.local etcd[1938]: 8e9e05c52164694d became leader at term 3
 Mar 22 22:38:07 rhel8.local etcd[1938]: raft.node: 8e9e05c52164694d elected leader 8e9e05c52164694d at term 3
 Mar 22 22:38:07 rhel8.local etcd[1938]: published {Name:992462394b1c4f2e80e7e2fd978f04f8 ClientURLs:[http://localhost:2379]} to cluster cdf818194e3a8c>
 Mar 22 22:38:07 rhel8.local etcd[1938]: ready to serve client requests
 Mar 22 22:38:07 rhel8.local systemd[1]: Started etcd key-value store.
 Mar 22 22:38:07 rhel8.local etcd[1938]: serving insecure client requests on, this is strongly discouraged!

The service will start on localhost address port 2379

$ ss -tunelp | grep 2379
tcp LISTEN 0 128* uid:998 ino:72981 sk:45c <->

$ etcdctl member list
8e9e05c52164694d: name=992462394b1c4f2e80e7e2fd978f04f8 peerURLs=http://localhost:2380 clientURLs=http://localhost:2379 isLeader=true

Step 3: Test Etcd Installation

Test your etcd installation on CentOS / RHEL 8 by writing to etcd.

$ etcdctl set /message "Hello World"
Hello World

Read the value of message back:

$ etcdctl get /message
Hello World

Create directory.

$ etcdctl mkdir /myservice
$ etcdctl set /myservice/container1 localhost:8080
$ etcdctl ls /myservice

To watch directory for changes, use:

$ etcdctl watch --recursive /myservice

To delete the key run:

$ etcdctl rm /message
PrevNode.Value: Hello World

$ etcdctl rm /myservice/container1
PrevNode.Value: localhost:8080

There you have it. Etcd has been installed on RHEL / CentOS 8 system. For the Ubuntu systems, check how to install etcd on Ubuntu.

Your support is our everlasting motivation,
that cup of coffee is what keeps us going!

As we continue to grow, we would wish to reach and impact more people who visit and take advantage of the guides we have on our blog. This is a big task for us and we are so far extremely grateful for the kind people who have shown amazing support for our work over the time we have been online.

Thank You for your support as we work to give you the best of guides and articles. Click below to buy us a coffee.


Please enter your comment!
Please enter your name here