Learn the Basics of Installing From Source in Linux
Posted by Kevin Purdy at 2:45 AM on February 28, 2008
Few things can be as frustrating to non-expert Linux users as seeing the phrase "... or compile from source packages" on the download page of that killer app to try out (and we know that's often the case for you patient non-Ubuntu users out there). If you're looking for a nuts-and-bolts guide to installing software from those strange-looking Whatever.tar.gz files, Tuxfiles.org has a pretty good one. While the link takes you through the unpacking, compiling, installing, and cleaning up, there's a basic command line method for almost any package (replacing "package" with the appropriate downloaded file name):
I've pulled off a few successful source installations a few times in my year or two spent in Linux, but I wish I'd had this guide bookmarked from the start.# tar xvzf package.tar.gz(ortar xvjf package.tar.bz2)# cd package # ./configure # make # make install
Tags: installation | linux | linux 101 | linux tip | source code

Comments (AU Comments · US Comments)
There are currently no AU comments for this post.
whereisian
Posted 3:42 AM 28/2/08
The downside of this is that the software is not available in the package management system. Also, there is often no 'uninstall' option available from the installer script.
I've used checkinstall which will make an rpm or deb package from source files. Very handy, but not always availble in any given distros repository.
whereisian
Jason
Posted 4:30 AM 28/2/08
Thanks for this, I've been using Ubuntu for 4-5 months (thanks to Windoze Vista sucking) and do, indeed, get frustrated at "...or compile from source packages." I've gotta say, anyone who's reading this uses Linux, I'm sure, but if you don't you NEED to try out it, it's awesome, especially Ubuntu.
Jason
Hieronymus
Posted 5:20 AM 28/2/08
Yes I agree - for most modern distros, 'make install' is a recipe for disaster.You completely mess up the package database. For rpm or deb based systems, checkinstall is the way to go if you absolutely positively have to have a package not available.
Hieronymus
drsmith
Posted 5:20 AM 28/2/08
To say that tar; config; make; make install is something the average person wants to do is like saying building rocket motors is easy. The problem is that a good number of applications suffer from dependency hell. For example, I want to run 'Mike's neato utility', but I can't build 'Mike's neato utility' until I first build and install 'Franks almost useful library'. Oh ... wait a minute.... I can't build and install 'Franks almost useful library' until I first build/install 'Annette's utility' and 'Betty's other unknown library'.
Suddenly, that simple build/install you were planning on doing is taking hours while you sort out all of the things you have to do before you can even get the build to complete.
Disclaimer: I am a sysadmin with many years experience. I do this as part of my job and I wouldn't wish it on anyone.
drsmith
enine
Posted 5:20 AM 28/2/08
I was going to say the same, make uninstall is normally an option.
enine
jeffeb3
Posted 5:20 AM 28/2/08
have you tried make uninstall?
jeffeb3
PReDiToR
Posted 6:23 AM 28/2/08
I use openSUSE primarily and gOS (Ubuntu Gutsy). I enjoy compiling from source, but dependencies are a problem. Usually you can find a package if you trawl the net for a while, but if you can't and you're worried about uninstalling or messing up your package database you could always build your own package. On Debian they try to tell you that that is the way to make a kernel, but I'm damned if I'm going through an extra step making a package for it.
rpmbuild is not that hard to use, and alien is very useful.
PReDiToR
Confuzius
Posted 6:23 AM 28/2/08
Good to know.
I keep forgetting and mean to keep track of all of the dependencies that I end up having to use so that on a fresh install I can just "SUDO APT-GET INSTALL (paste list of common dependencies from my text file)"
Alas I forget again. Will probably reformat when HH hits and this time try and remember.
Confuzius
Bobly
Posted 6:23 AM 28/2/08
Not only that but you're forgetting all the options, just doing those simple steps will give you the default client, but part of the beauty of compiling your own is enabling or disabling features you might need or not ^^
Bobly
rattis
Posted 6:23 AM 28/2/08
I can build from source as I need to, but I think it defeats the purpose of the package manager. The whole point of the package manager (to me) is to make updating the software easy, and manage dependencies.
It is nice to have a reference for those times people are forced to, but I feel sorry for them.
I'm a NIX admin. I complain every time I have to build from source on the servers. Not because it's hard, but because it will take more time than what should be required.
rattis
msisaac
Posted 7:35 AM 28/2/08
I realize that long-time Linux users and fans will attack me for this, but this "how-to" guide shouldn't even exist. If Linux really wants to compete with Windows and Mac OS X, the words "compile from source" should NEVER even cross the lips of regular users. If sources need to be compiled, it should all be handled behind the scenes without the user ever opening a terminal. End users want point and click simplicity. They've come to expect it from their OS. Telling a user to open a terminal window and type in a long list of cryptic commands just to get an app to install will only result in the user finding something else.
As a 15 year Solaris/Linux/Windows desktop and server admin, I know from experience that end users would rather pay for and put up with the software headaches of Windows than deal with command-line interfaces. It's a simple fact of life. The fact that so many things in the various Linux distros still REQUIRE the terminal is a big reason why I still refuse to recommend Linux to any of my family or friends.
I don't mean this as a dig on Linux. I love the OS and the open aspect of the development (as well as the cost, obviously). But Linux developers need to understand that command lines should only be required for developers and system administrators. They shouldn't be required for end users who just want to browse the web or play a game.
msisaac
HeartBurnKid
Posted 9:24 AM 28/2/08
@msisaac: Frankly, the average user isn't going to need this how-to guide. Ever. They will likely be able to pull anything they could possibly want or need from repositories. It's only geeks like us, who dig the bleeding-edge and the experimental, and who are constantly looking for ways to get more from our hardware, who will ever need to compile from source. For us, this is there.
HeartBurnKid
noneck
Posted 11:51 AM 28/2/08
Yah it sucks that a lot of you newbies rely on repositories these days. Ahh the good old days. Crazy you only installed from source "a couple times." I would think that Lifehacker would want someone a little more knowledgeable and experienced writing Linux articles for em. So lemme get this right, your a newbie, posting about your newbie experiences with Linux??
Sigh.
noneck
TonyAgudo
Posted 12:40 PM 28/2/08
If you ever have to compile from source, I'd strongly suggest looking up Kinstaller, a GUI wrapper for the "configure;make;make install" commands. It even has a setting to create binary packages via checkinstall. Here's the homepage:
[www.stierand-linuxit.de]
TonyAgudo
nighttimestereo
Posted 2:46 PM 28/2/08
@noneck: The larger the percentage of the Linux user base that falls into the "newbie" category, the happier I'll be. If the Linux user base were mostly composed of experienced old-timers who don't mind the command line, it would mean that Linux were not growing as an operating system.
As a side note, the only reason I can afford to run Free software at home is that there is a tremendous market for cheap, general purpose x86 computing hardware that was created by DOS and Windows and is currently maintained by Windows. So popularity matters a lot.
nighttimestereo
wakeboarderal05
Posted 4:02 PM 28/2/08
Forgot to actually say my own opinions. I will agree that this is usually a pain to do, but sometimes it's necessary. For instance, I absolutely have to have the most up-to-date version of a few programs (like Pidgin), and the only way to do that is to forget the package manager and install from source with each release.
Other than that, I rarely ever install from source unless I come across some small, cool utility written by one or two people. Gotta love open-source software.
wakeboarderal05
fushark
Posted 4:02 PM 28/2/08
The guide is okay, but rather incomplete. For example, it failed to mention the use of
to learn about what supports that can be enabled/disabled.
The modern tar command doesn't distinguish between tar.gz and tar.bz2 anymore. You can basically untar both using tar -xvf or without the v switch if you don't really care for the verbosity. Most people don't care about what's happening during the Make process, but it is useful to know sometime to know what some of the warnings are. So, what I like to do is usually this:
In this instance, I will have a log of the compilation process and where the files are then installed. In the case where the app doesn't come with uninstaller or I have deleted the source file/directory, I can simply refer to my log to guide me through the deletion process. Obviously, you can create a separate file for each process, so it is up to you to decide what to do.
fushark
wakeboarderal05
Posted 4:02 PM 28/2/08
@whereisian: Most source code installs have an uninstall script in the tarball's un-tarred directory somewhere. It'll be in the documentation if it's there, usually the "INSTALL" or "README" file in that tarball.
wakeboarderal05
cde
Posted 9:02 PM 28/2/08
To all you from source nay-sayers, installing from source is what all those package maintainers had to do to create the repository copy you download. Less people who install from source, the less maintainers, the less uptodate packages.
cde
KSMarksPsych
Posted 11:55 PM 28/2/08
I've learned a lot by compiling from source. But I've also been lucky and have had someone experienced guiding me through my noob stage. But I'm also one of those people who isn't happy unless they are constantly challenging themselves to learn something new. I have to admit though, without some to guide me, I probably would have given up long ago.
KSMarksPsych
Iain Cheyne
Posted 3:06 AM 29/2/08
This is the best guide to compiling software that I have found.
[help.ubuntu.com]
Iain Cheyne
NewRider
Posted 3:02 AM 6/3/08
If this is the kind of thing you wish to know more about, you might want to pick up a used copy of the book "Porting Unix Software" by By Greg Lehey. This book was published 13 years ago for developers and admins of the various Unix "standards"/flavors of the day: BSD, System V, OSF/1, POSIX.
But now these are the days of Linux (RPM/DEB) distros, FreeBSD, Solaris and Mac OS X. The problem of getting Unix software packages up and running on your particular system is still there. Many of the concepts and tricks in the book are still relevant.
NewRider