There are many variants or distributions of GNU/Linux, a free and open source operating system. One of the most popular and widely used is Debian. A distinct feature of Debian and most other Linux-based operating systems is that they use package management systems to install, update, and remove software. These systems allow users to easily manage their software without having to hunt it down on various websites or install it from removable media.
Debian and operating systems based on it (like Ubuntu) rely on a package management system called APT (Advanced Packaging Tool). With this simple tool, you can install, uninstall, update packages, and even upgrade your entire distribution. You can use APT from the command line using a set of easy commands or use a graphical frontend like Synaptic.
1. Updating Repositories
APT uses package repositories that can either be on local media or at remote locations. The repository information is generally stored in a sources file at: /etc/apt/sources.list. Each entry begins with the word “deb” (for the package type), followed by the URL, and repository name. An example for Ubuntu is:
deb http://us.archive.ubuntu.com/ubuntu/ natty main restricted
The information about packages is stored in a cache on your local computer so that you do not have to contact the servers for each action. To ensure you have the latest package information, run the update command as root (or using sudo in Ubuntu)
apt-get update
(sudo apt-get update
)
2. Searching for Packages
Using the “apt-cache” command, you can search for packages to install. This searches your cache, so you should make sure you have run the update command first to find currently available packages.
apt-cache search packagename
This will display a list of available packages and descriptions that match your query.
3. Installing Packages
To install packages, you can simply use the apt-get install command followed by the exact name of the package. It is important to search for the package first to make sure you know the exact name. Otherwise, apt-get will say that the package was not found.
apt-get install packagename
4. Updating packages
Anytime you want to update a single package, you can just run the install command for it again.
apt-get install packagename
If you want to update all packages, run:
apt-get upgrade
Additionally, if you want to make sure your distribution is completely up-to-date with all of the latest default packages (even ones currently not installed), you would run:
apt-get dist-upgrade
5. Removing Packages
When you want to remove packages from your computer or server, type the following:
apt-get remove packagename
Please note that if other packages depend on the package you want to remove, those packages must be removed as well, and apt-get will warn you about that before proceeding.
To completely remove a package and the configuration files associated with it, type:
apt-get purge packagename
By default apt-get will keep downloaded deb packages from previously installed files, even if you remove them. This makes reinstallation faster. In some cases, you may want to remove those if you are sure you never want to install them again or you want to force APT to redownload them. To do this, type:
apt-get clean
6. Fix Most Problems
If APT ever gives you errors that it seems unable to resolve automatically, you can run it with the “-f” option to fix most problems. To do this, type the following:
apt-get -f install
APT is a powerful tool that can make it easy for your to manage software applications on your computer. It is great for both desktop computers and dedicated servers, such as those offered by dedicated hosting company 34SP.com. For the full manual on apt-get, type “man apt-get” from the command line. You can also read documentation on the Ubuntu help website.
About the Author:Tavis J. Hampton is a seasoned writer with a decade of experience in IT, web publishing, and free and open source software. Some of his services include writing, web design, electronic publishing, and information management.