Skip to content

Instantly share code, notes, and snippets.

@mattmattox
Last active April 24, 2021 15:41
Show Gist options
  • Save mattmattox/b36a7926052e0b10fd527c7d4b868a13 to your computer and use it in GitHub Desktop.
Save mattmattox/b36a7926052e0b10fd527c7d4b868a13 to your computer and use it in GitHub Desktop.
Install etcd server
ETCD_VER=v3.4.15
GITHUB_URL=https://github.com/etcd-io/etcd/releases/download
DOWNLOAD_URL=${GITHUB_URL}
rm -f /tmp/etcd-${ETCD_VER}-linux-amd64.tar.gz
rm -rf /tmp/etcd-download-test && mkdir -p /tmp/etcd-download-test
curl -L ${DOWNLOAD_URL}/${ETCD_VER}/etcd-${ETCD_VER}-linux-amd64.tar.gz -o /tmp/etcd-${ETCD_VER}-linux-amd64.tar.gz
tar xzvf /tmp/etcd-${ETCD_VER}-linux-amd64.tar.gz -C /tmp/etcd-download-test --strip-components=1
rm -f /tmp/etcd-${ETCD_VER}-linux-amd64.tar.gz
/tmp/etcd-download-test/etcd --version
ETCDCTL_API=3 /tmp/etcd-download-test/etcdctl version
mv /tmp/etcd-download-test/etcd /usr/local/bin
mv /tmp/etcd-download-test/etcdctl /usr/local/bin
mkdir -p /etc/etcd/
cat << EOF > etcd.service
[Unit]
Description=etcd key-value store
Documentation=https://github.com/etcd-io/etcd
After=network.target
[Service]
Type=notify
EnvironmentFile=/etc/etcd/etcd.conf
ExecStart=/usr/local/bin/etcd
Restart=always
RestartSec=10s
LimitNOFILE=40000
[Install]
WantedBy=multi-user.target
EOF
mv etcd.service /etc/systemd/system/etcd.service
systemctl daemon-reload
systemctl enable etcd
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment