Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Blog: 'Decoding Linux Package Management' #14

Open
wants to merge 5 commits into
base: main
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from 4 commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
11 changes: 11 additions & 0 deletions data/authors/shubham.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,11 @@
---
name: Shubham Kshetre
avatar: /static/images/shubhamkshetre-avatar.jpg
occupation: Student
email: [email protected]
twitter: https://twitter.com/ShubhamKshetre
linkedin: https://www.linkedin.com/in/shubhamkshetre/
github: https://github.com/shubham-kshetre
---

I'm a Computer Engineering student.
154 changes: 154 additions & 0 deletions data/blog/decoding-linux-package-management.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,154 @@
---
title: 'Decoding Linux Package Management'
date: '2024-02-20'
lastmod: '2024-02-20'
tags:
[
'Linux',
'Package Management',
'Apt',
'Snap',
'Flatpak',
'Package Creation',
'APT',
'YUM',
'DNF',
'Pacman',
'Zypper',
'Paru',
]
draft: false
summary: 'This article explores the world of Linux package management, explaining how software is packaged, distributed, and installed. It dives into different package managers like Apt and Yum, highlighting their features and roles. The blog aims to empower users, especially beginners, to make informed choices when navigating the vast landscape of Linux software management.'
authors: ['shubham']
---

In the Linux community, many avoid Snap and prefer traditional methods like Apt. But why? And what's the fuss about?

In this article, we'll unpack the mysteries of Linux package management. We'll simplify terms and explore why Apt wins over Snap.

Let's dive in!

## **Why Are There So Many Package Managers in Linux?**

If you're new to Linux, you might feel overwhelmed by the many package managers available. But don't worry, you're not alone in wondering why there are so many!

Imagine this scenario: You've just made the switch to Linux and you're eager to start exploring. You quickly realize that different Linux distributions (distros) often come with their own unique package managers. For instance, Ubuntu uses Apt, while Fedora utilizes DNF. This diversity can be overwhelming for beginners, leaving them scratching their heads and wondering why there isn't just one universal package manager for all Linux distros.

The reason behind this abundance of package managers lies in the diverse nature of the Linux ecosystem itself. Each distribution has its own set of goals, priorities, and philosophies, which inevitably leads to the development of distinct package management solutions tailored to meet their specific needs.

However, fear not, for there is a shining beacon of hope amidst this sea of diversity: **Flatpak**. Flatpak is a universal package manager designed to work across different Linux distributions, providing a standardized way to package and distribute applications. With Flatpak, developers can create software packages that are agnostic to the underlying distribution, ensuring compatibility and ease of installation for users regardless of their chosen distro.

So, while the abundance of package managers in Linux may seem daunting at first, rest assured that solutions like Flatpak exist to simplify the experience and bring harmony to the Linux ecosystem.

## How packaging works

### What is Package Creation?

In the world of Linux, a package is like a neatly wrapped gift containing software. It bundles everything needed to install and run a program smoothly on your system. Creating a package involves organizing files, setting permissions, and providing instructions for installation.

### How Packaging Works

Imagine you want to share a new program you've developed with others. Instead of sending them a bunch of scattered files, you can create a package to simplify installation. Here's how it works:

1. **Organize Files**: Gather all the necessary files for your program, including executables, configuration files, and documentation. Put them in a structured directory.
2. **Write Instructions**: Create a set of instructions, usually in a file called a "spec" file or "control" file, detailing how the package should be installed. This includes dependencies (other software needed for your program to work) and any specific configuration steps.
3. **Compile**: If your program needs to be compiled from source code, you'll include this step in your packaging instructions. Compilation converts human-readable source code into machine-executable binaries.
4. **Build Package**: Using packaging tools specific to your Linux distribution (like `dpkg` for Debian-based systems or `RPM` for Red Hat-based systems), you compile all the files and instructions into a single package file. This file typically has a `.deb` extension for Debian-based systems or `.rpm` for Red Hat-based systems.
5. **Distribute Package**: Once your package is built, you can distribute it through repositories, websites, or other means. Users can then easily install your software with a simple command.

## Exploring Package Storage and Package Managers in Linux

Have you ever wondered where all those neatly packaged software programs are stored in Linux, and how your system magically installs them with just a few commands?

### Package Storage

In the Linux world, packages are typically stored in repositories. Think of repositories as vast online libraries filled with all sorts of software goodies. These repositories are maintained by organizations or communities and contain packages curated for specific Linux distributions.

For example, Ubuntu has its repository where it stores packages specifically tailored for Ubuntu users. Similarly, Fedora maintains its repository for Fedora users.

### How Package Managers Work

Now, let's talk about package managers. These are the superheroes of the Linux world, responsible for fetching, installing, updating, and removing packages on your system. They work closely with repositories to ensure smooth operations.

Here's a simple breakdown of how package managers work:

1. **Fetching Packages**: When you command your package manager to install a package (let's say, `nginx`, a popular web server), it reaches out to the repository associated with your Linux distribution and fetches the package and all its dependencies.
2. **Installation**: Once the package manager has all the necessary files, it begins the installation process. It carefully places each file in its designated location, sets permissions, and configures the software according to your system's requirements.
3. **Dependency Management**: Package managers are smart. They understand that software often relies on other software to function correctly (dependencies). So, they ensure that all required dependencies are also installed along with the main package.
4. **Updating Packages**: Periodically, new versions of software are released with bug fixes and new features. Package managers keep track of these updates and allow you to easily update your installed packages to the latest versions with a simple command.
5. **Package Removal**: Need to get rid of a package? No problem! Your package manager can uninstall packages cleanly, removing all associated files and dependencies without leaving behind any clutter.

### Example: Installing Nginx

Let's put this into action with a real-world example. Suppose you want to install Nginx on your Ubuntu system. Here's what you'd do:

```bash
sudo apt update
sudo apt install nginx

```

And that's it! Your package manager (`apt` in this case) will fetch Nginx and its dependencies from the Ubuntu repository and install it on your system seamlessly.

## Most liked Package managers

### 1. APT (Advanced Package Tool)

- **Distribution**: Debian-based distributions like Ubuntu.
- **Features**: Simple commands (`apt install`, `apt update`), seamless dependency management, reliability.

### 2. YUM (Yellowdog Updater Modified)

- **Distribution**: Red Hat-based distributions such as Fedora and CentOS.
- **Features**: Easy-to-use commands, automatic dependency resolution, stability.

### 3. DNF (Dandified YUM)

- **Distribution**: Successor to YUM in newer versions of Fedora and CentOS.
- **Features**: Improved performance, intuitive command syntax, robust dependency resolution.

### 4. Pacman

- **Distribution**: Arch Linux and its derivatives like Manjaro.
- **Features**: Minimalist design, fast performance, extensive package database.

### 5. Snap

- **Distribution**: Supported across various Linux distributions.
- **Features**: Universal package manager, sandboxed packages for enhanced security, wide software selection.

### 6. Zypper

- **Distribution**: Used in openSUSE and SUSE Linux Enterprise.
- **Features**: Robust dependency resolution, rollback capabilities, support for various repository types.

### 7. Portage

- **Distribution**: Exclusive to Gentoo Linux.
- **Features**: Source-based package manager, extensive customization options, efficient handling of package dependencies.

### 8. emerge

- **Distribution**: Part of the Portage package management system in Gentoo Linux.
- **Features**: Automated fetching, compiling, and installation of source packages, precise dependency tracking.

## Paru

Paru is a popular AUR (Arch User Repository) helper and package manager designed for Arch Linux and its derivatives. It simplifies the process of managing software packages from the AUR, a community-driven repository that contains user-contributed packages not officially maintained by Arch Linux.

Paru is maintained by its creator, Morganamilo, along with contributions from the open-source community. As an AUR helper, Paru is actively developed and regularly updated to ensure compatibility with changes in Arch Linux and improvements in package management practices.

### Key features of Paru:

1. **AUR Package Management**: Paru facilitates easy installation, update, and removal of AUR packages.
2. **Dependency Resolution**: Paru automates correct installation of all dependencies for AUR packages.
3. **Parallel Downloads**: Enables faster installation and updates by fetching multiple packages simultaneously.
4. **Compatibility with pacman**: Paru seamlessly integrates with Arch Linux's default package manager, pacman, for unified package management.

## apt vs snap

Choosing between APT and Snap packages depends on your specific requirements. If you prioritize system integration, efficiency, and access to a wide range of software from official repositories, APT is the way to go.

On the other hand, if you prefer the flexibility of running the latest software versions with enhanced security and isolation, Snap packages offer a compelling alternative.

Ultimately, both APT and Snap contribute to the richness and versatility of the Ubuntu ecosystem, providing users with options to tailor their software management experience to their needs. However, for most users, APT remains the best option for its seamless integration and efficient management of software on Ubuntu.
21 changes: 21 additions & 0 deletions pages/about/shubham.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,21 @@
import { MDXLayoutRenderer } from '@/components/MDXComponents'
import { getFileBySlug } from '@/lib/mdx'

const DEFAULT_LAYOUT = 'AuthorLayout'

export async function getStaticProps() {
const authorDetails = await getFileBySlug('authors', ['shubham'])
return { props: { authorDetails } }
}

export default function About({ authorDetails }) {
const { mdxSource, frontMatter } = authorDetails

return (
<MDXLayoutRenderer
layout={frontMatter.layout || DEFAULT_LAYOUT}
mdxSource={mdxSource}
frontMatter={frontMatter}
/>
)
}
Binary file added public/static/images/shubhamkshetre-avatar.jpg
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.