Compiling Programs

To compile programs (note: this might not work with non-GNU Programs), first install the package build-essential.
sudo apt-get update && sudo apt-get install build-essential tar
Now that you have the required packages, download the source of the program.
mkdir -p ~/sources && cd ~/sources && wget <compressed source location>
Now, to uncompress the file, type:
tar xf <file.tar.gz/xz/bz2>
Change your directory to the source directory. Now type:
./configure <your arguments> && sudo make -j$(nproc) && sudo make install
Add --prefix=<DESTDIR>, if you need to set the installation directory (remember to replace with your own destination directory)
That’s it :slight_smile: . Your program should be compiled and installed by now.

Using sudo make install is bad idea for production systems !!!
It may trash your system.

You should use CheckInstall instead:

sudo apt-get install checkinstall
sudo checkinstall make install

to create deb-package for self-compiled application and let APT know about it.

And of course you should check package availability in official channels ( http://packages.ubuntu.com/ ) and PPAs ( https://launchpad.net/ubuntu/+ppas ) first.

2 Likes

Well, on some old systems (like Ubuntu 9.04 systems) it might not work. Although it is pretty old, some production systems may still be using it.