Day Seven: Installation Using Package Managers - The #90DaysOfDevOps Challenge
Welcome to Day 7 of the #90DaysOfDevOps challenge! Package managers are great tools for software management. These utilities streamline the process of installing, updating, and removing software packages on an operating system. In this article, we will explore how to do an installation using package managers. We will also explore the systemctl
command.
Understanding Package Managers: Package managers serve as the bridge between users and software packages. They facilitate tasks such as installation, removal, and updates of software components. Whether it's a graphical software center or a command-line tool like apt-get
or yum
, package managers simplify the software management process.
Ubuntu uses the APT (Advanced Package Tool) package manager as its primary tool for managing software installations. However, various other operating systems and Linux distributions employ different package managers for similar purposes. For instance, macOS relies on the Homebrew package manager, known as Brew, to facilitate software installations and management. On the other hand, CentOS and other Red Hat-based distributions typically uses the YUM (Yellowdog Updater, Modified) or DNF (Dandified YUM) package managers for handling software packages.
For this task, we will use Ubuntu and install Docker. The task further requires installing Jenkins.
Here are the steps to install Docker on Ubuntu:
Update the APT package index:
sudo apt update
Install the required packages to allow apt to use a repository over HTTPS:
sudo apt install apt-transport-https ca-certificates curl software-properties-common
Add Docker’s official GPG key:
curl -fsSL
https://download.docker.com/linux/ubuntu/gpg
| sudo apt-key add -
Add the Docker repository to APT sources:
sudo add-apt-repository "deb [arch=amd64]
https://download.docker.com/linux/ubuntu
$(lsb_release -cs) stable"
Update the APT package index again:
sudo apt update
Install Docker:
sudo apt install docker-ce
Docker should now be installed. You can verify the installation by checking the Docker version:
docker --version
Usingsystemctl
:
systemctl
is used to examine and control the state of systemd
system and service manager. systemd
is system and service manager for Unix like operating systems(most of the distributions, not all).
Now, let's explore using systemctl
to manage services like Docker and Jenkins.
Check Docker Service Status:
To check the status of the Docker service, you can use:
systemctl status docker
Stop Jenkins Service:
To stop the Jenkins service, you can use:
sudo systemctl stop jenkins
Comparingsystemctl
vsservice
:
systemctl
is a more powerful and flexible command compared to service
. While service
is a legacy command that is still available for backward compatibility, systemctl
provides more features and integrates better with systemd
, which is the default init system in most modern Linux distributions.
For example:
systemctl status docker
provides more detailed information compared toservice docker status
.systemctl
can manage not only services but also othersystemd
units like sockets, targets, timers, and more.
That concludes our journey for Day 7 of the #90DaysOfDevOps challenge. In summary, today we explored the world of package managers and systemctl, essential tools for software management and service control in Linux environments. Stay tuned for more exciting challenges and insights as we continue our DevOps journey together.