For users new to the Linux operating system, nothing beats installing applications with the graphical Add/Remove Software applications found in the main menu of your desktop. But sometimes that ever-so-user-friendly GUI isn't an option. Once such instance would be a headless server with no graphical desktop. Or maybe you've found a particular applicaiton that is only offered as a source package. For these you are going to have to know your way around command line installation.
In this article I am going to show you the basics of some of the more popular package management systems as well as the basics of installing via source. I will not spend too much time on each (otherwise this article could grow rather overwhelming). By the end of this article you should know how to install, querey, and remove applications with the more popular tools.
Let's start from the source. Generally when you download a package for installation that ends with tgz, gz, bz2, or *zip this will be a source installation. For these installations you are going to take advantage of some powerful compilation tools. But before you can start the compilation you have to unpack the source directory. If your file ends with a "bz2" you will first have to ucompress the file will the command bunzip2 APPLICATION.tar.bz2. This will result in a new file like APPLICATION.tar. Tar is an archive system that rolls up directories into a file. To unpack the directory you would issue a command similar to tar xvf APPLICATION.tar. Unpacking the directory would then result in a directory (in our example) APPLICATION.
If the downloaded file ended in tgz or gz then you have a compressed archive and you simply have to add the "z" switch to the tar command to both uncompress and unpack the archive. This command would look like tar xvfz APPLICATION.tgz, which would result in the directory APPLICATION.
Once you have your directory unpacked you need to change into that directory (with the command cd APPLICATION). Once inside this directory issue the ls command. You will most likely see either a README file or an INSTALL file. Open those up and see if there are any special instructions for installation. If there are no special instructions then the standard compilation steps will most likely work. Here's how this works:
That's it. If all went as planned, the application should be installed.
RPM is the Red Hat Package Manager. Installing via RPM is actually quite simple. Here's how this works. Once you have downloaded the rpm file you want to install, open up a terminal window and issue the following commands:
That's it. If all went well your package should now be installed.
If you want to make sure your package was installed you can issue the command rpm -q filename and you should see the name of the package and the version that is installed.
If you want to remove that package you just installed (or another package) issue the command:
rpm -e filename
and the package will disappear.
This is one of the best installation systems available. With apt-get you do not have to download a package, you just have to know the name. Here's how apt-get works (I am going to assume Ubuntu is the distribution, so you'll make use of sudo). Open up a terminal window and issue the following:
sudo apt-get install package_name
to install the needed package.
To remove a package with apt-get you would issue the command:
sudo apt-get remove package_name
to remove the package from your system.
The urpmi system is from the Mandriva distribution and is similar to apt-get. To install a package with urpmi you would open up a terminal window, become the root user, and issue the following command:
to install the needed package.
To remove a package with this system you would issue the command:
and the package will be removed.
This is the Debian installer and is as easy to use as any other. To use dpkg you will open up a terminal window and issue the following command to install a package:
sudo dpkg -i package_name
to install a package.
To remove a package issue the command:
sudo dpkg -r package_name
and the package will be gone.
There you go. A very basic description of package management with the more popular tools. Yes, there is much, much more to them than what you have just read, but this will give you enough of a foundation to get you goingAdvertisement
Advertising revenue is falling fast across the Internet, and independently-run sites like Ghacks are hit hardest by it. The advertising model in its current form is coming to an end, and we have to find other ways to continue operating this site.
We are committed to keeping our content free and independent, which means no paywalls, no sponsored posts, no annoying ad formats or subscription fees.
If you like our content, and would like to help, please consider making a contribution:
Ghacks is a technology news blog that was founded in 2005 by Martin Brinkmann. It has since then become one of the most popular tech news sites on the Internet with five authors and regular contributions from freelance writers.