Source or package install?
The question: “Is it better to install software from sources on Linux? Or from packages? Should I get the deb/rpm or the tar?” appears often among new Linux users. This article will try to give a response to these questions and show that we should be happy that we have so many choices and can use the one that is best for ourselves. Indeed, this question makes sense only on the Linux world. Here we have different choices. We can achieve the same thing using different methods. Still, this doesn’t necessary mean that one choice is better than another one; it might just mean that some options are better for some situations and some for other situations.
This question is pointless for a windows user. Does it make any sense to ask the regular Windows computer user how will he install a new piece of software? Of course not, because the answer will most certainly be something like: “I’ll buy the software, insert the CD/DVD and the installation will start automatically. I will click several times next (this is really annoying and hope Microsoft will fix this in their next version) and that’s it”. Is this simple? Yes of course. Is this the best way? It doesn’t matter because it is the only way.
Installing from sources
You might have heard from different peoples that installing from sources is the best choice. You have complete control, you can choose the options you want enabled or not, etc. Let’s see what are the advantages and disadvantages of running software from sources:
ADVANTAGES:
- definitely the most important thing is that you have full control: besides the simple ./configure; make; make install; you can customize the software based to your needs. You can leave out some features, or enable some non standard ones.
- another advantage is performance: you can build the software on the running system and apply optimizations for the specific system. The increase in performance will range based on the application itself (this can be very small unnoticeable improvement, to a serious performance improvement).
DISADVANTAGES:
- time consuming: the compilation can take a long time to complete based on the size of the application and the system it is running. During the compilation the system will use resources (CPU) to build the application and this might not be a good thing on a live system.
- it doesn’t scale very well: if you are doing this on one machine this can be ok. But what if you are doing it on 100? Is it worth it? You can choose to deploy the compiled binaries on more systems, but this will be just a primitive packaging system
. - security upgrades will be needed to be performed manually also: you will need to monitor properly and install any security related upgrades of the applications.
- handling of dependencies: is not so easy, an can cause extra problems when missing prerequisites need to be installed.
For sure any average Linux user had to compile at some point from source an application. Gentoo is the exponent of building everything from sources. You can compile and optimize every software possible on your system. It sounded like a great idea to me also a few years ago. But after I have worked with it for a while, I just realized that I was using a lot of resources in building software upgrades that was not bringing me a real advantage. And everything on a live system running a successful site. When I had to expand the system to 10 systems do you think I have chosen to still use gentoo? Or did I choose a ‘binary’ distribution? Of course. I made my choice based on the particular needs I had.
Installing from packages.
Each Linux distribution is somehow ‘packing‘ the applications they provide bundled with the distro. This is one of the most important things you should look when choosing a linux distribution: what packages they offer and how do they compile them. The installation from packages (even if you might have heard of things like ‘rpm dependencies hell‘) should be very easy and straight forth. Let see the advantages and disadvantages of running software from packages:
ADVANTAGES:
- fast and easy: the packages are in complied form so the process normally involves to download the package and their dependencies, and to install (decompress them).
- easy security updates: these days any respectable linux distribution will have an easy way to track and install security related upgrades. The important thing here is to release the updates fast enough, and to make it easy (automated) to maintain the system updated.
DISADVANTAGES:
- you lose control. You no longer choose the compilation options and they will mostly be done to work for most peoples. Those choices go are taken by the peoples that create the packages, even if those are employes of a private company like RedHat or members of a community like the Debian developers.
- performance penalty: the packages will normally build on an architecture that will run on most hardware. Most distributions still build on i386 (meaning the software will work on any archaic computer). Distributions like Mandriva for ex. compile their packages for i586, and our days most distros will have an amd64 version with the ever increase usage of 64bit CPUs.
- availability: not every software will have a package. And if it does it might not have for your distribution, and in this case you will be force to compile it from sources or help the community by creating a new package. Some distributions like Debian will include a huge list of software packages, while others will have smaller lists. Even in this case you might use 3rd party repositories that provide community build packages.
Any Linux user will have his preference. There are advocates of RPM or DEB/APT that will say their system is the best. The truth? On most modern linux distributions (either debian based, or rpm ones) the installation of new packages will be very easy and the way to go for a fast and simple install.
Conclusion
Ok then. But the question still remains… what is the best choice? I have tried to show is that both choices are good. They are good for some situations and it is a great thing we can choose what we will use. Let’s say you are a Linux enthusiastic and you want to get the most of your system. Using gentoo and compiling every piece of software you run on the system sound normal? Sure it does. You are a sysadmin managing a server farm collocated in a remote datacenter? Running debian or rhel consistently on all the systems would sound normal? Of course it does.
Going further: on the usage of the linux distribution, you will choose the one that is best for you. If most of the resulted debian packages will be close to what I would build myself, it is just normal for me to use Debian, right? Does this mean that Debian is better than RHEL? No it doesn’t. It just means that for me Debian is the best choice for my needs. And nothing stops me form customizing and creating my own debian packages if this will be useful (read deployed on several systems).
I hope you found this article useful and it will help you make better choices
.
>







