How to use APT to install Linux software
Last week we learned how to install Linux applications with YUM. This is the common method used for most Linux servers based on Red Hat Linux. For Debian, however, another package management tool, called APT, is the default. APT, which stands for Advanced Packaging Tool, was originally designed for “.deb” packages, which are used by Debian, Ubuntu, and many other Linux distributions. Now, there are also versions for rpm packages (Red Hat), Mac OS X, and Solaris.
Like YUM, APT detects the dependencies that are necessary to install a package and pre-installs them. It can also be used to remove packages, update current installs, and upgrade an entire distribution. It works by contacting a local or remote repository, which contains a list of available packages. It then downloads those packages and installs them using a program called dpkg.
To update your APT cache to the latest package list, enter the following command as root:
apt-get update
You can now search the list (cache) for the package you want. For example, if you wanted to install phpmyadmin, type:
apt-cache search phpmyadmin
When you find the package you want, run the following command to install it:
apt-get install phpmyadmin
It may ask you for confirmation. If so, press “Y” for yes. The same command is used to upgrade a single package.
If you decide to remove a package, enter:
apt-get remove phpmyadmin
To upgrade all currently installed packages, run:
apt-get upgrade
If you want to upgrade your entire distribution, including the install of any new packages, type:
apt-get dist-upgrade
Once you install packages with apt-get, you should continue to manage them with the same package manager to maintain consistency. If you ever encounter errors that prevent something from being installed or removed, you can try this command to remedy it:
apt-get -f install
For complete documentation on apt-get, type man apt-get from the command line or view the documentation online.
Related Posts
- How to Install Software on a Linux Server
- How to Install Local RPM or DEB Files
- Linux server package management
- Linux Servers: In-box Upgrade vs. Fresh Install
- Are There Benefits to Manually Installing Software?

