Ask Ubuntu is a question and answer site for Ubuntu users and developers. Join them; it only takes a minute:

Sign up
Here's how it works:
  1. Anybody can ask a question
  2. Anybody can answer
  3. The best answers are voted up and rise to the top

Is there an Ubuntu equivalent to the BSD Ports system? I realize that the Linux and Ubuntu culture tends to install new software from binaries, but having used BSD ports within both BSD and Mac OS X I find it very simple and elegant and the idea of compiling from source on demand, with all dependencies figured out for you, is very powerful.

share|improve this question
Not sure about Ubuntu, but Gentoo is using a system like the one you are describing. – Zoke Dec 27 '11 at 17:04
up vote 4 down vote accepted

Most linux distributions, Ubuntu included, distribute packages as binaries. Unless you have a very specific need, IMO, building from source is over rated.

IMO, if you wish to compile from source, you are better off using LFSor Gentoo.

You can, of course, achieve the same thing with Ubuntu by building from source. You should avoid installing packages outside of apt as much as possible.

here is a nice overview of why (fedora wiki).

So what you would do on ubuntu is download the source code from the ubuntu repositories, make any modifications needed, build a package, and install it with apt (dpkg). Doing so is poorly supported, and as with LFS and Gentoo you will need to do a bit of reading.

The documentation is a bit scattered.

Enable the source repositories

You need to enable the source repositories to download the source code.

source repositories

See Ubuntu wiki repositories for details.


apt-build will build from source and is probably the best way of achieving what you want on Ubuntu or Debian (or Mint ...)

sudo apt-get install apt-build auto-apt

Configure your options

dpkg-reconfigure apt-build

You probably want to use -jx where x = number of CPU +1

To prevent your compiled packages / libs from being over written, put these options in /etc/apt/preferences

Package: *
Pin: release o=apt-build
Pin-Priority: 990


apt-build install <package>

see man apt-build


apt-get will download the source and install dependencies (binaries)

# build-deb installs the dependencies (binary)
sudo apt-get build-dep <package>

apt-get source <package>

You can then build and package with any number of tools.


Ubuntu Wiki Easy Compiling

The page on compiling a kernel has more details and alternate options (fakeroot,

Ubuntu wiki compile kernel

That should get you started ;)

share|improve this answer

Your Answer


By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.