TNS
VOXPOP
As a JavaScript developer, what non-React tools do you use most often?
Angular
0%
Astro
0%
Svelte
0%
Vue.js
0%
Other
0%
I only use React
0%
I don't use JavaScript
0%
NEW! Try Stackie AI
CI/CD / Linux / Operations

How to Manage Linux Software

This article explains the role of command-line package managers, examines the package manager options for various distributions and demonstrates how to manage software with some of the most common tools.
Aug 4th, 2024 12:00pm by
Featued image for: How to Manage Linux Software
Feature image via Unsplash. 
This article on services fits into a larger series of Linux articles covering various sysadmin topics, including hardware identification and managing system processes. You can build a lab environment by following the information in the Linux: Companion Lab for Linux Skill Blocks Repository article.  In this series, we also covered how to pick a distribution and installation platform, how the Linux kernel interacts with hardware and how Linux manages system services, storage, file permissions, system processes, and user and group permissions.

Windows and macOS tend to have just one or two ways of managing software, but Linux offers far more flexibility and freedom. Many applications are compiled directly from the source code, while others are packaged and handled by various package managers. Several distributions have their own preferred package manager, while some rely on package managers developed by other distributions.

This article explains the role of command-line package managers, examines the package manager options for various distributions and demonstrates how to manage software with some of the most common tools.

Package managers are one of the easiest differentiators between Linux distributions. Some distributions use their own package managers to handle software maintenance, though most use package managers derived from either the Red Hat or Debian approaches.

Linux installations that use a graphical user interface (GUI) usually also contain a mouse-driven tool for installing, updating and removing software. This article focuses on command-line package managers, which are often faster and more flexible.

Another unique aspect of Linux software management is compiling applications from source code. Linux software usually falls under an open-source license, meaning you have direct access to the programming code. That allows you to alter the code or customize the program before compiling and installing it, a capability not usually available for Windows or macOS software.

Note: It is poor security practice to log on to a Linux system as the root (administrator) user. Most systems force you to log on as a regular user and then use the sudo (super user do) command to elevate your privileges. You may be prompted for your password when using sudo.

Package Managers Differ Among Distributions

Various Linux distributions developed their own software package managers. You’ll need to learn to use the preferred package manager for your chosen distro.

While the specific commands vary among package managers, the general concepts are the same. Package managers typically handle the following software maintenance tasks:

  • Inventory software, including version information
  • Display software information
  • Install software
  • Update software
  • Remove software

Three of the most common package managers derive from Red Hat Linux, Debian Linux, and SUSE Linux. The Red Hat approach includes several tools, while the Debian software manager relies on one primary utility.

Use RPM

The Red Hat Package Manager (RPM) has a long history with many Linux distributions, including Red Hat Linux, Red Hat Enterprise Linux, Fedora and others. It’s a command-line tool with extensive options for modifying its use.

The following two rpm subcommands install ( -i ) and remove ( -e ) software:



The additional flags run the command in verbose mode ( -v ) and show a progress bar ( -h ).

Display version and source information for a package using the -q  (query) and -i  (information) flags.


Figure 1: Use the rpm -qi option to display package information, including version.

Use YUM

For many years, Red Hat and other distributions relied on the Yellowdog Updater Modified (YUM) package manager. It works with the same .rpm  packages and offers similar features. However, it also includes more extensible features.

Type these two yum commands to install or remove software:



Get information about an installed package with this yum  command:


The yum  command also recognizes the update  and upgrade  commands for when you need to bring an older software package current.

Use DNF

Today’s Red Hat-derived distributions use the Dandified YUM (DNF) package manager. It provides the same basic functionality as YUM and RPM, though it offers faster dependency resolution and runs quicker. The base command is dnf.

Display the configured software repositories using the dnf repolist  subcommand:


Figure 2: Display a list of configured repositories with the dnf repolist command.

Here are examples of installing and removing software using the dnf  command:



You’ll often need to update installed software. Use the upgrade  subcommand with dnf :


How do you know if a package needs an update? You can use the info  subcommand to display package information, including version. Compare that against the vendor’s latest version.