16th January 2008, 15:54
Hi.
You wrote:
>> And if it does it might not have for your distribution, and in this case you will be force to compile it from sources or help the community by creating a new package.
Sorry, but I don’t agree with this point of view. Indeed, very often (approx. in 90% occasions) you can simply install, for example, an RPM package from Fedora at a Mandriva box.
I myself had such experience while installing Plesk at a RHEL4.0 - this system has rpms from Mandriva, SuSE, Fedora - and it works fine!
And another example: my home PC is running Mandriva 2007, and my Internet channel is narrow and traffic is expensive (I live in Belarus) so I have to install many different packages from Debian DVDs after converting them with alien. Yes, I know that I’d better use Debian but my wife doesn’t like it
16th January 2008, 16:10
If you use FreeBSD and the Ports system, or build your own RPMs, the disadvantages of the packages are pretty much mitigated. This does of course bring back at least one of the disadvantages of the building from source method, namely that it can be time consuming, but considering you only build the package once then distribute it to multiple systems, it’s not too bad.
16th January 2008, 16:26
Pavel: I understand your point, and this just show even more that you were able to find a solution even in your situation. About your internet experience I am sorry to hear that… I also live in a poor country and know how things are, but here competition created a great thing: fast and cheap broadband internet for everyone.
16th January 2008, 18:54
Well, compiling from sources is great. I usually installed the requirements from deb or rpm packages just to satisfy the software that I would like to install. Once all the requirements are in placed, I would compile a software from sources like web server or anything that require optimizations and special security considerations.
The final step would be trying to use checkinstall to create either a rpm or deb package and install this newly minted package. I would then be able to install this very same package in other servers too. However, this one might not work 100% of the time but still it is a viable option for installing from “sources”.
Anything critical software like Apache, Samba, Openldap and etc should be compiled from sources and I would say that updating these are fairly easy. You just need to have the appropriate ways to do things:
ln -s apache-2.4.6 /usr/local/apache2
compile a new one:
rm /usr/local/apache2
ln -s apache-2.4.8 /usr/local/apache2
copy or link the config files to the new location.
Just by using this, I have a few working versions of the same software and I certainly can switch back and forth among them. I think once you get used to the concepts then installing from sources would not be so intimidating.
Besides that, you really learn so much more of the piece of software you are installing because you have to read the installation instructions, learn and decide what appropriate options to use. I do not think you can learn as much by installing from deb/rpm packages.
My 2 cents.
17th January 2008, 08:32
Marius, you wrote:
>>I also live in a poor country and know how things are, but here competition created a great thing: fast and cheap broadband internet for everyone.
heh, there’s a monopoly in telecommunications in Belarus: the only company (Beltelecom) owns all 1-st level uplinks and resells it to the rest of ISPs at a fixed price (rather high) - so 1Mbit full unlim. comes at approx. $800-1000/month
It’s really awful
>>this just show even more that you were able to find a solution even in your situation
I HAD to find this awesome solutions cause it was a critical task from my CIO -
and since that time I hate SWSoft and Plesk
17th January 2008, 12:18
Pavel: this sucks… If there would be a real competition this would never happen.
21st January 2008, 20:53
There is one more disadvantage of compiling programs:
It’s much harder to fully uninstall them if you need to.
21st January 2008, 21:03
khai: only if there’s no “make deinstall” target in makefile
6th February 2008, 06:12
Hi, Khai. It is just easy as how I installed it:
rm -rf /usr/local/apache-2.4.8
rm /usr/local/apache2
It could not be any easier. The key is planning. Put the config files in /usr/local/etc/yourapp dir then by installing the binaries and related stuffs in /usr/local/yourapp-version# and make a soft link to the latest version I just removed older versions or just keep them around.
Besides that, compiling and installing from sources is a good skill because it does not matter you use Ubuntu/Debian or Red Hat/Fedora/CentOS/Mandrake or even Solaris and even *BSD, as long as you have accesses to the right tools such as compilers and Make tools among other things, you can always compile and install the software. If anybody had become specialized in installing Deb or RPM packages, then how would they transfer that knowledges when they are working with a new distro or even Unix variants and there are no such familiar Deb or RPM software packages.
When you are talking about fast then installing from packages beat installing from source hands down but for anything else I would venture to say that installing from sources gives the system admin an edge.
Installing from package is ideal for end users but for system admins then the advantage lose its appeal.
I really hate it when there are just simply so much interdependencies between packages, you remove or upgrade one and risk messing up other parts. Debian is much better in resolving or eliminating these issues but it is not 100% applicable all the times.
I have my shares of bad experiences with installing software from packages so unless there is no other ways then I usually stick with the sources.
My 2 cents.
6th February 2008, 10:37
djatlantic: this was also the idea of my post, that you can choose what is best for you… I still think that it is best if you are installing software across several (hundreds maybe) of systems, to package up the compiled software and deploy them easily. This helps maintenance, and updates also.