
Now Go will be global and can run from anywhere.īest way to install Go on Ubuntu is to download required version from here. Go version go1.19.4 Test your installation: USER_HOME_DIR=$(getent passwd $"Įcho "Error: tar file does not exits." >&2 Edit the file using any of editor available i.e., vi, vim, or nano.ĮXPORT_CMD='export PATH=$PATH:/usr/local/go/bin'.Sudoer user, you must be able to use sudo.But I think it is important to automatize this installation.

This is an old question in 2022 it is almost more that 9 years. Set Go workspace to the environment variable: GOPATH=~/.goĪpply the. # set PATH so it includes user's private bin directories # for ssh logins, install and configure the libpam-umask package. # the default umask is set in /etc/profile for setting the umask # the files are located in the bash-doc package. # see /usr/share/doc/bash/examples/startup-files for examples. # This file is not read by bash(1), if ~/.bash_profile or ~/.bash_login profile file in the home path with this content: # ~/.profile: executed by the command interpreter for login shells. Install the latest version of Go: sudo add-apt-repository ppa:longsleep/golang-backportsĬreate the. Remove the existing Go version: sudo apt-get purge golang* I use this instruction to install the latest version of However, this is permanent and does not disturbs anything else. All those things will stop working and it'll start giving you error. You'll not be able to use any other command like ls, nano or just about everything because everything else is in /usr/bin or in other locations. Go command will only work in terminal in which you changed the value of PATH. Some people here are suggesting to change the PATH variable.Ĭhanging that to /usr/local/go/bin is temporary and it'll reset once you close terminal.

Offline documentation will be available at NOTE: Now, All the commands in go/bin will work.Ĭheck if the install was successful by doing bashrcĪnd add the following line to the end of file. To achieve this we need to add a line to. Now You have to set Environment Variables so you can use the go command from anywhere. Here is the most straight forward and simple method I found to install go on Ubuntu 14.04 without any ppa or any other tool.
