Linux – Where to install programs in Arch Linux

arch linuxfile managementfilesystemsinstallation

I am virtually new to the Linux scene altogether. I recently downloaded Matlab for installation. I unpacked the files and ran ./install to start the wizard. As I was stepping through it asked me for an install path with a default of /usr/local/Matlab. That first off did not seem right and looked even more incorrect when I looked in that directory.

/usr/local/ has bin etc games include lib man sbin share src

That being said, it's doubtful this would be the most efficient place to install a program. Where are most programs installed? I've read that it largely depends on the Linux flavor for the most part.

Any recommendations from experienced Linux users?

Best Answer

There are a few places for apps to be installed in Arch Linux:

  • for apps that follow the Filesystem Hierarchy Standard and are installed by system package manager (in case of Arch pacman), /usr/ tree is used. Most commonly used parts by applications are:
    • /usr/bin/ - this is where the app's binaries (executables) go
    • /usr/share/ - this is where the app's other resources go (usually of the immutable kind)
  • for apps that follow FHS principles, but are installed per hand (commonly compiled via make and installed via make install), /usr/local/ is the right place. The hierarchy here mimics the one from /usr/ and its intention is to separate manually installed stuff from the automatic, repository stuff. Please note that if you intend to keep the local packages up-to-date and install a lot of them, using AUR, an AUR helper and learning how to maintain packages is probably a better way than overcrowding /usr/local/.
  • for apps that have more monolithic folder structure (e.g. Matlab), /opt/ is the way to go. One usually just puts the folders there, e.g. /opt/MonolithicApp/, /opt/Matlab/, etc.
  • since games tend to have the monolithic folder structure quite often, /usr/local/games/ is a designated place to put these, aside from /opt/. Which one should be used is left to user's discretion.

In order to keep things convenient, some additions to $PATH are necessary in case of programs installed in /opt/. If there is a single binary, I tend to just create a symlink in /usr/local/bin/.

If there are more than one/two binaries, it mandates a PATH="$PATH:/opt/MonolithicApp/bin/" addition somewhere in the shell config files.

Sources:

Related Question