Last active
April 28, 2023 20:13
-
-
Save benoitpetit/dea0f6e5b97ffc71f9d32856ec993670 to your computer and use it in GitHub Desktop.
golang installation script for fedora
This file contains 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
import os | |
# Request the version to be installed | |
print("check here => https://go.dev/dl/") | |
version = input("Which version of Golang do you want to install? ") | |
# Downloading and installing Golang | |
os.system(f"sudo dnf install -y wget") | |
os.system(f"wget https://golang.org/dl/go{version}.linux-amd64.tar.gz") | |
os.system(f"sudo tar -C /usr/local -xzf go{version}.linux-amd64.tar.gz") | |
# Configuration of the environment | |
os.system(f"echo 'export PATH=$PATH:/usr/local/go/bin' >> ~/.bashrc") | |
os.system(f"echo 'export GOPATH=$HOME/go' >> ~/.bashrc") | |
os.system(f"echo 'export PATH=$PATH:$GOPATH/bin' >> ~/.bashrc") | |
os.system(f"source ~/.bashrc") | |
# Check installation | |
os.system(f"if go version; then echo 'Go is installed'; fi") |
This file contains 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
import os | |
# Request the version to be installed | |
print("check here => https://go.dev/dl/") | |
version = input("Which version of Golang do you want to install? ") | |
# Downloading and installing Golang | |
os.system(f"sudo apt update") | |
os.system(f"wget https://golang.org/dl/go{version}.linux-amd64.tar.gz") | |
os.system(f"sudo tar -C /usr/local -xzf go{version}.linux-amd64.tar.gz") | |
# Configuration of the environment | |
os.system(f"echo 'export PATH=$PATH:/usr/local/go/bin' >> ~/.bashrc") | |
os.system(f"echo 'export GOPATH=$HOME/go' >> ~/.bashrc") | |
os.system(f"echo 'export PATH=$PATH:$GOPATH/bin' >> ~/.bashrc") | |
os.system(f"source ~/.bashrc") | |
# Check installation | |
os.system(f"if go version; then echo 'Go est installé'; fi") |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment