How to Use Package Managers with Systemctl: A Simple Guide. #Day-7
What is a package manager in Linux?
A package manager in Linux is a software tool that automates the process of installing, updating, configuring, and removing software packages.
It manages dependencies, ensuring that all required libraries and components are installed along with the main software.
Package managers also handle software repositories, which are centralized locations where software packages are stored and maintained.
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 center or a command line tool like apt-get or pacman.
What is a package?
A package in Linux is like a bundle that contains everything you need to install and run a particular piece of software. This bundle includes the actual software files, plus extra information like the software's name, version, and what other software it needs to work properly.
It also contains scripts to help install, update, or remove the software. Packages make it easy to manage software on your system, ensuring everything is set up correctly and efficiently.
Here are some key components of a package:
Executable files: The actual binaries or scripts that make up the software.
Libraries: Shared code that the software depends on.
Configuration files: Files used to configure the software.
Metadata: Information about the package, such as its name, version, description, and dependencies.
Installation scripts: Scripts that handle tasks that need to be performed during installation, upgrading, or removal of the package.
Different package managers in Linux:
APT (Advanced Package Tool): Used in Debian-based distributions like Ubuntu.
YUM (Yellowdog Updater Modified) / DNF (Dandified YUM): Used in Red Hat-based distributions like Fedora and CentOS.
Pacman: Used in Arch Linux.
Zypper: Used in openSUSE.
RPM (Red Hat Package Manager): Used for managing .rpm packages in distributions like Red Hat Enterprise Linux.
Here are the steps to install Docker and Jenkins on a Linux system using package managers.
Installing Docker
Update your package index
sudo yum update -y
Install prerequisite packages:
sudo yum install -y yum-utils device-mapper-persistent-data lvm2
Add the Docker repository:
sudo yum-config-manager --add-repo https://download.docker.com/linux/centos/docker-ce.repo
Install Docker:
sudo yum install -y docker-ce docker-ce-cli containerd.io
Start the Docker service:
sudo systemctl start docker
Enable Docker to start on boot:
sudo systemctl enable docker
Verify Docker installation:
sudo systemctl status docker
docker --version
Installing Jenkins
Step - 1 : Create Linux VM
Create Ubuntu VM using AWS EC2 (t2.medium)
Enable 8080 Port Number in Security Group Inbound Rules
Connect to VM using MobaXterm
Step-2 : Instal Java
sudo apt update
sudo apt install fontconfig openjdk-17-jre
java -version
Step-3 : Install Jenkins
sudo wget -O /usr/share/keyrings/jenkins-keyring.asc \
https://pkg.jenkins.io/debian-stable/jenkins.io-2023.key
echo deb [signed-by=/usr/share/keyrings/jenkins-keyring.asc] \
https://pkg.jenkins.io/debian-stable binary/ | sudo tee \
/etc/apt/sources.list.d/jenkins.list > /dev/null
sudo apt-get update
sudo apt-get install jenkins
Step-4 : Start Jenkins
sudo systemctl enable jenkins
sudo systemctl start jenkins
Step-5 : Verify Jenkins
sudo systemctl status jenkins
Step-6 : Open jenkins server in browser using VM public ip
http://public-ip:8080/
Step-7 : Copy jenkins admin pwd
sudo cat /var/lib/jenkins/secrets/initialAdminPassword
Adjust firewall settings to allow traffic on port 8080 (Jenkins default port):
After following these steps, you can access Jenkins by opening your web browser and navigating to http://your_server_ip_or_domain:8080
.
Conclusion
Understanding package managers and systemctl is crucial for efficiently managing software and services on a Linux system. Package managers simplify the process of installing, updating, and removing software, ensuring that all dependencies are handled automatically. They provide a streamlined way to manage software repositories and maintain system stability. On the other hand, systemctl is an essential tool for managing system services, allowing users to start, stop, enable, and monitor services with ease. By mastering these tools, users can ensure their Linux systems are well-maintained, secure, and running smoothly.
Connect and Follow Me On Socials :
Like👍 | Share📲 | Comment💭
Subscribe to my newsletter
Read articles from Nikunj Vaishnav directly inside your inbox. Subscribe to the newsletter, and don't miss out.
Written by
Nikunj Vaishnav
Nikunj Vaishnav
👋 Hi there! I'm Nikunj Vaishnav, a passionate QA engineer Cloud, and DevOps. I thrive on exploring new technologies and sharing my journey through code. From designing cloud infrastructures to ensuring software quality, I'm deeply involved in CI/CD pipelines, automated testing, and containerization with Docker. I'm always eager to grow in the ever-evolving fields of Software Testing, Cloud and DevOps. My goal is to simplify complex concepts, offer practical tips on automation and testing, and inspire others in the tech community. Let's connect, learn, and build high-quality software together! 📝 Check out my blog for tutorials and insights on cloud infrastructure, QA best practices, and DevOps. Feel free to reach out – I’m always open to discussions, collaborations, and feedback!