This week's book giveaway is in the OO, Patterns, UML and Refactoring forum.
We're giving away four copies of Refactoring for Software Design Smells: Managing Technical Debt and have Girish Suryanarayana, Ganesh Samarthyam & Tushar Sharma on-line!
See this thread for details.
The moose likes Linux / UNIX and the fly likes Directory to install software Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login

JavaRanch » Java Forums » Engineering » Linux / UNIX
Bookmark "Directory to install software" Watch "Directory to install software" New topic

Directory to install software

Ong Vua
Ranch Hand

Joined: Jan 24, 2008
Posts: 66
I'm a newbie to unix. Do you know what directory should I use to install new software? I've seen people installing software in all kind of different places such as


I know you can install software anywhere you want but I just want to know what is the correct unix location to install software. Thanks
Pat Farrell

Joined: Aug 11, 2007
Posts: 4659

It varies by distribution, and by personal preference.

I tend to use /opt

There have periodically been attempts to have standards in the Linux world, but since its open source, anyone is free to decide they don't like the standard and do it some other way.

The key thing is to put them someplace that will stay there if you reinstall the OS. But with modern package managers, this is much less of an issue.
Jeff Rummings
Ranch Hand

Joined: Dec 20, 2007
Posts: 42
This page has a good explanation:
Tim Holloway
Saloon Keeper

Joined: Jun 25, 2001
Posts: 17011

The great thing about standards is that there are so many to choose from. (Daniel McCracken, I think).

There's 3, no 4, primary places programs end up. It's largely personal preference, but I have some guidelines I use. For whatever it's worth, here there are:

For a complete self-contained vendor environment, there's /opt. /opt is sometimes subdivided by product within vendor, as for example IBM and Websphere.

For a traditional approach, there's the /usr/local tree. A lot of Unix-style packages would build and install their packages into a subdirectory named for the package under /usr/local. I often put Tomcat and Ant there.

For really pervasive stuff, you can install directly into the /usr/bin and related directories. This is best done via the system's package manager (rpm, debian package manager, Solaris dpkg, etc.).

There's also the blended approach, where you install everything in one directory (/opt or /usr/local) and then softlink to present its system characteristics in their familiar locations; config stuff in /etc, logs in /var/log, workfiles in /var/lib and so forth.

The fourth approach is seen for applications that have a particular runtime environment such as Python or Perl. In this case, the packages normally install into a /usr/lib/<language> directory, such as /usr/lib/perl/site_perl.

CAUTION: according to the strict definition of the FHS, /usr should be read-only. Packages that have volatile storage requirements such as work directories, session info, etc. should assign those items elsewhere (normally under /var/lib).

Customer surveys are for companies who didn't pay proper attention to begin with.
Jesper de Jong
Java Cowboy
Saloon Keeper

Joined: Aug 16, 2005
Posts: 14950

I don't know about which Unix variant you're talking, but if it's Linux: Most Linux distributions have a package management system. The two most used systems are RPM (Red Hat Package Manager) and DEB (from Debian). The package manager takes care of installing, keeping track of, and removing software on your system. You download an .rpm or a .deb file and use the package manager to install it. The package manager will put all the necessary files in the right place for the program to work. If you later remove a package, it will clean up everything neatly.

Most programs installed via the package manager will put files in /usr/bin, /usr/lib, /etc and other places.

Sometimes you want to download the source code of a program which is not in an RPM or DEB package. Most of these things come with a makefile, and you use the program "make" to compile and link the program from source code. GNU software uses a certain convention for makefiles, and so the makefile of GNU programs and many other pieces of software comes with a standard set of make targets. You can usually build these programs with the following commands:

If the program is built successfully, you can usually install it with:

(you must run this last command as the root user, or with sudo if your Linux distribution uses sudo). This will normally install the program into /usr/local.

On my Ubuntu system, I always put manually installed programs in /usr/local.

Java Beginners FAQ - JavaRanch SCJP FAQ - The Java Tutorial - Java SE 8 API documentation
Pat Farrell

Joined: Aug 11, 2007
Posts: 4659

Originally posted by Jesper Young:
I don't know about which Unix variant you're talking, but if it's Linux:

There was Unix before Linus. And nearly all of the *nix had their own special feature that was better than all the rest. AIX, HPux, DG's, System V, System 7, etc. all seemed to do it their own.

But as Jesper says, if you are using Linux, use the built in tools.
apt-get or synaptic on debian, rpm or urpmi on RedHat family members.
Tim Holloway
Saloon Keeper

Joined: Jun 25, 2001
Posts: 17011

I highly recommend packages. However, some of the best apps were designed for other times or other Unices (such as BSD), so occasionally you'll end up with the old "configure/make/make install" process or one of its kindred. Mostly these install to /usr/local, although some of the specialized ones such as "perl" go to other places, as I mentioned above.
I’ve looked at a lot of different solutions, and in my humble opinion Aspose is the way to go. Here’s the link:
subject: Directory to install software
It's not a secret anymore!