I've read about how source-based linux distros like Gentoo can have considerable performance increases when compared to pre-built distros like Ubuntu because they install from source with optimizations for your particular system. Is is possible to build Ubuntu from source to get the same kind of benefit?
migrated from stackoverflow.com Mar 11 '11 at 0:18
This question came from our site for professional and enthusiast programmers.
I am not sure about the benefits if you have fairly new hardware components but for the "Ubuntu from source" part of the question the answer is YES, you can build not only your favorite applications from source, but the entire operating system.
Here is how:
You need to install apt-build. Its a comandline tool like apt-get, but instead of downloading and installing the binary package, apt-build downloads the source code of the package, compiles it and then installs it to your system.
After you install it with
you will be asked for an optimization level (medium is ok), whether you want to create an apt-build repo for APT (Yes) and a question about processor architecture (my intel i7 is considered core2 ). Of course all options can be reconfigured in this way:
The above command offers two additional options for the gcc compiler and make builder. Their descriptions can be found in system manuals: man gcc and man make.
For a manual and available command options check
But the most useful are:
Lets say you want to compile/install Gedit. Instead of apt-get install you just do
Apt-build makes use of deb-src entries contained in the /etc/apt/sources.list file so the compilation and installation processes are fully automatic (similar to emerge found in Gentoo). Apt-build downloads sources of the main application and its dependencies, compiles them, creates a deb package, and finally installs the package.
Some notes about apt-build world.
In my opinion don't attempt it, unless you have 24 or more hours available !
If so first thing you should, remove/disable/uninstall any third party applications (it better to do in a fresh install of Ubuntu) and then do :
The above command will copy your full list of system packages to apt-build.list so that they can be compiled from source. Open that file
and remove any GCC/G++ entry
Then you can do :
I suggest to add two options — --yes and --force-yes — to make the rebuilding process fully automatic.
You could start a flamewar and a huge debate about this kind of topic, but lets look at real life.
The speed of your OS greatly depends on what hardware you run it and that is the major factor.
I change distros frequently while most of the time staying with Arch, but is Arch way faster than Ubuntu? No.
Gnome with compiz on Ubuntu 10.10 useses about 300ram, on Arch 200ram, I have 4gb of ram, I don't feel the difference, but if you compare Ubuntu with gnome to Arch with awesome, there will be a huge boost in responsiveness and resource usage (300ram vs 50ram), but this only matters if you are choosing a distro for a netbook.
So if you have a fast desktop and don't want to spend time tinkering with your system just use Ubuntu, but if you have a netbook than consider using a lightweight WM on Arch :)
Apt-build is useful for more than performance, you can build custom distribution images and repository for specific hardware ready for mass install for your business. By this, I mean an optimized binary distribution if you know all the hardware will be the same. This way, only one computer does all the work compiling, and the rest are just upgraded using the remastered ISO. It's not completely just for lightweight or encoding. And a custom Installer ISO allows you to reinstall without recompiling if for some reason your system is unrecoverable after a disaster.