3

This should be a simple thing.

I followed the instruction on "http://golang.org/doc/install" to install "Go" on Ubuntu.

  1. Downloaded it
  2. Unzipped it to "usr/local"
  3. Added the path in "/etc/profile" (export PATH=$PATH:/usr/local/go/bin)

But when I type in "go" it says "The program 'go' is currently not installed".

What should I do?

  • Add the path to your .profile in your home... – Maythux Jan 11 '14 at 6:17
  • doesn't "/etc/profie" apply a system-wide variable so I don't have to add in ".profile"? What if another user wants to run "go"? – ericbae Jan 11 '14 at 6:19
  • after adding the path source the etc/profile file. – Avinash Raj Jan 11 '14 at 6:20
  • Were any of the answers helpful? – jobin Feb 13 '14 at 20:10
  • Just adding to /etc/profile does not make it active in your current shell. You need a new login shell. – Thorbjørn Ravn Andersen May 10 '17 at 8:39
4
gedit /etc/profile

Add the below line,

export PATH=$PATH:/usr/local/go/bin

Then source the /etc/profile,

source /etc/profile

Logout and login back.

  • 1
    This is strange, I did "source /etc/profile" and it worked. Then I logged out and logged back in and it now says the same error "go is not installed". When I "source" again, it works. – ericbae Jan 11 '14 at 6:27
  • 1
    Also, when I do "source" it works under my user name, but if I change to "root", I get "go is not installed" error again. ??? – ericbae Jan 11 '14 at 6:31
  • after sourcing the profile file,restart your pc. – Avinash Raj Jan 11 '14 at 6:32
  • 1
    That's not working either. – ericbae Jan 11 '14 at 6:37
  • 1
    for root put the path inside /root/.bashrc file. – Avinash Raj Jan 11 '14 at 8:32
0

The easiest way to install go 1.0.3 on ubuntu is to do

sudo apt-get install golang-stable

To install version 1.1.1 do this:

sudo apt-get install python-software-properties  # 12.04
sudo add-apt-repository ppa:duh/golang
sudo apt-get update
sudo apt-get install golang

Source: How to install current version of go on ubuntu

  • It seems like the PPA is not maintained anymore. – zerwas Feb 22 '15 at 13:52
0

You can use this, for system-wide installation:

echo 'PATH DEFAULT=${PATH}:/usr/local/go/bin' | sudo tee -a /etc/environment

Logout then back in.

0

I had the same problem

What fixed it for me was sourcing it in my .bashrc

You can do this yourself by doing: nano ~/.bashrc

Then add the line at the top of the file. source /etc/profile

Ctrl+O to write then Ctrl+X to exit.

Close than reopen your terminal and type go and you should see a list of commands pop up.

I'm still new to linux and I'm sure there's a better way, but that's whats worked to far for me

0

After having a bit of trouble with this myself, and taking time to read a bit from this page, I believe the best solution for most users is to do:

gedit ~/.profile

This opens a file you can use to save persistent variables for your user session (it won't be persistent system-wide, but if you're the only user, or will be the only one using Go, it's ideal). So add this at the bottom:

export PATH=$PATH:/usr/local/go/bin

Saving the file will not affect the system immediately; you must fully log out of your Ubuntu session (via the top-right gear) and log back in. Open a terminal window and check if it worked by entering:

go help
0

Do not use /etc/profile, run this instead:

echo "export PATH=$PATH:/usr/local/go/bin" >> .bashrc

And then source the file:

source /etc/bash.bashrc

You can find details here: https://www.begueradj.com/installing-golang-on-ubuntu.html

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.