Linux – Make binary executable available for all user

executablelinuxsoftware installation

How to make a binary file available for all linux(Ubuntu) user.
eg:
When we install the golang using apt install golang-go the go executable is available for all user.

Where will they add the configuration for that.

I checked it in global level /etc/environment, /etc/profile, /etc/init.d/ i couldn't find any reference there !

Distributor ID: Ubuntu
Description:    Ubuntu 16.04.4 LTS
Release:        16.04
Codename:       xenial

Its not even in ~/.bashrc or ~/.profile; even-though these files are user specific.

Since the apt install gives the old version of go; i need to manually install the latest version of go and make it available for all the user.

Best Answer

When executing a command without specifying a path, the system searches for the executable in locations specified in PATH environmental variable. Paths in PATH-variable are searched in order and first found executable is used.

/usr/local/bin is a reasonable place to install your own executables as it is possibly already included in the distribution provided default PATH and it should not conflict with system's package manager. If the directory structure of your program makes placing files in /usr/local/ inconvinient, another reasonable location to place the files is in /opt under its own subdirectory (and additionally creating symbolic links/launch scripts in /usr/local/bin).

Related Question