Saturday 5 January 2008

Installing Software from Source in Ubuntu

Have you ever come across software that doesn't have a deb file or isn't in any repositories? Well don't be put off, because compiling and installing from source is pretty straightforward. The software packages will either be in tar.gz or tar.bz2 form. There are essentially four steps you need to take to install your software. For this example I will be using pkg as the package name and me as my username, so just replace these two. Open up your terminal and follow the steps below.

Unpacking
Configuring
Building
Installing


Unpacking
You can download the package to anywhere you want, I'm going to be using /home/me. If your software package ends with .tar.gz use this command:

tar xvzf pkg.tar.gz

Or, if it ends in tar.bz2 use this:

tar xvjf pkg.tar.bz2

Now your software is unpacked and is stored in a newly created folder in the same directory you stored the software package e.g /home/me/pkg. We need to cd into that folder using this command:

cd pkg



Configuring
The following should work for most cases. if it doesn't you should consult the README or help file for the correct command.

./configure

Hopefully that will configure without any errors so you can move to the next step.

Building
If you have successfully configured it, there should be a MAKEFILE created. You use this file to build using the following command.

make

Installing
Finally use the following to finish installation. You will be prompted for your password.

sudo make install

During the installation process there are some files created, after installation they are useless and you can safely delete them using this command :

make clean

To uninstall you will need the makefile and this command:

make uninstall

Now your software should be installed and ready to use. For a safer way to install from source have a look at checkinstall, which lets you create .deb files from your source packages. This allows you to uninstall using synaptic and is also better for when upgrading to a newer version of Ubuntu.

0 comments:

Post a Comment