Last active
June 10, 2019 17:23
-
-
Save Bubblemelon/3b36f3d32baa6e9957ffb471a74b53c1 to your computer and use it in GitHub Desktop.
Install/Update Golang version 1.12.5 on Fedora 28 and Later for arch x86_64
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/bin/bash | |
# To make this script executable, run: chmod u+x go-1.12.1-install.sh | |
# Will need to be executed as root user or with root privileges | |
# go command path: /usr/bin/go | |
# other dependencies | |
dnf install -y gcc | |
dnf install -y go-srpm-macros | |
# main dependencies for golang 1.12.1 | |
GOLANG_SRC="https://rpmfind.net/linux/fedora/linux/development/rawhide/Everything/x86_64/os/Packages/g/golang-src-1.12.5-1.fc31.noarch.rpm" | |
GOLANG_BIN="https://kojipkgs.fedoraproject.org/packages/golang/1.12.5/1.fc31/x86_64/golang-bin-1.12.5-1.fc31.x86_64.rpm" | |
GOLANG="https://kojipkgs.fedoraproject.org/packages/golang/1.12.5/1.fc31/x86_64/golang-1.12.5-1.fc31.x86_64.rpm" | |
# download rpm files | |
# https://stackoverflow.com/questions/592620/how-to-check-if-a-program-exists-from-a-bash-script | |
if hash wget 2>/dev/null; then | |
wget $GOLANG_SRC | |
wget $GOLANG_BIN | |
wget $GOLANG | |
else | |
curl -O $GOLANG_SRC | |
curl -O $GOLANG_BIN | |
curl -O $GOLANG | |
fi | |
# https://access.redhat.com/solutions/1189 | |
# upgrade or install verbosely with hash marks | |
echo "Installing Go version 1.12.5 -- assuming dependency files are the only ones named golang-* !" | |
rpm -Uvh golang-* | |
# test installation | |
go version | |
# Optional: setup go environment variables | |
# see all variables: go env | |
# | |
# echo 'export GOPATH=$HOME/go' >> ~/.bashrc | |
# echo 'export PATH=$PATH:$(go env GOPATH)/bin' >> ~/.bashrc |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment