Learning and understanding how to install software in Linux

Sep 18, 2006 06:35 GMT  ·  By

Installing software in Linux is a quite distinctive process and can sometimes be very complicated, especially if you're new to this operating system. Most likely, you're used to the Setup.exe that asks you a few questions and then finishes the job really quickly. While some Linux software can be installed almost as easy, you will often come across software that seems to struggle every step of the way. You will find out why this occurs as you read on.

commands with '$' in front means they can be run as well as root and user. commands with '#' in front means they can be run ONLY as root.

Installing software from source

This is probably the most used way to install software in Linux. Source software is distributed in tarball format (.tar.gz, .tgz and .tar.bz2 archives) and can be obtained from the websites of software developers or from online software repositories such as sourceforge.net.

After you've downloaded the tarball, you have to uncompress it. This is done using the 'tar' command but with different options, it depends on the file extension. For a .tar.gz or .tgz file, use the following command to uncompress it:

$ tar -zxfv filename.tar.gz

For .tar.bz2 files:

$ tar -xvjf

Then, you need to go into the new created directory, which is generally named the same as the tarball, but without the extension, so use the command:

$ cd new-directory

You are now ready to compile and install the program. This is being done using three commands: configure, make and make install. First, start with running the pre-installation configuration script:

$ ./configure

This script will gather various information about your system and perform a number of checks to see if your machine and dependencies meet the minimal requirements for the program you are about to install. For a certain program to work properly, it may require a lot of programs (dependencies) to be already installed on your system. If any of the major dependencies is missing on your system, the configure script will exit and you can't proceed with the installation until you install those required deps.

The configure script also has to create a 'Makefile" which will contain various steps, based on the previous checks, that need to be taken while compiling the software. If the configure script has completed successfully and the Makefile was created, it's time to proceed with the second command:

$ make

'make' is actually an Unix utility that compiles source code files and creates binary executables based on the instructions of Makefile. Depending on the size of the program and your system specs, 'make' will take to complete from a few seconds, to a few hours. Also, it's highly probable to receive some warnings, even errors, during the make process but if the process isn't stopped prematurely, there's no need to worry about. After the process is completed successfully, it's time for the last command:

# make install

This step is also completed by the 'make' utility and the Makefile. Unlike the previous command, this time, 'make' follows only the instructions in the 'install' section of Makefile. Basically, in this final step, the executables and other required files created previously are copied into the required directories on your machine so the program you installed can be started by any local user.

Installing software using RPM

RPM (Red Hat Package Manager) is a package management system, originally developed by Red Hat for Red Hat Linux. It offers a flexible and easy method to installing, uninstalling, verifying and updating software and it's used, nowadays, by many Linux Distributions. Installing software from a RPM package differs from other installation methods, but the most important aspect is that the software is already compiled. Basically, all that needs to be done is copy the files to the required directories on your system. You must be root to manage rpm packages.

To install an .rpm package, you can use the command:

# rpm -i some-software-1.3-i386.rpm

Uninstalling is just as easy:

# rpm -e some-software

Sometimes, even the RPM packages need to be compiled to match your kernel version. This requires that you use the SRC RPM package with the following command as root:

# rpmbuild --rebuild some-software-1.3src.rpm

The compiled RPM package will be found in the directory /usr/src/redhat/RPMS/your-architecture. To install it, go to that directory and use the first command.

To search for an installed package on your system:

$ rpm -qa | grep package-name

Installing software using apt-get (Debian / Unbuntu)

Debian was made famous among Linux distributions by APT package management system. apt-get can handle complex dependencies between software and can install multiple programs with just a single command line. One of the most important features that apt-get offers is that you don't have to manually find and download the packages you want to install, it will do this for you and will also resolve any dependencies it may occur.

The first thing you need to do is to customize your /etc/apt/sources.list configuration file. This file is used by APT to locate software packages you want to install or upgrade. For apt-get to use the stable branch of Debian packages, you will probably want your sources.list file to look like this:

deb http://http.us.debian.org/debian stable main contrib non-free deb http://non-us.debian.org/debian-non-US stable/non-US main contrib non-free deb http://security.debian.org stable/updates main contrib non-free

If you want apt-get to use more updated packages but less stable, make your sources.list file to look like this:

deb http://ftp.debian.org/debian/ sid main contrib deb http://non-us.debian.org/debian-non-US sid/non-US contrib deb http://security.debian.org/ stable/updates main

Once you have configured your sources.list file, it's time to update your local list of packages that are available for install, so login as root and type:

# apt-get update

After the list finished updating, you can install applications using the command:

# apt-get install

To search for a particular application, you can use the apt-cache:

# apt-cache search

To remove an application:

# apt-get remove

Installing software using yum (Fedora)

Yum (Yellowdog Updated, Modified) is an automatic updater and package installer/remover for RPM systems. It automatically resolves dependencies and figures out what things should occur to install packages. Yum has been included in the standard Fedora Core installation.

To update your system with all the dependencies that are necessary:

# yum update

To make a search of some package full or part name:

$ yum search some-package

To see the information contained in a package in individual:

$ yum info some-package

To install a package with automatic resolution of dependencies:

# yum install some-package

You can also use wildmarks (*) for installing packages that start with the same name or letters. Eg:

# yum install mysql*

will install mysql, mysql-devel and mysql-server.

To uninstall a package along with everything what it depends on:

# yum remove some-package

To list all the packages available in the yum database:

$ yum list

To list all the installed packages in the system:

$ yum list installed

To list all the installed packages in the system that can (must) be updated:

$ yum list updates

The Yum cache can build up pretty large as a result of using RPM headers and packages. Those files are stored locally in /var/cache/yum and it's probably a good idea to clean it up once in a while if you're low on disk space. To clean the Yum cache:

# yum clean all

Installing software using urpm utilities (Mandriva)

urpm is a Mandriva (formerly known as Mandrake) package management system, very similar to apt-get in Debian. It's a tool for installing, removing, updating and querying software packages of local or remote media. "media" is referred to by places that hold rpm packages and can include removable disks (CD/DVD ROMs), http and ftp sites, local or even local network directories.

Installing software it made with the urpmi tool, in two ways:

from a local rpm (a RPM package on your hard drive):

# urpmi some-program-1.3.mdk.i586.rpm

from a URPM source (local or remote place that holds and maintains RPM packages). It's highly recommended you use online URPM sources (such as official http or ftp sites) rather than you own install CDs. Online sources contain more packages and also, the latest version available.

# urpmi some-program

To search for a program, you use the urpmq tool:

# urpmq some-program

To list all available update packages:

# urpmq --update

To remove packages, you use the urpme tool:

# urpme some-program

Installing software using emerge (Gentoo)

emerge is the command-line interface to Portage (the software distribution system for Gentoo Linux). It's used for installing, updating and removing packages and can automatically handle any dependencies a certain package has.

To install packages:

# emerge some-package

If some-package includes or depends on other packages, they are automatically installed as well.

To install a package and update all packages it depends on:

# emerge -u some-package

To uninstall a package:

# emerge -C package

To search for a package using its name:

# emerge -s keyword

To search for a package using its description:

# emerge -S keyword

Installing software using pkgtool (Slackware)

Slackware packages are usually distributed as .tgz files containing pre-built binaries. To install a Slackware package, you first need to manually download it. A good place to start searching for Slackware packages is www.linuxpackages.net.

Once you have downloaded the package, install it using the command:

# installpkg some-package.tgz

Uninstalling is also simple:

# removepkg some-package.tgz

You can also install, remove and list packages on your system using the pkgtool and follow the on-screen prompts:

# pkgtool