Wednesday, December 17, 2008

HOW TO: Compile from source

While Linux (and especially Ubuntu) have come a long way, there are still times when installing a new program requires it to be compiled from source.

1. Usually when you download a program that needs to be compiled it comes zipped. Therefore, you need to run the following command from the terminal t0 unzip it:
$ tar -xvf packagename.tar.gz
(usually the package will be in the tar.gz format, but it may not so you may have to change the extension)

2. Naviagte to the newly created folder:
$cd packagename

3. Now use the following commands to begin the compiling process:
$ sudo apt-get install build-essential
$ ./configure
$ sudo make
(NB: the ./configure command may fail as many packages do not have that specific file, ignore it).

4. Now you have two options as to how you want to compile, you can use the old method which will simply compile the program, or the newer method which compiles the program and creates a .deb package which you can then use to install the program. The advantage of the later method is that a .deb package is much simpler to install (just double-click on it, like a windows .exe file) and the .deb package will be in your package manager (e.g. synaptic) so you can easy uninstall it from here.

a) Old Method:
$sudo make install
b) New Method:
$sudo checkinstall
The program should now be installed!

No comments:

Post a Comment