What is Package Manager in Linux?
In simpler words, a package manager is a tool that allows users to install, remove, upgrade, configure and manage software packages on an operating system. The package manager can be a graphical application like a software centre or a command-line tool like apt-get or Pacman.
Package managers access central repositories of software packages, ensuring easy and secure software handling on Linux. To understand a package manager, you must understand what a package is.
What is a Package?
A package is usually referred to as an application but it could be a GUI application, command line tool or a software library (required by other software programs). A package is essentially an archive file containing the binary executable, configuration file and sometimes information about the dependencies.
A package is a compressed archive that contains software, its files, and information needed for installation and management. It simplifies software distribution and installation on Linux systems.
Different types of Package Managers:
Package Managers differ based on the packaging system but the same packaging system may have more than one package manager. Here are some types of package managers:
APT (Debian-based)
YUM (Red Hat-based)
DNF (Modern Red Hat-based)
Pacman (Arch Linux)
ZYpp (openSUSE)
Install Docker and Jenkins using Package Manager
For Docker:
To install docker, update your Linux system by using the
sudo apt-get update
command.After that, install docker by using the
sudo apt-get install docker.io
command.Must add the user to the docker group to make it run properly. To add, write
sudo usermod -aG docker $USER
command.-a
use for append,G
used for group and$USER
use for the current user.After that, use the
sudo reboot
command to save the change. The docker is ready to go.
For Jenkins:
To install Jenkins in your system, it is important to install Java on your system because without Java Jenkins will not work.
To install Java, write
sudo apt install openjdk-11-jdk
or any suitable version of Java.To import the Jenkins GPG key and add the Jenkins repository, use the following commands:
wget -q -O -
https://pkg.jenkins.io/debian/jenkins.io.key
| sudo apt-key add -
sudo sh -c 'echo deb
http://pkg.jenkins.io/debian-stable
binary/ > /etc/apt/sources.list.d/jenkins.list'
To update package information and install Jenkins, write
sudo apt update
and thensudo apt install jenkins
. Jenkins is ready for deployment.
systemctl and systemd
systemctl is used to examine and control the state of the “systemd” system and service manager. systemd is a system and service manager for Unix-like operating systems(most of the distributions, not all).
Check the status of the docker service
To check whether the docker is in running or stop state, use the
sudo systemctl status docker
command.It will show the status of the docker in your terminal whether it's running or stopped.
Stop the service Jenkins
First, check the status of Jenkins using
sudo systemctl status jenkins
which will show that it's running.To stop the service Jenkins, use
sudo systemctl stop jenkins
. It will inactive the service Jenkins.
systemctl vs service commands
systemctl command:
systemctl
is modern, used on systemd-based systems, offers control, and integrates with systemd's features.Syntax:
systemctl <action> <service>
Example:
systemctl start docker
service command:
service
is legacy, used on various systems, has simpler syntax, and is suitable for basic service management.Syntax:
service <service> <action>
Example:
service docker start
Note: Choose systemctl
for systemd-based systems and advanced control, and service
for simpler tasks or compatibility with various systems.
<Thanks for reading till the END. I hope this helps you Follow for more>