Table of contents
Hello Readers,
Here we are Day 7 of #90daysofdevops
👣 Topics for #day7
Package Manager in Linux
Command Systemctl
Systemctl v/s Service
Package Manager in Linux
A Package Manager is a software tool that is used for the installation, removal, and updating of software packages. It is a critical component of any Linux distribution, as it helps users manage the software installed on their system and ensures that their system is up-to-date with security patches and bug fixes.
Package Managers work by maintaining a database of available packages, their versions, and their dependencies. The database is usually populated with packages from one or more software repositories, which are remote servers that host packages for download.
The most commonly used package managers in Linux are APT (Advanced Packaging Tool), YUM (Yellowdog Updater Modified), and DNF (Dandified Yum).
Here's an example of how package management works in Linux using the APT package manager:
Updating Package Lists: The first step is to update the package lists from the configured repositories. This can be done using the
apt update
command.-
Installing Packages: Once the package lists are updated, you can install packages using the
apt install
command.For example, to install the "nginx" web server, we would run the command
apt install nginx
. APT will check the package lists for the latest version of the package and its dependencies, and then download and install them. Removing Packages: To remove a package, you can use the
apt remove
command, followed by the name of the package.For example, to remove the "nginx" package, you would run the command
apt remove nginx
. APT will remove the package and its dependencies that are no longer needed.Updating Packages: To update packages, you can use the
apt upgrade
command. This command will download and install updates for all packages on the system. To update a specific package, you can use theapt install
command followed by the name of the package.Searching Packages: You can search for packages using the
apt search
command, followed by a keyword.For example, to search for packages related to "python", you would run the command
apt search python
. APT will search the package lists for packages that match the keyword and display the results.
Listing Installed Packages: To list all installed packages, you can use the apt list --installed
command. This command will display a list of all packages that are currently installed on the system.
Collectively Package Managers in Linux provide an efficient and streamlined way of managing software packages on a Linux system.
They make it easy to install, remove, and update packages, as well as to search for new packages and manage dependencies.
Systemctl
➤Systemctl is a command-line tool in Linux that is used to control and manage the systemd system and service manager. It is the primary tool used to manage services and daemons on most modern Linux systems.
➤Systemd is an init system and service manager that is used to manage the boot process and coordinate system services.
Systemctl provides a comprehensive set of commands that can be used to manage systemd services, including starting and stopping services, enabling and disabling services at boot time, querying the status of services, and inspecting the system logs.
Most commonly used systemctl commands are listed below:
systemctl start <service>
: Starts a systemd servicesystemctl stop <service>
: Stops a systemd servicesystemctl restart <service>
: Restarts a systemd servicesystemctl enable <service>
: Enables a systemd service to start automatically at boot timesystemctl disable <service>
: Disables a systemd service from starting automatically at boot timesystemctl status <service>
: Displays the status of a systemd servicesystemctl list-unit-files
: Lists all available systemd units and their statessystemctl daemon-reload
: Reloads the systemd configuration files
Systemctl also provides some additional features, such as socket activation, which allows services to be started on-demand when a socket is accessed.
Collectively, systemctl is a powerful tool that simplifies the management of services and daemons on Linux systems. Its comprehensive set of commands and features make it an essential tool for system administrators and users who need to manage system services.
Systemctl v/s Service
Systemctl and Service are both tools used to manage system services on Linux systems, but there are some key differences between the two.
➤Systemctl is a command-line tool that is used to control and manage the systemd system and service manager. It is the primary tool used to manage services and daemons on most modern Linux systems. Systemctl provides a comprehensive set of commands that can be used to manage systemd services, including starting and stopping services, enabling and disabling services at boot time, querying the status of services, and inspecting the system logs.
Format: systemctl <action> <servicename>
Example: systemctl status docker
➤Service is a command-line tool that is used to manage services on older Linux systems that use the SysVinit system. Service provides a simple way to start, stop, and restart services, but it does not provide the same level of control and flexibility as systemctl. Service is still available on many modern Linux systems for compatibility reasons, but systemctl is the recommended tool for managing services on these systems.
Format: service <servicename> <action>
Example: service docker status
Collectively, systemctl is the recommended tool for managing services on modern Linux systems that use the systemd system and service manager, while service is a simpler tool that is used on older Linux systems that use the SysVinit system.
Thank you for reading my Blog. I hope you have learnt something from it! If you find this blog helpful, please like, share, and follow me for more interesting posts like this in the future.
Please navigate to my GitHub Repo: GitHub Repo Link
to check my solutions for the tasks of 90daysofdevops Challenge.