What are Package managers?
- Package managers are responsible for making sure you don’t get drowned in a complex list of inter-dependent software that you require for your application to run. They perform the following tasks.
- Keep a list of trusted remote repositories from where the packages can be downloaded and installed.
- Maintain a local index of all the available and installed packages.
- Keep track of what packages are needed as dependencies for a particular package.
- Perform package installations including bringing in the dependencies, adding binaries to
PATH
and making system-wide changes. - Update packages when a newer version comes in the remote repository.
apt
and yum
.
Note: If you are planning on using Ubuntu or Debian, follow the apt
package manager section. On the other hand, if you use CentOS you can skip ahead to yum
package manager instead.
[cta_inline]
APT package manager
Advanced Packaging Tool (or APT) is the defacto package manager for many variants of Debian and Ubuntu operating systems. It installs packages system-wide and therefore requires root privileges to carry out the task. That’s why most commands below begin withsudo
. If you are already logged in as the root
user, you may skip the sudo
part of the command.
Install a package
To install a package namedPACKAGE_NAME
, all you need to do is run:
$ sudo apt-get install PACKAGE_NAME
Or you can use a shorter command:
$ sudo apt install PACKAGE_NAME
What happens here is that the apt-get utility consults a local index of package names sees a match for PACKAGE_NAME
and gets the package and necessary dependencies for it from a list of trusted URLs. It then installs the package and its dependencies and makes a note about these newer additions that are made to the system.
The command may nag you to confirm that you want to install the package, by entering y
or yes
if you want to avoid that, use the -y
flag.
$ sudo apt-get install -y PACKAGE_NAME
You can also use the -qq
flag which updates the system without printing anything to the terminal. This is useful when you are writing shell scripts to automate any apt
related task.
Install packages from your filesystem
Debian and Ubuntu packages typically come as files with.deb
extension. If you have one of these in your local filesystem you can install it by first traversing to the directory where the file is located and then running:
$ sudo dpkg -i FILENAME
dpkg
is the utility that is responsible for the actual installation and configuration in the backend. apt
interfaces with it every time it needsContinue reading this article
by subscribing to our newsletter.
Subscribe nowby subscribing to our newsletter.
A note about tutorials: We encourage our users to try out tutorials, but they aren't fully supported by our team—we can't always provide support when things go wrong. Be sure to check which OS and version it was tested with before you proceed.
If you want a fully managed experience, with dedicated support for any application you might want to run, contact us for more information.