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 lines tool like apt-get or yum.
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)
Different kinds of package managers
Package Managers differ based on the packaging system but the same packaging system may have more than one package manager.
APT
(Advanced Package Tool) is a package manager used in Linux-based operating systems such as Debian, Ubuntu, and their derivatives? It is a command-line tool that simplifies the installation, removal, and updating of software packages in the system.
To update the package list from repositories.
Sudo apt update
To upgrade all installed packages to the latest version
Sudo apt upgrade
To install any package
Sudo apt install <package_name>
To remove any package
Sudo apt remove <package_name>
To search for a package that contains the keyword
Sudo apt search <keyword>
To Show package information
Sudo apt show <package_name
YUM
(Yellowdog Updater, Modified) YUM is the default package manager for Red Hat-based distributions like CentOS and Fedora.
To update the package list from repositories.
Sudo yum update
To upgrade any installed packages to the latest version
Sudo yum upgrade
To install any package
Sudo yum install <package_name>
To remove any package
Sudo yum remove <package_name>
To search for a package that contains the keyword
Sudo yum search <keyword>
To Show package information
Sudo yum info <package_name>
Pacman
Pacman is the default package manager for Arch Linux and its derivatives. It is a command-line tool that allows you to search, install, update, and remove packages.
To update the package list from repositories.
Sudo pacman -syu
To install any package
sudo pacman -S package_name
To remove any package
sudo pacman -R package_name
To search for a package that contains the keyword
sudo pacman -Ss keyword
To Show package information
sudo pacman -Si package_name
Zypper
Zypper is the default package manager for SUSE Linux and openSUSE distributions.
To update the package list from repositories.
sudo zypper refresh
To upgrade any installed packages to the latest version
sudo zypper update
To install any package
sudo zypper install package_name
To remove any package
sudo zypper remove package_name
To search for a package that contains the keyword
sudo zypper search keyword
To Show package information
sudo zypper info package_name
You have to install docker and Jenkins in your system from your terminal using package managers.
Here are the commands to install Docker and Jenkins on Ubuntu using package managers:
To Install Docker:
Update the system package list:
Check the status of the docker service
Give permissions to the docker by adding the current user to the docker group.
Reboot system
sudo reboot
Docker is successfully installed and permissions are given.
To Install Jenkins:
Update the package list:
Install OpenJDK (To install Java it is mandatory) :
Add the Jenkins repository to APT sources:
Add the Jenkins repository to APT sources:
Update the package database with the Jenkins packages:
sudo apt-get update
Install Jenkins:
Start the Jenkins service:
Check the status of the Jenkins service:
Stop the service Jenkins and post before and after screenshots -
Before
-
After
Note: These commands assume that you are running Ubuntu as your operating system. The package manager used is APT. If you are using centOs use "yum install" in the place of "apt-get install".
2. systemd
systemd
is a system and service manager for Linux operating systems that have replaced the traditional SysV init scripting system. It is responsible for starting and managing system services, controlling system resources, and providing interfaces for system state management.
3.systemctl
systemctl
is a command-line interface that allows users to interact with systemd
to manage system services and system state. Here are some examples of systemctl
commands:
systemctl start <service>
- Start a system service.systemctl stop <service>
- Stop a system service.systemctl restart <service>
- Restart a system service.systemctl enable <service>
- Set a system service to start automatically at boot.systemctl disable <service>
- Prevent a system service from starting automatically at boot.systemctl status <service>
- Check the status of a system service.systemctl reload <service>
- Reload the configuration of a system service without stopping or starting it.systemctl mask <service>
- Mask a system service, preventing it from being started or enabled.systemctl unmask <service>
- Unmask a system service, allowing it to be started or enabled.
These commands can be useful for managing system services on Linux systems, including starting, stopping, and monitoring services as well as configuring which services start at boot.