3

Is there way to specifically install in path /usr/local using apt-get ? I am using Linux Mint 16 and I want to install some libraries in this path. All of my installed libraries are installed in /usr/ and only some of them are available in /usr/local

I was able to install boost library by means of tar.gz file but is there a way to do it using apt-get install ?

4
  • Besides belonging on SU, this also is a duplicate of this question.
    – rubenvb
    Jul 13, 2014 at 15:16
  • That's why I was not getting its answer here. Sorry for the trouble?
    – user166289
    Jul 13, 2014 at 15:20
  • No trouble. StackExchange works like this. Also don't worry about your question being closed as a duplicate (if it is closed). It's all for the better and allows for people to find what they need quicker.
    – rubenvb
    Jul 13, 2014 at 15:28
  • @user166289 What is the problem you are trying to solve? Why do you believe /usr/local is superior to /usr?
    – jpaugh
    Jul 27, 2017 at 18:13

2 Answers 2

4

There should not be any way to do that, see this answer

This is because the Filesystem Hierarchy Standard explicitly reserves /usr/local/ for program and data used system-wide, but installed locally by the sysadmin. Please take time to read that FHS (which also provide rationale).

BT, you often cannot move a binary file and related data, because most programs contain builtin file paths. In practice, to install them under /usr/local/ you'll generally need to re-configure and re-compile them.

So a .deb package installing file under /usr/local/ would be against the conventions and standards.

7
  • 1
    I don't get it. Am I not the sysadmin of my own machine?
    – zneak
    Jul 27, 2017 at 16:01
  • Then, compile the software from source code. Jul 27, 2017 at 17:18
  • 1
    I don't dispute the end result, but in light of your answer, should that mean that the Filesystem Hierarchy Standard makes a difference between "installed by apt-get" and "installed by make install"?
    – zneak
    Jul 27, 2017 at 17:36
  • Yes. Most GNU software install by default with the /usr/local/ prefix (if you don't give any to configure). But the distribution is packaging then with /usr/ prefix (i.e. is configure-ing them with --prefix=/usr/ ...) Jul 27, 2017 at 17:41
  • 1
    @zneak It's not distinguishing who installs the software, but who compiles it. This is a more useful distinction, partly because package maintainers have to jump through a lot of hoops to make sure their software installs and works gracefully on every system. If you install non-packaged software to the same location, you could potentially have conflicts with system packages, which should otherwise just work, and you lose the freedom to compile software however you want to (as you have with /usr/local.
    – jpaugh
    Jul 27, 2017 at 18:21
2

No, and you shouldn't need to.

The purpose of /usr/local is to distinguish software which was compiled & installed by the local administrator from software distributed with the system (that is, software which can be installed via apt-get).

By installing non-packaged software to /usr, you risk causing conflicts, which could even cause system packages to fail for no apparent reason (e.g. if you overwrite a library with a newer version, or an incompatible build).

Package maintainers have to do a lot of extra work when compiling a package, to ensure it works flawlessly on every install, and regardless of what other packages are installed. This is only possible when they can look at the package repository, and know every other package which could potentially be installed. (In practice, they may only be concerned with a small subset of the packages; such as the libc toolchain, and the SDL libraries, for example.)

Compiling packages yourself is (by comparison) fast and loose: you don't care about maximizing portability; you just want it to build and work on your machine. You don't care if there are incompatibilities with stuff under /usr, since it will not get overwritten, and you are free to install an incompatible duplicate of any library, so long as you stay under /usr/local. You may even have very specific requirements (e.g. taking advantage of your machine's specific instruction set for boosted performance) which do not apply to other users of your linux distribution. And, if it is incompatible with some other piece of software you haven't installed yet, you'll deal with that when trying to install the new software, not in advance.

1
  • 1
    Side note: When you're installing a whole stack of packages for a specific purpose, or installing anything from a 3rd party vendor, it's common practice to isolate these from the possible mess under /usr/local, while also protecting the stability of /usr, by installing each to a unique place under /opt/<vendor-name> or /opt/<stack-name>.
    – jpaugh
    Jul 27, 2017 at 18:36

You must log in to answer this question.

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