Figure 3: Partial output from the dnf info command.

DNF has many other interesting subcommands. Try dnf history  to see what DNF commands you’ve run in the past. Type dnf upgrade  to upgrade all packages that have upgrades available. Search for information about a package without installing it by typing dnf search packagename .

Use APT

The Debian Linux distribution is nearly as old as Linux itself. The developers at Debian created a package manager early on, and its descendants are still in use today. The modern version of Debian’s package manager is the Advanced Packaging Tool (APT). You’ll use it with Debian, Ubuntu, Mint and many other popular Linux distributions.

APT provides similar functionality to RPM, YUM and DNF. It installs, removes, updates and reports on software packages containing the .deb  file extension.

You’ll need to update the package manager repository information to access the most recent packages. The related apt command is:


To install or remove software with the apt  command, type:



Figure 4: Use the apt install command to add a package.

The upgrade  subcommand brings existing packages current. You can also use the info  subcommand to display information about a particular package.

Figure 5: The apt info command displays package information, including version.

Use Zypper

OpenSUSE Linux and SUSE Linux Enterprise Server use the Zypper command-line package manager. Managing software from the command line allows for scripting, consumes fewer resources and works on Linux servers without a graphical user interface (GUI), which is common. Zypper works with RPM packages, but the package manager itself is fundamentally different. The parent command is zypper.

It’s a good practice to refresh the package manager with current remote repository information before installing or updating packages. Use the zypper refresh  command to accomplish this:


Zypper uses the same two subcommands as DNF and APT to add or remove software:



Bring the installed packages current by using the update  subcommand:


The info  subcommand displays package details:

What Are Software Package Repositories?

Distribution vendors and software developers store available packages in online repositories. Your package management software automatically searches these repositories when you attempt to install or update an application. You can edit the package manager’s configuration files to add or remove repositories.

For example, you can manage the repositories DNF will pull software from by editing the /etc/dnf/dnf.conf  file.

The similar configuration file for APT repositories is /etc/apt/sources.list .

Figure 6: The /etc/apt/sources.list file contains package repository information.

Some organizations also maintain repositories on site or on removable media for better control of software versions.

What About Compiling Software?

Linux users have another software management option that is less common for Windows or macOS folks. Linux users often compile applications from the original source code. The three-step process is relatively straightforward but may seem intimidating at first.

Most software developed for Windows and macOS systems is closed-source, meaning the licensing does not allow access to the original source code. It also does not allow that code to be modified.

Open-source software makes the original code available to anyone. Furthermore, anyone can change the source code and release their changes. This approach allows open-source software to evolve quickly and embrace new ideas.

Some application developers will compile and package the code using one of the packaging approaches discussed earlier. Others let end-users do it. Most provide both options.

Users might choose to compile software themselves for several reasons, including those listed below:

  • Get cutting-edge software for testing or beta use.
  • Customize the software in ways packaged software can’t be.
  • Obtain software not packaged for their chosen distribution.

How to Compile Software

Many software developers provide specific instructions for compiling their software.

Here are the instructions for compiling Nmap, a popular network analysis tool:


The Nmap vendor provides the above instructions.

Wrap Up

The first step with managing Linux software is recognizing which package manager application your distribution uses. There’s a good chance it is DNF or APT, but many other options exist. These options may seem confusing compared to other operating systems, but they quickly become second nature.

Once you know your system’s package manager, learn the basic commands for installing, updating and removing software. Remember to use the package manager to keep track of version numbers and other information about the software. Keeping software current increases your system’s security and ensures you have the most current software features.

Linux users have another option. They can compile applications directly from the open-source code, enabling access to new features and additional customization. Compiling software may seem intimidating, but it is actually pretty easy.

Check your selected distribution’s preferred package manager and begin updating your software for security and feature enhancements. Then use a lab environment and a few other distributions to learn more about the various types of Linux package managers.

Created with Sketch.
TNS DAILY NEWSLETTER Receive a free roundup of the most recent TNS articles in your inbox each day.