Installing software from source

From Mandrivausers Wiki

Jump to: navigation, search

Although the majority of software is already available as an RPM package for Mandriva systems, some software is only available as source code, especially if it is very new or obscure. Often the source code is distributed as a compressed tar file.

[edit] Extracting the source code

First you must extract the source code files from the .tar.gz file. To do this, you use the command "tar", like so:

tar -xzvf /home/bob/compressedfile.tar.gz

This command would extract the contents of the file "compressedfile.tar.gz" into the current directory. If you didn't issue this command from the "/home/bob" directory (substituting "bob" for your username of course), "tar" would try and extract the contents to whatever directory you are in, showing an error if you do not have permissions to the directory. You can find the current directory you are in with the command "pwd" (Present Working Directory).

Now you "cd" into the location of the source code. For example, MPlayer 0.91 when extracted creates a directory "MPlayer0.91/". So, to go into this directory you would use this command:

cd MPlayer0.91/

This should be similar to any other software that you download (with, of course, a different name).

[edit] Compiling & Installing it

Always check the install instructions which should be provided with the code. Most Linux software follows the same conventions when packaging their software, and with most software, only four commands should usually be needed. They are used in the order shown below:

./configure
make
su
make install

The ./configure command configures software for your computer and checks if you have everything needed for it to build. The make command compiles the software. The su command allows you to log in as the root user. And finally, make install installs the compiled software as the root user.

NOTE: Sometimes when using ./configure you get an error that you are missing some "devel", or "development" packages, for example, I got the following error compiling Gaim (gaim.sourceforge.net)

   * GLib 2.0 is required to build Gaim; please make sure you have the GLib
   * development headers installed. The latest version of GLib is
   * always available at http://www.gtk.org/. 

Sometimes, the ./configure script will tell you where you can find the missing package (as above), if not you can search for it. Development packages usually have the -devel suffix in the filename. The Mandriva (or whatever distribution you use) CDs and repositories contain many of the development packages that you should ever need.

You will usually find more accurate and extra information in the README and/or INSTALL files contained with the software about the different compile options.

[edit] See also

Personal tools