|[Home] [Credit Search] [Category Browser] [Staff Roll Call]||The LINUX.COM Article Archive|
|Originally Published: Tuesday, 9 October 2001||Author: Maninder Bali, CEO, Centurion Linux|
|Published to: enhance_articles_sysadmin/Sysadmin||Page: 1/1 - [Std View]|
Application Management on Linux: Installing, Upgrading and Uninstalling Software from your Linux box.
For many people a big challenge between installing and starting to get anything out of Linux is dealing with software downloads. There might seem like a bewildering array of options. Actually though, the process is fairly simple and logical, that shouldn't be surprising, since this is only a computer, after all. In this article Linux.com contributor Maninder Bali lays out the steps needed to manage your applications and downloads, in source and RPM binaries.
Perhaps you have installed the entire GNU/Linux distribution on your machine and find that you still need some additional applications and software. Or maybe you need to upgrade some software or uninstall some, to be current with the latest releases. However, many new users have difficulty getting the latest software, upgrading it, or uninstalling old packages.
In this article, we are going to try and cover the popular and standard ways of installing, upgrading and uninstalling software from your Linux box.
In Linux, software can either be obtained in its source form or in binary pre compiled form.
Newbie Linux users are often not comfortable with software distributed in its source form, though this happens to be the most popular method of software release in the Linux community. The latest release of all Linux software is in the source form. This source has to be compiled on your machine. The advantage here is that you can actually customize the software to your needs, depending on the architecture of your machine. This can, however, baffle newbies. But worry not, the aim of this article is to show you how easy it can be!
Apart from source code, you can get the software in its pre compiled binary form for the GNU/Linux distribution you use.
In the pre-RedHat days, all Linux software used to be distributed in its source form as a tarball (tar.gz packages). Red Hat released RPM (Redhat Package Manager) to ease the task of software management in Linux. The basic aim of RPM is to make sure all software dependencies are satisfied and then go on to install the software on the machine. The user does not have to bother to think beyond typing a few simple commands. RPM has become increasingly popular as the default package manager for most distributions around the world. Amongst the more popular ones are Red Hat, Mandrake, Caldera and SuSe.
The easiest way to get the latest release of any software is to download it from the Internet. Almost all popular software packages have a home page on the net. You just have to go to the homepage of the project and download the latest release of the software. You can find a host of Linux projects on http://sourceforge.net and http://freshmeat.net. Another popular way of obtaining software is via CVS. We will cover obtaining software with CVS in our next article.
You can download the software in the popular .tar.gz form or .rpm depending on the GNU/Linux distribution you use.
Let's see how we can install each one of these forms of software on our Linux box.
Source packages are generally available in the .tar.gz format. They contain the source code, tarred and compressed to make the distribution of the software easier. The
.tar.gz file you get has all the source files, the Makefiles, and installation scripts that you need to install the software properly on your Linux machine.
Once you run the scripts available in the source package, for example, the configure script, it tailors the software's
make system to that of your system. The procedure for installing software from source is very similar. Lets cover the steps to install the software on your system.
To begin with, let's unpack the source code in the
$ tar -zxvf filename.tar.gz
Running this command will uncompress and un-tar the package into a directory. In some cases, if you have a
.bz2 package available, you might have to first uncompress it using the bunzip2 utility and then un-tar it with the
$ bunzip2 filename.tar.bz2
$ tar -xvf filename.tar
Having done this, you have to compile the resulting code on your machine. But before you do anything, please make sure you read the README and the INSTALL files available in the software package. These files usually do a great job outlining the entire installation procedure and configuration options. Having read them, you can continue installing the software with the following commands.
Enter into the newly created source directory and run the following commands:
# make install
If all these commands are executed successfully, you should have the package compiled and installed on your Linux machine. Lets briefly cover what these commands do.
./configure in the source code's main directory checks the system for any dependencies the software might have.
You can hack the configure script to change the default installation path, or you could enable or disable certain features. If you want to obtain a list of all the options available to you, type in
./configure --help at the command prompt.
Having run the
./configure script, the next thing you type is
make compiles the entire source code of the package. This command might take a lot of time to execute, depending on the amount of source code it has to compile, and the speed of your machine.
A point to note here is that the
make commands can be run as a normal user. However, for the third command,
make install, you have to be root. This is because the normal user would not have permissions to write to system directories like
/usr/sbin etc. Running make install as root copies the copies the compiled software into its respective directories.
That's about all it takes to install a software package from a source file, like a .tar.gz or .tar.bz2
The reason RPM packages are so popular and freely available is that they are easy to install, upgrade and remove from your system. Apart from that, RPM provides you with additional functionality like querying your system for installed packages and keeping track of what files it has installed and where it has installed those files.
So let's get on with installing an RPM package:
# rpm -ivh package.ix86.rpm
In the above command, the package would be the name of any package like xmms-1.2.2-4, the ix86 would be the architecture the package was compiled for.
-i argument instructs the RPM utility to install the package, while the
-v increases the verbosity level, and the
-h displays hashes as a progress bar while the software is being installed on your machine.
That is about all it takes to install an RPM package, unless of course some dependency problems arise. A dependency problem could mean that the package being installed might need another package installed in order to work correctly. In other cases, a dependency problem might arise if the package to be installed needs a specific version of some software or library installed. In such cases, what you have to do is install/upgrade the dependencies and then continue with the installation of the software.
Let's see some other useful utilities of the rpm command.
At a later stage, should you need to see where a particular package has installed all the files, all you have to do is type:
# rpm -ql packagename
Here, packagename is the name of the package you want to query, e.g xmms. The
-p option queries the database to check if the package is installed, and the
-l option lists all the files in that package with the full paths. Here is a sample output of the above command:
[Lord@Work CrismusBonus]$ rpm -ql Eterm /etc/X11/wmconfig/Eterm /usr/bin/Esetroot /usr/bin/Etbg /usr/bin/Etcolors /usr/bin/Eterm /usr/bin/Eterm-0.9 /usr/bin/Ettable /usr/bin/Etwinop [...]
Apart from querying software, RPM provides an easy way to uninstall software. You can remove any software package installed using the
rpm -ivh command by the following command:
# rpm -e packagename
-e option instructs the rpm utility to erase/uninstall the package defined by the packagename.
Please note that rpm will not allow you to uninstall software on which other software has dependencies. This is because uninstalling the software will break all dependencies and make it difficult for you to use the apps. that depend on the app you want to uninstall. However, if you still must uninstall the package, check the rpm manpage for details.
Having seen how to install and uninstall software packages using rpm, lets now move on to upgrading a software package using the rpm utility. Upgrading software is similar to installing new software. The following command explains it:
# rpm -Uvh package.ix86.rpm
-U option upgrades the packagename mentioned. The
-v and the
-h are the same as in the install options.
So there you are. Installing, uninstalling and upgrading using the RPM.About the author: Maninder Bali works for Centurion Linux, one of the most promising Linux start-ups in India. Centurion Linux is working on its own GNU/Linux distribution and was featured on Linux.com. To find out more about Centurion Linux, check out http://www.centurionLinux.com