10

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?

5
  • You can install an application in any folder you want.
    – Ramhound
    May 22, 2014 at 0:21
  • Of course, but in terms of the hierarchy of a linux system where would it make most sense? I did not think having a Matlab directory among library bin directories made much sense.
    – sherrellbc
    May 22, 2014 at 0:21
  • 1
    /usr/bin or /usr/local/bin as its a user-installed application
    – EkriirkE
    May 22, 2014 at 0:22
  • It now asks for a path to place the symbolic links to Matlab scripts. Any suggestions? I installed Matlab in /usr/local/bin/Matlab
    – sherrellbc
    May 22, 2014 at 0:30
  • There are conventions,but within those conventions where you put things is up to you. I personally put proprietary software in /opt. You can likely put the symlinks anywhere in your PATH.
    – user55325
    May 22, 2014 at 3:05

1 Answer 1

22

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:

3
  • I am circling back after a few years of Linux use. I tend to follow this convention and it works pretty well. I, too, have tended to use symlinks for invoking user-installed binaries. However, some binaries assume they are being invoked from their root directories. To solve this, I have been using a simple script placed in the app's root directory (e.g. /usr/Matlab/matlab-start.sh) that uses dirname and realpath to cd to the app's root directory before passing $@ to the target executable. What is the convention for binaries in /usr/bin that also have a location requirement?
    – sherrellbc
    Jan 24, 2017 at 18:35
  • I'm not sure what kind of binaries you mean - files in /usr/bin should be put there only by your package managers (e.g. pacman, AUR helper) and a correctly built package doesn't have a 'location requirement', as you put it. Perhaps an example to illustrate your case could be helpful?
    – Zaroth
    Mar 28, 2018 at 5:55
  • To create a new folder in /opt we need a su rights. Is it ok to place custom monolitic apps here? I assume we will be able to run it only with sudo then? Dec 31, 2023 at 15:59

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .