[Tfug] Following the Filesystem Hierarchy Standard in Debian
Claude Rubinson
rubinson at u.arizona.edu
Mon Apr 14 11:50:24 MST 2008
On Mon, Apr 14, 2008 at 12:25:30AM -0700, Glen Pfeiffer wrote:
> For the whole of my Debian GNU/Linux experience I've been
> sheltered by the official Debian repository mirrors,
> backports.org, and Debian Multimedia. I've not had need or desire
> to build packages from source nor have I put any files outside
> /home and /etc. Don't get me wrong; I've built packages on
> *other* systems (notably FreeBsd), but not on Debian.
>
> I would now like to do some of the following tasks while keeping
> my fingers out of the apt-get/aptitude directories so they remain
> pristine:
>
> 1. Build and install software like Parrot, or Firefox 3. Where
> should I 'configure' it to put the files?
/usr/local is your friend here.
> 2. Install deb packages from unofficial sources. What is the best
> way to be sure that the packages put things where Debian would
> expect them to? I assume that I will have to inspect the
> package. Are there any automated tools for this?
If you're adding repos to your /etc/apt/sources.list, you want to
review its man page, in particular this line:
It is important to list sources in order of preference, with the
most preferred source listed first.
You'll also want to review the man page for apt.conf (in particular,
the section on pinning) so that you don't clobber stuff.
If you're talking about adding individual debs, what I do is keep a
local repo on my machine. It's really trivial to set up. Basically
you just create a directory to drop debs into, generate a Packages.gz
list and then add the repo to your sources.list. What's great about
this is that then you can control the local packages via aptitude.
(So, for example, when an updated deb is released, just drop it in the
directory, regenerate the package list and aptitude update && aptitude
upgrade.)
> 3. Install modules for Perl/Python/Ruby. I've read about the issues
> with Ruby Gems and how it installs the gems in directories where
> Debian does not want them. Would it be best to avoid their
> package management systems, CPAN/Eggs/Gems, and manually install
> so they won't intrude in directories that they should not?
This is a source of ugliness and one that I don't have a good answer
to. Basically, I install modules from Debian; if a given module isn't
packaged for Debian, I just use the default package management system
from the language. Generally this drops modules somewhere under
/usr/local/ but sometimes /var/lib/ and sometimes I don't know. And
what this means is that I don't really understand how the library
systems of most of my programming languages actually works. But,
then, again, since it works, I guess I don't really need to. But it's
still kinda frustrating.
> 4. Local web development. Where should I put my those files? Is a
> directory under ~/ the most appropriate? I think someone
> mentioned putting them under /var.
>
> 5. Run local MySql/PostreSql databases. Where should the data
> files go?
>
> 6. Create one or more local Subversion repositories. Where should
> they go?
Personally, I just put all of this kind of stuff under my personal
home directory. Primarily for simplicity and so that it'll get caught
in my backup routine (without me having to think about it). But, I
also don't do a lot of this, so others may have better thoughts.
> 7. Create system wide (non root) scripts. They will be executable
> by all local users. Again, where should I put them?
/usr/local/bin
> I know there is not necessarily a 'one true way' but is there a
> best practice?
Basically, Debian gives us two sandboxes: home directories and
/usr/local. More recent versions of Debian also give you /opt, but
that's used by a lot of larger, proprietary packages, so I avoid it.
You can do whatever you want in /usr/local and Debian won't touch it.
So, in your $PATH, just make sure to put /usr/local/bin first and
everything will be gravy. Stay out of /usr.
Essentially, I have a second filesystem hierarchy under /usr/local.
If I've got an app in /usr/local, I put its rc file in /usr/local/etc.
If its got a log file, it goes in /usr/local/var. Man pages are in
/usr/local/man/. And so on.
Hope this helps.
Claude
More information about the tfug
mailing list