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 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.
Tasks
- You have to install docker and jenkins in your system from your terminal using package managers.
To install Docker on Linux, follow these steps:
Update the package index:
sudo apt-get update
curl -fsSL https://download.docker.com/linux/ubuntu/gpg | sudo apt-key add -
sudo add-apt-repository "deb [arch=amd64] https://download.docker.com/linux/ubuntu $(lsb_release -cs) stable"
sudo apt-get update
sudo apt-get install docker-ce docker-ce-cli containerd.io
To install Jenkins on Ubuntu, you can follow these steps:
Add the Jenkins repository key to the system:
wget -q -O - https://pkg.jenkins.io/debian-stable/jenkins.io.key | sudo apt-key add - sudo sh -c 'echo deb https://pkg.jenkins.io/debian-stable binary/ > /etc/apt/sources.list.d/jenkins.list' sudo apt-get update sudo apt-get install jenkins sudo systemctl status jenkins
If the service is running, you should see a message that says "active (running)".
Open your web browser and navigate to
http://localhost:8080
. You should see the Jenkins setup wizard.Follow the steps in the setup wizard to configure Jenkins. You will be asked to provide an initial admin password, which you can find in the file
/var/lib/jenkins/secrets/initialAdminPassword
.That's it! Jenkins is now installed on your Ubuntu system and ready to use.
systemctl
systemctl
is a command-line utility in Linux-based operating systems that is used to manage and control the systemd system and service manager.
Systemd is a system and service manager that manages the boot process, system services, and other critical system functions in Linux. systemctl
is used to control and monitor systemd units, which include system services, timers, sockets, and devices.
Here are some common uses of systemctl
:
Starting and stopping services:
systemctl start service-name
orsystemctl stop service-name
.Enabling and disabling services:
systemctl enable service-name
orsystemctl disable service-name
. This configures the service to start automatically on boot or not.Restarting services:
systemctl restart service-name
.Checking the status of services:
systemctl status service-name
.Reloading systemd configuration:
systemctl daemon-reload
.Listing all available services:
systemctl list-unit-files --type=service
.
These are just a few examples of how systemctl
can be used. It is a powerful tool that provides a centralized way to manage system services and other important functions in Linux-based systems.
systemd
systemd
is a system and service manager that is used in many modern Linux distributions. It is responsible for managing the system startup process, system services, and other critical system functions. It replaces the traditional SysV init system used in earlier versions of Linux.
Here are some of the main uses of systemd
in Linux:
Boot process management:
systemd
is responsible for managing the boot process, including loading the kernel and initializing system services and devices.Service management:
systemd
manages system services, which are programs that run in the background and provide functionality to the system.systemd
can start, stop, restart, and manage the status of services.Resource management:
systemd
manages system resources, including CPU, memory, and I/O, to ensure that system performance is optimized.Logging:
systemd
provides a centralized logging system for system events and service output.Container management:
systemd
can be used to manage containerized applications using technologies like Docker.Timer management:
systemd
provides a timer system that can be used to schedule tasks and services.User session management:
systemd
manages user sessions and can start, stop, and manage user-level services.
In summary, systemd
is a powerful system and service manager that provides a centralized way to manage critical system functions in modern Linux distributions.