From Go's install webpage,

Download the archive and extract it into /usr/local, creating a Go tree in /usr/local/go. For example:

tar -C /usr/local -xzf go$VERSION.$OS-$ARCH.tar.gz

Choose the archive file appropriate for your installation. For instance, if you are installing Go version 1.2.1 for 64-bit x86 on Linux, the archive you want is called go1.2.1.linux-amd64.tar.gz.

(Typically these commands must be run as root or through sudo.)

Add /usr/local/go/bin to the PATH environment variable. You can do this by adding this line to your /etc/profile (for a system-wide installation) or $HOME/.profile:

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

The directory hierarchy of my /usr/local is

$ ls /usr/local/
bin  etc  games  include  lib  man  sbin  share  src  texlive

Does the extracted Go's binary distribution fit into /usr/local? Is it a good practice to copy Go's binary distribution into /usr/local/?

If not, what is your recommendation about where to put it? Is /opt or my home directory a better place?


closed as primarily opinion-based by Jeff Schaller, Networker, sam, Stephen Harris, slm Jul 21 '16 at 16:56

Many good questions generate some degree of opinion based on expert experience, but answers to this question will tend to be almost entirely based on opinions, rather than facts, references, or specific expertise. If this question can be reworded to fit the rules in the help center, please edit the question.


My recommendation is to NOT follow the install instructions on the Go language web site.

Instead, install the packages for your distribution.

Debian, for example has golang 1.6.1 packaged, along with hundreds of Go libraries.

Ubuntu has 1.6.1 too. http://packages.ubuntu.com/xenial/devel/golang

apt-get install golang will install the compiler, docs and golang source.

apt-cache show -n golang will give you a list of all other packages with "golang" in the package name - at first glance, nowhere near as many as Debian.

If you really must compile and install it yourself, you should at least use checkinstall:

CheckInstall keeps track of all the files created or modified by your installation script ("make install", "make install_modules", "setup", etc), builds a standard binary package and installs it in your system giving you the ability to uninstall it with your distribution's standard package management utilities.

Homepage: http://checkinstall.izto.org

Use it for any Go libraries you compile too.


Following the installation instructions is usually good practice.

I think it sounds like quite a good idea to keep the Go stuff under /usr/local/go. That way you can easily remove the complete installation before updating it by just removing that directory hierarchy.

Nothing stops you from putting it in /opt as /opt/go or in /sw or $HOME/local or wherever you want, as long as you add the appropriate path to you PATH shell variable.

It is not unheard of for software to create their own hierarchies beneath /usr/local. On some BSD systems, installing the GNU coreutils will create /usr/local/gnu with things like gls, gcp, grm etc. (the ordinary utilities with a g prefix) as symlinks from /usr/local/bin into /usr/local/gnu/bin.


According to the FHS, /usr/local/ is meant for exactly that:

The /usr/local hierarchy is for use by the system administrator when installing software locally.

The alternative would be /opt:

/opt is reserved for the installation of add-on application software packages.
A package to be installed in /opt must locate its static files in a separate /opt/ or /opt/ directory tree,

Even in /usr/local, a separate tree is useful for keeping different packages separate from each other, and simplifying updates, removals and keeping multiple versions of the same program present. The choice between /usr/local is pretty much up to you as the system administrator.

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