Linux Made Easy: Day 7 Unveil - Package Managers and systemctl
Discover the Basics of Linux Management for a Smooth Computing Experience
Introduction:
Welcome to the world of Linux management, where we uncover the basics of package managers and systemctl - essential tools for handling software and services on your operating system.
Understanding Package Managers:
Think of a package manager as your friendly assistant that helps you easily install, remove, and manage software on your computer. These can be graphical tools or command-line buddies like apt-get or pacman. When we talk about "packages," we mean bundles of software that include everything needed for an application to run – like its main program, settings, and sometimes other programs it relies on.
Different Kinds of Package Managers:
Different Linux systems have different package managers. For example, CentOS uses Yum and DNF, while Ubuntu uses apt-get. These tools make sure you can get the software you need without headaches.
Installing Docker and Jenkins Using Package Managers:
Let's dive into a simple way to install two popular tools - Docker and Jenkins - on both Ubuntu and CentOS.
Ubuntu:
Open your terminal.
Type:
sudo apt-get update
(this updates your software list).
After running the command, you will be able to see the screen as depicted below.
- Type:
sudo apt-get install
docker.io
(this installs Docker)
You will be prompted to type 'Y' during the installation. After typing 'Y,' you will be able to verify that Docker is installed on your system by running the following command: docker --version
Enable Jenkins Repository (If Not Available):
If the
jenkins
package is not available in the default repositories, you may need to add the Jenkins repository. Follow these steps:a. Add the Jenkins Repository Key:
bashCopy codewget -q -O - https://pkg.jenkins.io/debian/jenkins.io.key | sudo apt-key add -
b. Add the Jenkins Repository to your sources.list:
bashCopy codeecho "deb http://pkg.jenkins.io/debian-stable binary/" | sudo tee -a /etc/apt/sources.list
c. Update Package Lists Again:
Run the update command again to ensure your system is aware of the Jenkins repository:
sudo apt-get update
d. Install Jenkins:
Now, you should be able to install Jenkins using:
sudo apt-get install jenkins
CentOS:
Open your terminal.
Type:
sudo yum install docker
(this installs Docker).Type:
sudo yum install jenkins
(this installs Jenkins).
That's it! You've just installed Docker and Jenkins without any fuss.
Exploring systemctl and systemd:
Now, let's check out another tool called "systemctl." It helps us understand and control the state of services on our system, like Docker.
Checking Docker Service Status:
After installing Docker, you can see its status by typing: systemctl status docker
in your terminal. This tells you if Docker is running properly.
Managing Jenkins Service:
If you want to stop Jenkins, type: sudo systemctl stop jenkins
.
systemctl vs service:
Lastly, compare systemctl with an older tool called "service." For Docker, you can try: systemctl status docker
and service docker status
. Notice the differences in commands and information provided.
systemctl status docker
provides detailed information using the modern systemd
manager. On the other hand, service docker status
offers a simpler output, representing an older method. systemctl
is favored for its consistency, additional functionalities, and broader adoption in modern Linux systems, while service
may still be encountered in legacy environments.
Conclusion:
In this simple guide, we've covered the basics of Linux management. By understanding package managers and trying out systemctl, you're now equipped to handle software and services on your Linux system. Remember, it's all about making your Linux journey smoother and more enjoyable!