Written by Chris Olstrom in Guides
Hello there! If you are new here, you might want to subscribe to the RSS feed for updates on this topic.
Powered by WP Greet Box WordPress Plugin
At least two solutions exist, each suited to a different purpose.
apt-build
The first method relies on the apt-build package, which fetches the latest source available in the repositories listed in your /etc/apt/sources.list file. This source is then compiled into a package (generally the same configuration as if you had installed the binary, unless you specify otherwise) and installed. Updates should still be managed as normal.
Note: This method is ideal if the package has source available in one of the repositories you have configured.
To install apt-build:
$ sudo apt-get install apt-build
This should add a local repository to /etc/apt/sources.list for any built packages. To make sure that the package manager is aware of this:
$ sudo apt-get update
Building a package with the default options is as simple as installing a precompiled binary package. For example, to build Prism:
$ sudo apt-build install prism
checkinstall
On occasion, the need may arise for an application that is not included in the standard repositories (or any supplemental ones configured). This is common with niche software, software with licensing complications that prevent it from being hosted in one of the repositories, abandonware, and applications that are have no maintainer beyond the upstream developers.
For cases like these, checkinstall is an ideal solution, as it allows us to build a .deb package for easy removal later. This package will not have updates tracked, but does offer the most flexibility.
To install checkinstall:
$ sudo apt-get install checkinstall
With it installed, building from source follows the usual documentation for a package, with one minor adjustment: We substitute the checkinstall command in place of make install. For example:
$ tar xjf package-source.tar.bz2
$ cd package-source
$ ./configure
$ make
$ sudo checkinstall
At this point, checkinstall will ask you for a few details about the application being built (package name, version number and such), and build a .deb package with the relevant metadata. It is automatically, and the package-name.deb will remain in the current directory for convenience. You can back it up or remove it, depending on your need. Reinstalling it is as simple as:
$ sudo dpkg -i package-name.deb
Removal follows the typical style:
$ sudo apt-get remove --purge package-name
Where package-name is the name provided to checkinstall when it asked for it.
Again, it is important to note that packages built with checkinstall are not tracked for updates. You need to stay aware of any important updates for packages built like this, as updates are not built automatically. Many applications have RSS feeds or mailing lists for releases and updates, and subscribing to these could allow you to patch a vulnerable application before it becomes a problem.
No related posts.
2 Comments - Leave a comment!
- Tell me what you think in the comments!
- Get the feed, and keep tabs on new content.
- Write a response on your blog, and post a link in the comments.
2 Responses to Building .deb Packages from Source in Ubuntu (or Debian)
-
links for 2009-11-05 « Where Is All This Leading To?November 5, 2009 | 16:33[...] HOWTO – Build .deb Packages from Source in Ubuntu (or Debian) (tags: linux debian packaging deb build compile ubuntu) [...]
-
eljojo (josé tomás a)January 28, 2010 | 06:54encontré lo que buscaba: http://chris.olstrom.com/blog/howto/build-deb-packages-from-source/