wget https://storage.googleapis.com/golang/go1.7.linux-armv6l.tar.gz
tar -C /usr/local -xzf go1.7.linux-armv6l.tar.gz
export PATH=$PATH:/usr/local/go/bin
-
-
Save simoncos/49463a8b781d63b5fb8a3b666e566bb5 to your computer and use it in GitHub Desktop.
Ok, i have tried to install go (golang) but these short instructions do not help me.
May you can give me a simple short instruction what to write wehre. I guess i have to modifi .profile but how?!?
I get really confused because I only see wenn using "go env" : GOBIN = "", GOEXE="", GOPATH="", GOROOT="/home/pi/go" but i cannot change GOPATH.
So please be so kind and give some more information than only 3 single lines for some really studip or new raspberrypi people.
I try to learn but so far I miss a good explanation or skript from all the experts.
After running the wget and tar commands from @simoncos posting I add these two lines to the end of my ~/.bashrc, logout and then login again and go is then available
export GOPATH=$HOME/go
export PATH=$PATH:/usr/local/go/bin
@leemcloughlin you need not logout and back in; you can simply run source ~/.bashrc after making modifications to load them into your current shell session
To install golang 1.10 (or whatever the latest version is at the time anyone is reading this):
wget https://storage.googleapis.com/golang/go1.10.linux-armv6l.tar.gz
sudo tar -C /usr/local -xvf go1.10.linux-armv6l.tar.gz
cat >> ~/.bashrc << 'EOF'
export GOPATH=$HOME/go
export PATH=/usr/local/go/bin:$PATH:$GOPATH/bin
EOF
source ~/.bashrc
Run go version to check and you should see output of: go version g1.10 linux/arm also this preserves /usr/bin/go is you installed it previously.
1.10.1 is released.
wget https://storage.googleapis.com/golang/go1.10.1.linux-armv6l.tar.gz
sudo tar -C /usr/local -xvf go1.10.1.linux-armv6l.tar.gz
cat >> ~/.bashrc << 'EOF'
export GOPATH=$HOME/go
export PATH=/usr/local/go/bin:$PATH:$GOPATH/bin
EOF
source ~/.bashrcTo summarize (and learn md formatting):
1. Look up the most recent go version:
ctrl+farmv6
Seems like 1.10.2 just came out!
2. Copy the download link:
https://dl.google.com/go/go1.10.2.linux-armv6l.tar.gz
3. Paste the following, line by line:
wget https://dl.google.com/go/go1.10.2.linux-armv6l.tar.gz
sudo tar -C /usr/local -xvf go1.10.2.linux-armv6l.tar.gz
cat >> ~/.bashrc << 'EOF'
export GOPATH=$HOME/go
export PATH=/usr/local/go/bin:$PATH:$GOPATH/bin
EOF
source ~/.bashrc
go version
If wget fails with an error like this, your server time might be wrong:
ERROR: The certificate of ‘dl.google.com’ is not trusted.
ERROR: The certificate of ‘dl.google.com’ is not yet activated.
The certificate has not yet been activated.
To check your server time, enter
date
You can set the time manually:
date -s "17 MAY 2018 14:32:56"
If everything else fails, you can also give up and install go with Go Version Manager (gvm).
This will work for the latest version (until google change the urls):
url=`curl https://golang.org/dl/ | grep armv6l | sort --version-sort | tail -1 | grep -o -E https://dl.google.com/go/go[0-9]+\.[0-9]+((\.[0-9]+)?).linux-armv6l.tar.gz`
wget ${url}
sudo tar -C /usr/local -xvf `echo ${url} | cut -d '/' -f5`
cat >> ~/.bashrc << 'EOF'
export GOPATH=$HOME/go
export PATH=/usr/local/go/bin:$PATH:$GOPATH/bin
EOF
source ~/.bashrc
Thanks for sharing, it worked fine.
What's wrong with apt-get golang?
I think apt-get golang installs 1.7 by default @emelendez89
unfortunatly sudo apt-get install golang installs v1.11 but latest version is v1.12.9 since February 2019!
Don't know why they didn't update the package list für APT commands?!
This will work for the latest version (until google change the urls):
url=`curl https://golang.org/dl/ | grep armv6l | sort --version-sort | tail -1 | grep -o -E https://dl.google.com/go/go[0-9]+\.[0-9]+((\.[0-9]+)?).linux-armv6l.tar.gz` wget ${url} sudo tar -C /usr/local -xvf `echo ${url} | cut -d '/' -f5` cat >> ~/.bashrc << 'EOF' export GOPATH=$HOME/go export PATH=/usr/local/go/bin:$PATH:$GOPATH/bin EOF source ~/.bashrc
Didn't work for me, so here's the fixed version that did work for me:
url=$(curl https://golang.org/dl/ | grep armv6l | sort --version-sort | tail -1 | grep -o -E "https://dl.google.com/go/go[0-9]+\.[0-9]+((\.[0-9]+)?).linux-armv6l.tar.gz")
archive_name=$(echo ${url} | cut -d '/' -f5)
wget ${url}
sudo tar -C /usr/local -xvf ${archive_name}
cat >> ~/.bashrc << 'EOF'
export GOPATH=$HOME/go
export PATH=/usr/local/go/bin:$PATH:$GOPATH/bin
EOF
rm ${archive_name}
source ~/.bashrc
A warm welcome!
I've tried to install go on my Raspberry4.
on executing "go version" I receive an: "cannot execute binary file: Exec format error"
Any ideas?
I sorted that out. The arm64 is the wrong version. v6l is appropriate!
https://golang.org/dl/
https://dl.google.com/go/go1.13.4.linux-armv6l.tar.gz@gitroli1220 Download this one.
Oh thanks, page reload world have helped me out earlier :)
Current corrected version of the script
url='https://golang.org'$(curl https://golang.org/dl/ | grep armv6l | sort --version-sort | tail -1 | grep -o -E "/dl/go[0-9]+\.[0-9]+((\.[0-9]+)?).linux-armv6l.tar.gz")
archive_name=$(echo ${url} | cut -d '/' -f5)
wget ${url}
sudo tar -C /usr/local -xvf ${archive_name}
cat >> ~/.bashrc << 'EOF'
export GOPATH=$HOME/go
export PATH=/usr/local/go/bin:$PATH:$GOPATH/bin
EOF
rm ${archive_name}
source ~/.bashrcCurrent corrected version of the script
url='https://golang.org'$(curl https://golang.org/dl/ | grep armv6l | sort --version-sort | tail -1 | grep -o -E "/dl/go[0-9]+\.[0-9]+((\.[0-9]+)?).linux-armv6l.tar.gz") archive_name=$(echo ${url} | cut -d '/' -f5) wget ${url} sudo tar -C /usr/local -xvf ${archive_name} cat >> ~/.bashrc << 'EOF' export GOPATH=$HOME/go export PATH=/usr/local/go/bin:$PATH:$GOPATH/bin EOF rm ${archive_name} source ~/.bashrc
Just did it on my Pi 4 and it worked perfectly. Thanks.
Current corrected version of the script
url='https://golang.org'$(curl https://golang.org/dl/ | grep armv6l | sort --version-sort | tail -1 | grep -o -E "/dl/go[0-9]+\.[0-9]+((\.[0-9]+)?).linux-armv6l.tar.gz") archive_name=$(echo ${url} | cut -d '/' -f5) wget ${url} sudo tar -C /usr/local -xvf ${archive_name} cat >> ~/.bashrc << 'EOF' export GOPATH=$HOME/go export PATH=/usr/local/go/bin:$PATH:$GOPATH/bin EOF rm ${archive_name} source ~/.bashrc
... works on Pi Zero too.
@simoncos Change
sudo apt remove golangtosudo apt remove golang*. When I installedgov1.6 it installed it undergolang-goand also installed somegolang-1.6-*andgolang-srcpackages