Compiling Software from Source
Some software cannot be found in any repository. The traditional way of installing software on Linux works just as well on Ubuntu. Download your software and put it in an otherwise empty directory. Sometimes, it will include installation instructions. If so, follow them. Most instructions will be the same as those listed here.
Before you can install a source code package, it must be compiled into a binary that your computer can run. For that, you need to install some packages that are not included by default. All you should need is included as a dependency of one package. Install it, and you should be all set.
$ sudo apt-get install build-essential
Next, browse to the directory where you placed the downloaded source code. It was most likely provided as a compressed archive, with a filename extension like tar.gz or tar.bz2. Decompress the archive with the appropriate command, depending on the filename extension:
$ tar -xvf file.tar.gz
$ tar -xvf file.tar.bz2
Next, make the package. This step checks to ensure you have the required dependencies installed and will tell you if you don’t—if not, you need to install them separately, hopefully using Synaptic or via the command line with apt. It will also build the package from source code into something installable.
Next, install the package. The traditional way is to use:
$ sudo make install
And although this works, there is a better method. Using
make install will install the package, but it will not use your package manager. If you ever want to remove the package from your system, it can be quite a chore to figure out how. Instead, install the following:
$ sudo apt-get install checkinstall
and use it to install the software, which, like any software installed from an official repository, cannot be removed using your package manager.
$ sudo checkinstall