Photo by freestocks on Unsplash
Advanced Packaging Tool (apt) in Ubuntu
Lets understand what is package manger with a practical example
What is a package?
In the context of Linux, a package is a collection of files that are bundled together and distributed over the internet. These packages contain the code, libraries, and any other resources that are needed to run a piece of software on the system.
Packages are typically created by the developers of the software and are made available for download from online repositories or package repositories.
In simple words, any software is a package.
There are different package formats and we need a package manager to install, remove, and update packages.
For example, DEB (.deb
extension) is the default package format on many popular Linux distributions, including Ubuntu and Debian. DEB packages are typically installed using the apt package manager.
What is a package manager?
A package manager is a software application that helps the user to install, remove, upgrade, configure and manage software packages on an operating system.
The package manager can be a GUI application like a synaptic package manager or a CLI tool like apt (Advanced Packaging Tool).
There are many different package managers available for Linux systems, each with its own set of features and capabilities. Some common package managers for Linux include:
apt: default package manager on Ubuntu and Debian. It is a CLI package manager with the capabilities of installing, updating and removing software packages from online repositories.
yum: This is the default package manager on many Red Hat-based Linux distributions, such as Fedora and CentOS.
Using apt to install software on Ubuntu
Let's understand the utility of package manager by installing some software. We are going to install docker
on ubuntu using apt
package manager.
Installing a package/software using apt
is quite easy. For example, to install a package on a Ubuntu system we just need to type on the terminal
sudo apt install <package_name
But before that, we need to update the APT package index. Let's install docker in Ubuntu step by step
- Update the
apt
package index:
sudo apt update
- Install packages to allow
apt
to use a repository over HTTPS:
sudo apt install apt-transport-https ca-certificates curl gnupg-agent software-properties-common
- Add the Docker GPG key:
curl -fsSL https://download.docker.com/linux/ubuntu/gpg | sudo apt-key add -
- Add the Docker repository to
apt
:
sudo add-apt-repository "deb [arch=amd64] https://download.docker.com/linux/ubuntu $(lsb_release -cs) stable"
- Update the
apt
package index again:
sudo apt update
- Finally, install Docker:
sudo apt install docker-ce docker-ce-cli containerd.io
- Verify that Docker has been installed correctly by running the following command, which should print the version number of Docker:
docker --version
Congratulations, we successfully installed docker on Ubuntu system using apt
package manager.