Photo by Chang Duong on Unsplash
Linux Basic Series: Package Management (P7)
This article explains how to install update and remove software packages, manage software repos and pkg management tools.
This is the 7th part of 7 part series where I explain the Basics of Linux.
Installing, updating, and removing software packages
Package management is the process of installing, updating, and removing software packages on a Linux system. Linux distributions typically have a package management system built-in, which allows users to easily install, update, and remove the software. For example, the 'apt' package manager is used on Ubuntu and Debian-based systems, while 'yum' is used on Red Hat and CentOS-based systems. To install a package using 'apt', you can use the following command:
sudo apt install package_name
This will download and install the specified package, along with any dependencies it requires. To update a package, you can use the apt update
and apt upgrade
commands:
sudo apt update
sudo apt upgrade
This will download and install any available updates for your installed packages. To remove a package, you can use the apt remove
command:
sudo apt remove package_name
This will remove the specified package and any files associated with it.
Managing software repositories
Software repositories are collections of packages that are available for installation on a Linux system. Each Linux distribution has its own set of repositories, which are maintained by the distribution community or by the software vendors. To manage repositories, you can use the apt
or yum
package managers. For example, to add a new repository to 'apt', you can use the add-apt-repository
command:
sudo add-apt-repository repository_name
This will add the specified repository to your system's list of available repositories. To remove a repository, you can use the remove-apt-repository
command:
sudo remove-apt-repository repository_name
This will remove the specified repository from your system.
Using package management tools such as apt and yum
Package management tools like apt
and yum
provide a range of features for managing software on a Linux system. These tools allow you to install, update, and remove packages, as well as manage software repositories and dependencies. Some useful commands for 'apt' include:
sudo apt search search_term
This will search the repositories for packages that match the specified search term.
sudo apt show package_name
This will display information about the specified package, including its description, version, and dependencies.
sudo apt autoremove
This will remove any packages that are no longer needed on your system.
Overall, package management is an important aspect of Linux administration, as it allows you to easily install, update, and remove software on your system. By mastering package management tools like 'apt' and 'yum', you can become more efficient and productive on the Linux command line.