Take the 2-minute tour ×
Super User is a question and answer site for computer enthusiasts and power users. It's 100% free, no registration required.

Where is the best path to install all files of package when compiling?

For example - I want to install ProFTPd, so there's an option

--prefix=/usr/local/proftpd

, which means, that all files after compilation (including binary and configuration files) will be stored here. As you know, all packages, which are installed via package system (like zypper on SuSE or apt on Ubuntu) usually stores its configuration files in /etc/ and binary files in /sbin/ and also stores a link in my $PATH, so i can run in just by typing proftpd (without /sbin).

The huge advantage of packages installed via package system, i think, is easy uninstall process. I'd like to be able to uninstall compiled packages also easy.

I think i could be able to create some batch file, which I'll be able to use like this:

uninstall --package=proftpd

And my script will find all proftpd files in usuall paths (/etc, /sbin) and remove it using rm.

Is there any best practices, where to store all these files, or are there any (dis)advantages of my first example (--prefix=/usr/local/proftpd)?

I really don't think, that it's nice to have 2 paths with configuration files and binary files, but maybe I'm misunderstanding the basic principals of Linux... :-)

share|improve this question

4 Answers 4

up vote 7 down vote accepted

Filesystem Hierarchy Standard

The distro gets /usr, you get /usr/local, ISVs get /opt.

share|improve this answer
1  
Yeah, I got your point, but are there (dis)advantages of installing into /usr instead of /sbin? Like permissions (security) or links? –  Radek Simko Jun 19 '10 at 10:21
    
If you install local packages local to your machine into /usr/local then you can backup those local packages which you may not do for /sbin. And yes, you are failing to understand basic principles of file systems; for example, why wouldn't you just store every file in one directory? –  msw Jun 19 '10 at 12:59
2  
One disadvantage in installing under /sbin -some linux distros expect the bare minimum to start a system in /bin, /sbin and /lib, and then all the rest of the commands under /usr/bin, /usr/sbin and /usr/lib. Some distros will create a very small partition to store the stuff under /, and then a much larger partition to store the stuff under /usr. So check the space available under /sbin -it might be limited. –  Pat Wallace Jun 19 '10 at 13:09

The best places to install packages on your machine are /usr/local if you have admin rights and want everyone to use your program, or $HOME if you want to just make a copy for yourself.

Normally you'd set the prefix as --prefix=/usr/local so that the application files are stored in /usr/local/bin settings in /usr/local/etc and so on.

The advantage of using these standard places is ...well, basically that they are standard. People know where to look for the files. For example, /usr/local/bin is almost always in everybody's $PATH, so you won't have to fiddle with the $PATH variable to get people to run it. Similarly, libraries are found by checking $LD_LIBRARY_PATH but /usr/local/lib is usually checked by default so you don't need to add it manually, and so on.

Regarding uninstalling: Once you have run configure and built the program, then make install will install it for you, and make uninstall will remove the files automatically.

share|improve this answer
    
You're right with make uninstall, but afaik sometimes it's not available in the package. –  Radek Simko Jun 20 '10 at 20:24
    
True. I like the checkinstall idea mentioned below. I'm going to try that next time I install something on Linux. –  Pat Wallace Jun 20 '10 at 22:38

Actually, the best approach is probably to create a package that you can install.

Many applications come with the necessary files to create RPM or DEB packages. If they don't, there are tools to create packages automatically, for example checkinstall.

checkinstall will monitor the operations of make install, and redirect the installed files to create a DEB or RPM package from them. That way, you get a regular package that is integrated with your other packages.

There are some caveats (you will not get dependencies, and some very complicated install scripts may fail), but usually it works very well.

share|improve this answer

Best practise is to follow the Linux Standard Base, particularly the filesystem hierarchy standard.

share|improve this answer

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.