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,379

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
  • 299,756
  • Thanks! So, I ran sudo chown <myuserid> /opt and again for /opt*, then did the same for the pivotal directories. This seemed to allow me to create a new tc server through eclipse. But, when I rebooted & restarted eclipse (which is in /opt/eclipse) I got the error message "The configuration area at '/opt/eclipse/configuration' is not writable." Dolphin shows owner user as messagebus and owner group as users. Not sure how that happened! Shouldn't owner user be ? Should I now use sudo chown <myuserid> /opt/eclipse and/or the -r option? – MaybeWeAreAllRobots Sep 14 '15 at 02:49
  • oops - the -R option? – MaybeWeAreAllRobots Sep 14 '15 at 03:03
  • This seems to answer that problem:http://stackoverflow.com/a/28752230/2920227 It is due to eclipse being installed/run as root initially and it setting up the workspace for user root. Changing the user to something else makes it look into the workspace for root = permission denied. So set the workspace to your user (guide inside the link). – Rinzwind Sep 14 '15 at 07:15