Category :

Installing Software on Linux

Linux Package Manager

Introduction to Linux Package Management

Linux offers an efficient, flexible way to manage software through package management systems. Understanding how these systems work not only makes it easier to install software but also helps you troubleshoot and maintain a healthy Linux system. Whether you’re using Ubuntu, Debian, Fedora, or another distribution, mastering package management is a crucial step in your Linux journey.

Package Managers: The Basics

There are two main types of package managers you’ll encounter:

  • dpkg (Debian Package Manager):
    • A low-level package manager for ‘.deb' files.
    • Requires manual downloading of packages.
    • Does not automatically manage dependencies, often causing installation issues if dependencies are missing.
  • apt (Advanced Package Tool):
    • A higher-level package manager built on top of dpkg.
    • Automatically downloads and installs dependencies.
    • Far easier and more efficient for everyday software management.

Installing Software with dpkg

Sometimes you might need to manually download and install a ‘.deb‘ file, especially when the software isn’t available in your repositories. Here’s a quick example using Discord:

  1. Download the .deb file from the official Discord website.
  2. Install it using the command:
    • sudo dpkg -i discord.deb
  3. If you encounter dependency errors, you can fix them with:
    • sudo apt –fix-broken install

Using dpkg is powerful but requires manual handling of any missing dependencies.

Installing Software with apt

For most cases, apt is the go-to method for installing software:

  1. First, update your package lists:
    • sudo apt update
  2. Then, install the desired package:
    • sudo apt install <package name>

apt automatically resolves dependencies, making software installation much smoother. If issues occur, running:

  • sudo apt –fix-broken install

can quickly repair them.

Managing Repositories

Linux distributions use repositories — servers that store software packages. To manage them:

  • View or edit repository sources:
    • sudo apt edit-sources

Sometimes, software isn’t available in the default repositories, in which case you may need to add a custom repository (PPA) or download a .deb file manually.

Handy apt Commands

  • List available packages:
    • sudo apt list
  • View package details:
    • sudo apt show <package name>
  • Remove a package:
    • sudo apt remove <package name>
  • Purge a package (remove it completely):
    • sudo apt purge <package name>
  • Upgrade installed packages:
    • sudo apt upgrade

These commands help you maintain your system and keep it updated with the latest software versions.

Other Package Managers: Snap and Flatpak

In addition to traditional package managers, Linux also supports newer, more universal systems like Snap and Flatpak.

  • Snap:
    • Developed by Canonical (Ubuntu’s parent company).
    • Provides containerized software packages from the Snap Store.
    • Install Snap:
      • sudo apt install snapd
    • Install software using Snap:
      • sudo snap install <package name>
  • Flatpak:
    • An alternative to Snap, designed to work across multiple distributions.
    • Software runs in a sandboxed environment for better security.
    • Install Flatpak:
      • sudo apt install flatpak
    • Add the Flathub repository (the main Flatpak app store):
      • flatpak remote-add –if-not-exists flathub https://flathub.org/repo/flathub.flatpakrepo
    • Install an app:
      • flatpak install flathub <app name>

Both Snap and Flatpak are great options when a program isn’t available in your distro’s native repositories.

Language-Specific Package Managers

Certain programming languages come with their own package managers:

  • Python:
    • Use pip to install Python libraries:
      • pip install <package name>
  • Ruby:
    • Use gem to install Ruby libraries:
      • gem install <package name>

These are particularly useful when you’re working on development projects.

Using Git to Install Software

Sometimes software isn’t distributed through package managers but rather through Git repositories:

  1. Install Git:
    • sudo apt install git
  2. Clone a repository:
    • git clone <repository url>
  3. For Python projects, install required dependencies:
    • pip3 install -r requirements.txt

Git gives you access to the latest code directly from developers — perfect for cutting-edge tools and open-source projects.

Conclusion

Installing software on Linux may seem complex at first, but with a bit of practice, it becomes second nature. Between traditional tools like apt, modern solutions like Snap and Flatpak, and even languagespecific managers like pip, Linux gives you multiple ways to get the software you need.
The best way to truly master these skills is by hands-on practice. Platforms like Hack The Box Academy offer excellent interactive labs where you can sharpen your Linux skills further. So, don’t hesitate — start exploring, installing, and learning today!

Related Posts

Windows OS Hardening

Windows OS Hardening

How to Secure Your Windows PC Like a Pro In today’s digital world, securing your Windows operating system isn’t optional — it’s absolutely essential. With

Read More »

Linux File System

What Is the Linux File System? In Linux, the file system refers to the method and data structure that the operating system uses to manage

Read More »