To install etcd from the official Debian/Ubuntu apt repositories:
You can check the version installed and the latest available version. If the version installed is out of date and you want to install the latest one, use the prebuilt binaries method.
RedHat-compatible packages
The PGDG yum extras repositories contains etcd packages.
Depending on your system, enable the following repositories:
RHEL 9: pgdg-rhel9-extras
RHEL 8: pgdg-rhel8-extras
RHEL 7: pgdg-rhel7-extras
For example, this command installs etcd on RHEL 8:
You can check the version installed and the latest available version. If the version installed is out of date and you want to install the latest one, use the prebuilt binaries method.
Prebuilt binaries
These commands output the version of the installed etcd binary and get the latest version from the etcd-io website:
The easiest way to install the etcd latest release is from prebuilt binaries.
On amd64 hosts, use the following commands:
Then, create the data directory and system user:
Configure the systemd unit file:
Configuration
Configure the firewall if needed:
To configure and create a new etcd cluster, you need to define the initial cluster configuration by setting the ETCD_INITIAL_CLUSTER variable. That list must contain all the etcd hosts and their IP addresses.
This example shows three etcd hosts:
To fetch it dynamically, you can use this simple shell script, where etcd1 etcd2 etcd3 are the three etcd hosts:
Then, set up the local etcd configuration and start the service:
Note
When using the prebuilt binaries method or the Red Hat-compatible packages, the configuration file is /etc/etcd/etcd.conf. When using the Debian/Ubuntu packages, the configuration file is /etc/default/etcd.
Start the service and listen on ports 2379 and 2380. Check the cluster status: