๐ง๐ฆ DevOps 1.3: Package Management in Linux ๐๐ป
"Mastering Linux Package Management ๐ฆ๐ง"
INTRODUCTION -
Welcome to DevOps 1.3! In this edition, we delve into the fascinating world of package management in Linux. Discover how to efficiently install, update, and manage software packages on your Linux system, empowering you to streamline your development process and enhance system stability. Let's embark on this journey of efficient package management! ๐ฆ๐ง
"Mastering Package Installation: A Manual Approach ๐ฆ๐ป"
tree /var/log
- It shows a directory in a tree structure. It will show all the directories and subdirectories in a tree structure.
Above you can see the tree package is not available. So let's install it from Google.
Install the package according to your system's Linux configurations. Since mine is Fedora Arch 64, I'll proceed with installing the marked package.
Copy the link address of that link. And use the curl command to access the link and store the output (-o
) in a file as shown below.
If you do ls
now then you will find the rpm file in your current working directory. Now let's install the package using the below command - rpm -ivh <filename>
- -i
flag to install, v
is for verbose which means printing, h
is for printing in human-readable format. e.g - rpm -ivh tree-2.1.0-2.fc38.aarch64.rpm
Now let's see if the tree command is working or not.
Now you can see the directory is in a tree structure.
โ ๏ธ Challenges in Manual Installation โ๏ธ:
During the package installation process, you may encounter prompts to install all necessary dependencies before proceeding with the package installation which is a troublesome task. E.g. below
As you can see it shows failed dependencies.
NOTE - You can see more options in rpm by using rpm --help
To overcome this we can use the YUM package manager.
Discover the Power of YUM: ๐ฆ๐ง
YUM (Yellowdog Updater, Modified) is a package manager for Linux operating systems, designed to automate the process of installing, updating, and removing software packages. It simplifies package management by resolving dependencies and providing an easy-to-use command-line interface. YUM is commonly used in RPM-based Linux distributions such as Fedora, CentOS, and Red Hat Enterprise Linux.
Yum does all this by using some configuration files in the below directory.
cd /etc/yum.repos.d/
During the installation of the Linux operating system, these files configure access to repositories on the internet. As a result, users gain access to a range of software and packages provided by the operating system.
You can search for the package using the yum search command as shown below yum search httpd
yum install httpd
- To install a package.
yum remove httpd
- To remove that particular package.
Package Absence: What to Do When a Package is Not Present? ๐ฆ๐
For that, you can search the internet where you can find the steps to install Jenkins. In the case of fedora you can find install the below -
sudo wget -O /etc/yum.repos.d/jenkins.repo \
https://pkg.jenkins.io/redhat-stable/jenkins.repo
sudo rpm --import https://pkg.jenkins.io/redhat-stable/jenkins.io-2023.key
sudo dnf upgrade
# Add required dependencies for the jenkins package
sudo dnf install java-17-openjdk
sudo dnf install jenkins
sudo systemctl daemon-reload
# Lets go line by line -
sudo wget -O /etc/yum.repos.d/jenkins.repo \
https://pkg.jenkins.io/redhat-stable/jenkins.repo
# The above code is importing the output into /etc/yum.repos.d/jenkins.repo
# file from the link
[root@bazinga ~] cat /etc/yum.repos.d/jenkins.repo
[jenkins]
name=Jenkins-stable
baseurl=http://pkg.jenkins.io/redhat-stable
gpgcheck=1
[root@bazinga ~]#
# It creates the repository detail as shown above in the file.
sudo rpm --import https://pkg.jenkins.io/redhat-stable/jenkins.io-2023.key
# This key will help access the above repository
sudo dnf install java-17-openjdk
# Java jdk is installed
sudo dnf install jenkins
# Jenkins is installed
Conclusion:
In conclusion, package management is a crucial aspect of Linux administration in the DevOps world. Understanding package managers like RPM and YUM empower users to efficiently install, update, and remove software packages, simplifying the management of dependencies and ensuring system stability. By mastering package management, DevOps professionals can streamline their workflow and enhance the overall efficiency of their Linux-based systems. Embrace the power of package management to optimize your DevOps journey! ๐ฆ๐ง๐
"Package management in Linux is a piece of cake! Said no one ever." - hehe ๐ฐ๐ซ