9

How to: Compile packages on Debian/Ubuntu by hand

 3 years ago
source link: https://www.devroom.io/2008/05/04/how-to-compile-packages-on-debianubuntu-by-hand/?utm_campaign=Feed%3A+ariejan+%28ariejan%7Cdevroom.io%29
Go to the source link to view the article. You can view the picture content, updated content and better typesetting reading experience. If the link is broken, please click the button below to view the snapshot at that time.
neoserver,ios ssh client

How to: Compile packages on Debian/Ubuntu by hand

Posted: 2008-05-04 - Last updated: 2019-06-05

Tagged blog ubuntu debian source code src package packages deb

In some very rare situations you may find yourself in the need to recompile a Debian (or Ubuntu) package. Luckily for all of use, the great Debian packaging system makes this a piece of cake.

Let’s say we want to recompile mod_python for apache 2 to hook in to python 2.5, instead of the default 2.4.

First, get every thing installed you may need to build the libapache2-mod-python package.

$ apt-get build-dep libapache2-mod-python

Okay, next let’s grab the source for the package. The source will be unpacked to your current working directory, so it may be a good idea to create a seperate directory for this.

$ mkdir src
$ cd src
$ apt-get source libapache2-mod-python

In the case of this example, you don’t need to do anything special to get python 2.5 linked. Just install the python2.5 and python2.5-dev packages.

If you need to apply patches to the source or need to make any other modifications, this is the time!

Okay, now go to the source directory and build the package. This is the tricky command here:

$ cd libapache2-mod-python
$ dpkg-buildpackage -rfakeroot -b

This will build the package. You will get some warnings and errors about missing GPG keys. This is okay. You are not the package maintainer, so your packages should not be marked as ‘original’.

You’re now ready to install your compiled package.

dpkg -i ../libapache2-mod-python-3.3.1-3-i386.deb

That’s all! You compiled and installed a package from source!


About Joyk


Aggregate valuable and interesting links.
Joyk means Joy of geeK