1

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.

  • What version of Ubuntu are you running? – Kusalananda Jun 20 '18 at 10:30
  • @Kusalananda Ubuntu, xenial – Vaisakh Rajagopal Jun 20 '18 at 10:32
  • "the configuration for that" is a user's PATH; typically, software that is compiled from source and intended to be available to all users would install its executable files in /usr/local/bin – steeldriver Jun 20 '18 at 11:11
  • Have you checked the xenial-backports repositories for a newer version? – ivanivan Jun 20 '18 at 11:36
  • @steeldriver So if i want to manually install a new binary, let say go itself. The directory will be go/{api, blog, doc, lib, pkg, test..........., bin}. But the actual executable is go/bin/go, so should i create a file in /usr/local/bin as go_symlink and link it to $HOME/go/bin/go file ! – Vaisakh Rajagopal Jun 20 '18 at 12:07
2

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).

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.