install a program (compiled binaries/ executables) accessible for all users

  1. Move the installation directory, eg. myapp, to /opt.
    $ sudo mv myapp /opt/
  2. Link the executable(s) into /usr/local/bin. This directory is per default in the $PATH environment variable and can therefore be executed by any user simply by typing mybinary instead of /usr/local/bin/mybinary.
    $ sudo ln -s /opt/myapp/bin/mybinary /usr/local/bin/
    If you have multiple executables to link, you can use wildcards as well:
    $ sudo ln -s /opt/myapp/bin/*.sh /usr/local/bin/
    For multiple executables that cannot be catched by any wildcard, you can use find to find all files in the directory that are executable and create a link:
    $ sudo find /opt/myapp -maxdepth 1 -type f -executable -exec ln -s {} /usr/local/bin/ \;
  3. Logout and login again to make changes to $PATH take effect.
Share itShare on FacebookShare on Google+Tweet about this on TwitterShare on LinkedIn

3 thoughts on “install a program (compiled binaries/ executables) accessible for all users”

Leave a Reply

Your email address will not be published. Required fields are marked *