What is a 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 center or a command line tool like apt-get or pacman.
You’ll often find me using the term ‘package’ in tutorials and articles, To understand package manager, you must understand what a package is.
What is a package?
A package is usually referred to 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.
Different kinds of package managers
Package Managers differ based on packaging system but the same packaging system may have more than one package manager.
For example, RPM has Yum and DNF package managers. For DEB, you have apt-get, aptitude command line-based package managers.
You have to install docker and Jenkins in your system from your terminal using package managers
sudo apt-get update
Install Docker using the command:
sudo apt-get install docker-ce
Verify that Docker is installed correctly by running the command:
docker --version
Installing Jenkins:
Add the Jenkins repository key to your system using the command:
wget -q -O - https://pkg.jenkins.io/debian/jenkins.io.key | sudo apt-key add -
Update the package manager’s cache using the command:
sudo apt-get update
Install Jenkins using the command:
sudo apt-get install jenkins
Start the Jenkins service using the command:
sudo systemctl start jenkins
Enable the Jenkins service to start on boot using the command:
sudo systemctl enable jenkins
- Write a small blog or article to install these tools using package managers on Ubuntu and CentOS
Enter the following command to check the status of the Docker service:
sudo systemctl status docker
This command will display the current status of the Docker service, including whether it’s running or not.
- check the status of docker service in your system (make sure you completed above tasks, else docker won't be installed)
Stop the service Jenkins and post before and after screenshots
Before:
After:
- Read about the commands systemctl vs service
systemctl and service are both tools used to manage and control services on a Linux system. However, they have some differences:
systemctl is the newer tool and is used on systems that use the Systemd init system, which is now widely adopted as the default init system for many popular Linux distributions, including Fedora, Red Hat Enterprise Linux, and Ubuntu.
service is the older tool and is used on systems that use the System V init system, which was the previous standard init system used in many popular Linux distributions.
systemctl provider more advanced features compared to service, such as the ability to manage units, which are the basic building blocks of Systemd. This allows you to manage not just services, but also other system components, such as sockets, devices, and mount points, with a unified interface.
service is limited to managing services only, and its syntax and options are not as advanced as those of systemctl.
systemctl commands :
systemctl start <service-name>
systemctl stop <service-name>
systemctl restart <service-name>
systemctl enable <service-name>
systemctl disable <service-name>
systemctl status <service-name>
service commands :
service <service-name> start
service <service-name> status
service <service-name> stop
service <service-name> restart