This quickie howto will explain the steps necessary to recompile a Debian software package on the local machine from source code. Rebuilding Debian software packages is necessary in order to enable custom features in some software packages and/or is sometimes done to ensure that the software has been optimally compiled for running with the best possible performance on specific hardware.
Install the software package builder bundle via the aptitude software package management utility.
# aptitude install pbuilder
Prepare the system to recompile the software package by downloading and installing all build dependencies required by the software package.
# apt-get build-dep PackageName Reading package lists... Done Building dependency tree Reading state information... Done [ ... Lots of Output ... ]
Next, download the source code for the software package that will be recompiled.
# apt-get source PackageName Reading package lists... Done Building dependency tree Reading state information... Done Need to get 4121kB of source archives. [ ... Lots of Output ... ]
Rebuilding The Software
Change to the directory of the software package's source code and use the debuild utility to rebuild the software package.
# cd PackageName # debuild -us -uc
Once the software package has finished compiling, install the newly created package with the dpkg utility.
# cd .. # dpkg --install PackageName.deb
The newly rebuilt software package is now installed and ready for immediate use.