Skip to content

Instantly share code, notes, and snippets.

@mttjohnson
Last active August 20, 2020 09:28
Show Gist options
  • Save mttjohnson/9ace6fdb55930dd176225e5b553e2e13 to your computer and use it in GitHub Desktop.
Save mttjohnson/9ace6fdb55930dd176225e5b553e2e13 to your computer and use it in GitHub Desktop.
Install Restic on CentOS
# Dependencies
yum install curl jq git golang
# Optional Yum Repo for Newer Go Version
# https://go-repo.io/
rpm --import https://mirror.go-repo.io/centos/RPM-GPG-KEY-GO-REPO
curl -s https://mirror.go-repo.io/centos/go-repo.repo | tee /etc/yum.repos.d/go-repo.repo
yum install golang
# Define Variables
REPO_DIR="restic"
REPO="restic/restic"
# Get latest release from github using API and extract latest release tag_name
LATEST_RELEASE=$(curl -s "https://api.github.com/repos/${REPO}/releases/latest" | jq --raw-output '.tag_name')
# Clone latest branch from github
git clone --branch ${LATEST_RELEASE} --single-branch https://github.com/${REPO}.git ${REPO_DIR}
# Build Restic Binary / Install / Cleanup
cd ${REPO_DIR}
go run build.go
mv ./restic /usr/bin/
cd ../
rm -rf ./${REPO_DIR}
# Display installed restic version
restic version
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment