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 centre or a command line tool like apt-get or pacman.
You’ll often find me using the term ‘package, to understand 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.
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.
For example, RPM has Yum and DNF package managers. For DEB, you have apt-get, aptitude command line-based package managers.
There are two popular package managers APT (Advanced Package Tool) and YUM (Yellowdog Updater Modified).
APT (Advanced Package Tool):
APT is widely used in Debian-based distributions like Ubuntu and is known for its user-friendly command-line interface. This package manager simplifies the process of interacting with the package management system, making it easier for users to perform various operations.
With APT, you can effortlessly install, update, and remove packages using simple commands:
To install a package:
sudo apt-get install package_name
To update packages:
sudo apt-get update
followed bysudo apt-get upgrade
To remove a package:
sudo apt-get remove package_name
One of the significant advantages of APT is its automatic resolution of package dependencies. When you install a package, APT ensures that all required dependencies are also installed, preventing any conflicts or issues.
YUM (Yellowdog Updater Modified):
YUM is commonly used in Red Hat-based distributions like CentOS and Fedora. Similar to APT, YUM provides a command-line interface for managing packages, making it convenient for users to handle software installations.
To install a package:
sudo yum install package_name
To update packages:
sudo yum update
followed bysudo apt-get upgrade
To remove a package:
sudo yum remove package_name
One of the key features of YUM is its ability to manage package dependencies seamlessly. When you install or update a package using YUM, it automatically resolves dependencies, ensuring that all required packages are downloaded and installed correctly.
Understanding systemctl and systemd
systemctl: Systemctl
is a command-line utility used to manage system services in Linux distributions that adopt the systemd init
system. Systemd
is a system and service manager that provides advanced features such as process management, logging, and service dependencies.
systemd: systemd
is an init system and system manager that has widely become the new standard for Linux distributions. Learning about and using the tools and daemons that comprise systemd
will help you better appreciate the power, flexibility, and capabilities it provides, or at least help you to do your job with less hassle.
Installation of Docker.io and Jenkins using the package manager:
install docker on an Ubuntu machine.
Update the package index to ensure you have the latest package information:
sudo apt update
- Install Docker:
sudo apt install docker.io
- Start the Docker service and enable it to start on boot:
sudo systemctl start docker
sudo systemctl enable docker
- Verify Docker installation by running:
docker --version
Install Jenkins on ubuntu:
- Add the Jenkins repository key to the system:
wget -q -O - https://pkg.jenkins.io/debian/jenkins.io.key | sudo apt-key add
- Add the Jenkins repository to your
apt
sources:
sudo sh -c 'echo deb http://pkg.jenkins.io/debian-stable binary/ > /etc/apt/sources.list.d/jenkins.list'
- Update the package index :
sudo apt update
- Install Jenkins:
sudo apt install jenkins
- Start the Jenkins service:
sudo systemctl start jenkins
- Enable Jenkins to start on boot:
sudo systemctl enable jenkins
- Jenkins runs on port 8080. You may need to allow traffic on this port if you have a firewall set up:
sudo ufw allow 8080
Now you should have both Docker and Jenkins installed and running on your Ubuntu system. You can access Jenkins by opening a web browser and navigating to http://your_server_ip:8080
. Follow the setup instructions to complete the Jenkins installation.
Stopping the Jenkins Service.
sudo systemctl stop jenkins.
Difference between systemctl and service
systemctl
and service
are both commands used to manage services in Linux, but they have some differences in their functionality and usage.
systemctl
is a more modern and powerful service management utility introduced with systemd, which is the default init system in many modern Linux distributions.
It has some features for controlling services, including starting, stopping, restarting, enabling (starting at boot), disabling (not starting at boot), and checking the status of services.
service:
service
is a legacy command used in init-based systems (SysVinit) to manage services.
It is still available in many Linux distributions for backward compatibility but is being phased out in favor of systemctl
.
service
provides a simpler interface for starting, stopping, and restarting services, but it has fewer features compared to systemctl
.
Thank you for reading!
Contact me at :
linkedin: https://www.linkedin.com/in/sutish-pradhan/
E-mail: psutish@gmail.com