1

This is more of a general Ubuntu newbie question. (14.04 LTS, btw) I’ve built and used my Ubuntu box solely as a development machine to (re) learn coding – mostly java. I have two primary issues:

1) I can’t find any advice on a standard directory to install programs, so I’ve tended to use either /opt/ or /usr/lib. Is that ok?

2) I seem to run into recurring problems with file and directory permissions when trying to install/use applications.

From what I’ve read, there is no ‘standard’ for installation directories (and apt-get seems to do it’s own thing), so what do experienced folks do? Any good practices you can recommend?

The permissions problem consistently gives me the irits, and I usually end up going into the terminal and sudo the hell out of everything, or using chmod/chown. But, I think this kind of defeats the purpose of having these permissions. Is this a common issue, or did I miss a step when I built my box? Or, worse yet, did I somehow screw up my standard permissions?

For example, I installed eclipse and spring (STS, roo and security). To do the spring security tutorial, I had to install tcserver, so I put it under /opt/. However, I couldn’t set it up or start it through eclipse until I changed the ownership permissions on the entire install and server directories. This can’t be normal. That said, I installed maven without a hitch.

Thanks!

Ravan
  • 9,567

1 Answers1

2
  1. if your software is going to be used by OTHERS and you do not use a debian installer (ie. tar.gz, with either source or compiled software) it is called a "3rd party application" and the program should be installed in /opt/{softwarename-versionnumber}/ and offer that as the default installation directory.

    If this software is intended to be installed with a debian installer (ie. a DEB) files should be placed in the default location as described in How to understand the Ubuntu file system layout? Ubuntu/Linux installers use this lay-out and tend to enforce this method when you want to package and share your software through the default method of installing (Ubuntu software center)

    If the software is just for your own purpose I myself would use /opt/ or a directory with "local" (those are dirs for software/binaries you create for yourself and for your own machine, not intended to be shared,) in it but it is up to you to decide.

  2. software installed in /opt/ will be installed by the admin and by default set to "root" using "sudo". The easiest way to change the permissions is to change owner and group (chown -r $USER:$USER) if you have a single user machine. If it is a multi user system the same can be done u but the group (the 2nd $USER in the previous command) needs to be one that includes all those users.

    There should be no need to have to use chmod; the software in /opt/ should already come with sane defaults and all the permissions set correctly! Mind that some software installed in /opt/ can ask for a user to use and set the software already for that user.

From what I’ve read, there is no ‘standard’ for installation directories

The Filesystem Hierarchy Standard is a pretty good standard and is a widely accepted method for Linux operating systems. And is maintained pretty well (the next big change will be a separation such that we can have a read-only filesystem for / and partitions that hold the writable part of the installation.

Rinzwind
  • 309,379