Table of contents
- 1. Package Manager
- What is a Package?
- How does the package manager work?
1. Package Manager
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.
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.
How does the package manager work?
The package manager is a generic concept and it’s not exclusive to Linux. You’ll often find package managers for different software or programming languages. There is a PIP package manager just for Python packages.
Almost all Linux distributions have software repositories which is a collection of software packages. Yes, there could be more than one repository. The repositories contain software packages of different kinds.
Repositories also have metadata files that contain information about the packages such as the name of the package, version number, description of the package and the repository name etc. This is what you see if you use the apt show command in Ubuntu/Debian.
Your system’s package manager first interacts with the metadata. The package manager creates a local cache of metadata on your system. When you run the update option of the package manager (for example apt update), it updates this local cache of metadata by referring to metadata from the repository.
When you run the installation command of your package manager (for example apt install package_name), the package manager refers to this cache. If it finds the package information in the cache, it uses the internet connection to connect to the appropriate repository and downloads the package first before installing on your system.
A package may have dependencies. Meaning that it may require other packages to be installed. The package manager often takes care of the dependencies and installs them automatically along with the package you are installing.
Types of Package Managers:
1. DPKG – Debian Package Management System
APT (Advanced Packaging Tool) :
It is a very popular, free, powerful, and more so, useful command line package management system that is a front end for the DPKG package management system.
Users of Debian or its derivatives such as Ubuntu and Linux Mint should be familiar with this package management tool.
Aptitude Package Manager
This is also a popular command line front-end package management tool for the Debian Linux family, it works similarly to APT. It was initially built for Debian and its derivatives but now its functionality stretches to the RHEL family.
2. RPM (Red Hat Package Manager)
YUM (Yellowdog Updater, Modified)
It is an open-source and popular command line package manager that works as an interface for users to RPM. You can compare it to APT under Debian Linux systems, it incorporates the common functionalities that APT has.
3. Pacman Package Manager – Arch Linux
4. Zypper Package Manager – openSUSE
5. Portage Package Manager – Gentoo
2. You have to install docker and Jenkins in your system from your terminal using package managers
Jenkins:
To install Jenkins you first have to install Java. So there are some steps to install Java:
Now you can install Jenkins. Steps to be followed as:
With Jenkins installed and a firewall configured, you have completed the installation stage and can continue with configuring Jenkins.
Docker installation:
step 1: sudo apt update -y
step 2: sudo apt install docker.io -y
step 3: docker --version
step 4: systemctl status docker [ to check if docker is in the active state]
3. 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).
4. stop the service Jenkins and post before and after screenshots
Jenkins active status Screenshot:
Jenkins stop Screenshot :
5. Read about the commands systemctl vs service
The Service command looks up the script to run at the path /etc/init.d/SCRIPT. It then runs the script, passing the COMMAND unchanged as the arguments. The service command guarantees a predictable running environment by removing most of the variables and setting the root path as the current working directory.
eg: sudo service jenkins start
The systemctl command interacts with the SystemD service manager to manage the services. Contrary to the service command, it manages the services by interacting with the SystemD process instead of running the init script.
To start, stop, and restart a process, we can run the commands with systemctl .
eg: sudo systemctl start docker