Welcome back to #90DaysOfDevOps! Today, we're diving into the world of package management in Linux. Understanding package managers and how to use them is fundamental for efficiently installing and updating software on your Linux system. We'll explore two common package managers: apt for Debian/Ubuntu and yum for CentOS/RHEL, and we'll also install a few packages to get hands-on experience.
What is Package Management?
Package management is the process of handling software packages, which are bundles of files that make up an application or piece of software. A package manager automates the process of installing, upgrading, configuring, and removing software packages.
Debian/Ubuntu: Using apt
APT (Advanced Package Tool) is the package manager used in Debian and its derivatives like Ubuntu.
Installing Software with apt
To install software using apt, open your terminal and use the following command:
sudo apt install package_name
Replace package_name with the name of the package you want to install. For example, to install the text editor nano, you'd use:
sudo apt install nano
You'll be prompted to enter your password to confirm the installation.
Updating Software with apt
To update the package list and upgrade installed packages, use:
sudo apt update
sudo apt upgrade
CentOS/RHEL: Using yum
YUM (Yellowdog Updater Modified) is the package manager used in CentOS and Red Hat Enterprise Linux (RHEL).
Installing Software with yum
To install software using yum, open your terminal and use the following command:
sudo yum install package_name
Replace package_name with the name of the package you want to install. For example, to install the text editor nano, you'd use:
sudo yum install nano
You'll be prompted to confirm the installation.
Updating Software with yum
To update the package list and upgrade installed packages, use:
sudo yum check-update
sudo yum update
Hands-On Practice
Let's get some hands-on practice. Choose a Linux system with either apt or yum based on your preference (Debian/Ubuntu or CentOS/RHEL). Try installing a few packages using your chosen package manager.
For example, you can install a web server like Apache:
On Debian/Ubuntu:
sudo apt install apache2
On CentOS/RHEL:
sudo yum install httpd
Once installed, you can start and enable the Apache service and check its status:
sudo systemctl start apache2 # Debian/Ubuntu
# or
sudo systemctl start httpd # CentOS/RHEL
sudo systemctl enable apache2 # Debian/Ubuntu
# or
sudo systemctl enable httpd # CentOS/RHEL
sudo systemctl status apache2 # Debian/Ubuntu
# or
sudo systemctl status httpd # CentOS/RHEL
Package management is a fundamental concept in Linux. Whether you're a developer or a system administrator, knowing how to use package managers like apt and yum is essential for maintaining a well-functioning and up-to-date Linux system.
As we continue our journey in #90DaysOfDevOps, remember that package management is a key skill that will serve you well in various DevOps tasks, from setting up servers to configuring development environments.
*** Explore | Share | Grow ***
Commenti