What is a Package Manager?
A package manager is a software tool that automates the process of installing, updating, configuring, and removing software packages on a Linux operating system.
Package managers typically use a package repository, which is a centralized database of software packages and their dependencies, to download and install packages. The repository contains pre-compiled software packages, which can be easily installed with a few commands, saving the user the trouble of manually downloading and installing each package.
Package managers also handle dependencies, which are other software packages that are required for a particular package to function properly. When a user requests to install a package, the package manager automatically checks for the required dependencies and installs them if necessary.
Some popular package managers in Linux include:
APT (Advanced Packaging Tool) - used by Debian-based distributions like Ubuntu, Mint, and Debian itself.
YUM (Yellowdog Updater Modified) - used by Red Hat-based distributions like Fedora and CentOS.
DNF (Dandified YUM) - a modern version of YUM, used by Fedora and CentOS 8 and newer.
Pacman - used by Arch Linux and its derivatives.
Zypper - used by openSUSE.
What is a Package?
A package is a collection of files and software components that are bundled together for easy distribution and installation. A package typically includes the software application or library, along with any necessary configuration files, documentation, and dependencies.
A package is often distributed in a compressed archive file with a specific file extension, such as .deb or .rpm. These archives contain pre-compiled binary files, as well as information about the package, such as its version number, dependencies, and license.
When a package is installed, the package manager automatically extracts the files from the archive and places them in the appropriate locations on the system, such as the /usr/bin
or /usr/lib
directories.
Installing some tools/packages on a Linux system
Installing software packages is a common task for Linux users, whether you are running Ubuntu or CentOS. The good news is that both Ubuntu and CentOS come with powerful package managers that make it easy to install and manage software packages on your system. In this article, we will walk you through the steps to install some common software tools using package managers on Ubuntu.
Let's install a few tools on our Ubuntu system:
Installing Docker:
Connect to your EC2 instance using SSH. You can use the terminal or PuTTY (if you are using a Windows machine).
Update the package index on your EC2 instance by running the following command:
sudo apt-get update
Install Docker by running the following commands:
ubuntu@ip-172-31-8-120:~$
sudo apt-get install apt-transport-https ca-certificates curl gnupg-agent software-properties-common
ubuntu@ip-172-31-8-120:~$
curl -fsSL
https://download.docker.com/linux/ubuntu/gpg
| sudo apt-key add -
ubuntu@ip-172-31-8-120:~$
sudo add-apt-repository "deb [arch=amd64]
https://download.docker.com/linux/ubuntu
$(lsb_release -cs) stable"
ubuntu@ip-172-31-8-120:~$
sudo apt-get update
ubuntu@ip-172-31-8-120:~$
sudo apt-get install docker-ce docker-ce-cli
containerd.io
Verify that the Docker installation is successful:
which docker
docker --version
Installing Jenkins:
Install Java on your Linux system by running the following command:
sudo apt-get install default-jre
Add the Jenkins repository key to your system by running the following command:
wget -q -O -
https://pkg.jenkins.io/debian-stable/jenkins.io.key
| sudo apt-key add -
Add the Jenkins repository to your system by running the following command:
sudo sh -c 'echo deb
https://pkg.jenkins.io/debian-stable
binary/ > /etc/apt/sources.list.d/jenkins.list'
Update the package index again by running the following command:
sudo apt-get update
Install Jenkins by running the following command:
sudo apt-get install jenkins
Start the Jenkins service by running the following command:
sudo systemctl start jenkins
What are systemctl and systemd?
systemctl is a command-line utility that is used to control and manage the services (i.e., daemons or background processes) running on a Linux system. It is a part of the systemd init system, which is a system and service manager for Linux that is used in many modern Linux distributions.
With systemctl, you can start, stop, restart, reload, enable, disable, and check the status of services on a Linux system. For example, you can use the command "sudo systemctl start apache2" to start the Apache web server or "sudo systemctl status ssh" to check the status of the SSH service.
Systemd is responsible for starting and managing system services during the boot process and while the system is running.
In simpler terms, systemd is a tool that helps manage the various programs and services running on a Linux system. It starts up these programs and services when the system boots and makes sure they keep running in the background while the system is up and running.
One of the main advantages of systemd is that it provides better startup performance, dependency management, and parallel service initialization compared to the traditional SysV init system used in older Linux distributions. It can also manage system resources like CPU, memory, and network sockets, and provides centralized logging and monitoring capabilities.
Happy Learning!