← Back to DevBytes

openSUSE Package Management: APT, DNF, Pacman Guide

Introduction to openSUSE Package Management

openSUSE is a robust, enterprise-grade Linux distribution renowned for its stability, the YaST administration tool, and the powerful zypper package manager built on top of libzypp. However, developers coming from Debian, Fedora, or Arch ecosystems often bring their muscle memory with them — and that's where APT, DNF, and Pacman enter the conversation.

This tutorial explores how these three popular package managers relate to openSUSE, whether they can be used (or emulated) on the platform, and how to translate between them and native zypper commands. Understanding these tools matters because cross-distribution development, containerized workflows, and CI/CD pipelines frequently require translating package operations across ecosystems.

Why Package Manager Portability Matters

Modern development rarely confines you to a single distribution. You might build an application on openSUSE Tumbleweed, deploy it in a Debian-based container, test it on Fedora, and package it for Arch users. Each ecosystem uses a different package format and dependency resolver:

openSUSE natively uses zypper and RPM. While you generally should not install foreign package managers directly on openSUSE (doing so risks corrupting your RPM database), knowing their command equivalents lets you write portable scripts, documentation, and Dockerfiles that work across distributions.

Native openSUSE Package Management with Zypper

Before diving into APT, DNF, and Pacman, let's establish the native baseline. openSUSE's zypper is the canonical tool for installing, updating, and querying packages.

Basic Zypper Operations

# Refresh repository metadata
sudo zypper refresh

# Install a package
sudo zypper install git

# Remove a package
sudo zypper remove git

# Search for a package
zypper search nginx

# Update all packages
sudo zypper update

# List configured repositories
zypper repos

# Add a new repository
sudo zypper ar https://download.opensuse.org/repositories/devel:/languages:/python/openSUSE_Tumbleweed/ python-devel

# Perform a distribution upgrade (Tumbleweed)
sudo zypper dup

Keep these commands in mind — we'll map APT, DNF, and Pacman equivalents to them throughout the tutorial.

APT: The Debian/Ubuntu Standard

APT (Advanced Package Tool) is the package manager used by Debian and Ubuntu. It is not designed for RPM-based systems like openSUSE. However, developers frequently need to translate APT commands into zypper equivalents when porting tutorials, scripts, or container images.

Common APT Commands and Zypper Equivalents

# Update package lists
sudo apt update          # Debian/Ubuntu
sudo zypper refresh      # openSUSE

# Install a package
sudo apt install curl    # Debian/Ubuntu
sudo zypper install curl # openSUSE

# Remove a package
sudo apt remove curl
sudo zypper remove curl

# Remove package plus configuration
sudo apt purge curl
sudo zypper remove --clean-deps curl

# Upgrade all packages
sudo apt upgrade
sudo zypper update

# Full system upgrade
sudo apt full-upgrade
sudo zypper dup

# Search for a package
apt search nginx
zypper search nginx

# Show package information
apt show nginx
zypper info nginx

# List installed packages
apt list --installed
zypper search --installed-only

Can You Run APT on openSUSE?

Technically, an apt package exists in openSUSE repositories, but it is a compatibility wrapper called apt-rpm that translates APT commands to operate on RPM packages. It is largely unmaintained and not recommended for production use. The safer approach is to learn the zypper equivalents shown above.

# Not recommended, but available:
sudo zypper install apt

# If installed, this would target RPM packages:
sudo apt install nginx

Avoid mixing apt-rpm with zypper on the same system — they can disagree about dependency resolution and leave your system in an inconsistent state.

DNF: The Fedora/RHEL Successor to Yum

DNF is the modern replacement for Yum, used by Fedora, RHEL, and CentOS Stream. Because DNF and zypper both operate on RPM packages, the conceptual mapping is closer than with APT. However, DNF uses libsolv for dependency resolution while zypper uses libzypp, and their repository metadata formats differ.

DNF Commands and Zypper Equivalents

# Refresh metadata
sudo dnf check-update
sudo zypper refresh

# Install a package
sudo dnf install httpd
sudo zypper install apache2

# Remove a package
sudo dnf remove httpd
sudo zypper remove apache2

# Upgrade packages
sudo dnf upgrade
sudo zypper update

# Search packages
dnf search postgresql
zypper search postgresql

# Show package info
dnf info postgresql
zypper info postgresql

# List installed packages
dnf list installed
zypper search --installed-only

# List repositories
dnf repolist
zypper repos

# Add a repository
sudo dnf config-manager --add-repo https://example.com/repo.repo
sudo zypper ar https://example.com/repo.repo myrepo

# Clean cache
sudo dnf clean all
sudo zypper clean

Package Name Differences

Even though both DNF and zypper use RPM, package naming conventions differ. For example, the Apache HTTP server is httpd on Fedora but apache2 on openSUSE. Always verify package names with zypper search before assuming a one-to-one mapping.

# Verify the correct package name on openSUSE
zypper search apache

Pacman: The Arch Linux Approach

Pacman is the package manager for Arch Linux and its derivatives like Manjaro. It uses a custom binary package format (.pkg.tar.zst) and is built around the rolling-release philosophy that openSUSE Tumbleweed shares. Despite the philosophical similarity, Pacman cannot install Arch packages on openSUSE — the formats are incompatible.

Pacman Commands and Zypper Equivalents

# Sync and refresh repositories
sudo pacman -Sy          # Arch
sudo zypper refresh      # openSUSE

# Install a package
sudo pacman -S vim
sudo zypper install vim

# Remove a package (keep dependencies)
sudo pacman -R vim
sudo zypper remove vim

# Remove a package and unused dependencies
sudo pacman -Rs vim
sudo zypper remove --clean-deps vim

# Upgrade all packages
sudo pacman -Syu
sudo zypper dup

# Search for a package
pacman -Ss nginx
zypper search nginx

# Show package information
pacman -Si nginx
zypper info nginx

# List installed packages
pacman -Q
zypper search --installed-only

# Query which package owns a file
pacman -Qo /usr/bin/curl
zypper search --provides /usr/bin/curl

Arch Build System vs. openSUSE Build Service

Arch users are familiar with the Arch Build System (ABS) and PKGBUILD files. The openSUSE equivalent is the Open Build Service (OBS), which uses .spec files for RPM packaging. Both let you build packages from source with reproducible recipes.

# Arch: build a package from AUR
git clone https://aur.archlinux.org/package-name.git
cd package-name
makepkg -si

# openSUSE: build a package locally with osc (OBS command-line client)
zypper install osc
osc co home:user/package-name
cd package-name
osc build

Cross-Distribution Scripting Patterns

When writing scripts that must work across distributions, detect the package manager at runtime and dispatch the correct command. Here's a robust pattern:

#!/usr/bin/env bash
set -euo pipefail

install_package() {
  local pkg="$1"
  if command -v zypper >/dev/null 2>&1; then
    sudo zypper --non-interactive install "$pkg"
  elif command -v dnf >/dev/null 2>&1; then
    sudo dnf install -y "$pkg"
  elif command -v apt >/dev/null 2>&1; then
    sudo apt update && sudo apt install -y "$pkg"
  elif command -v pacman >/dev/null 2>&1; then
    sudo pacman -S --noconfirm "$pkg"
  else
    echo "No supported package manager found" >&2
    return 1
  fi
}

install_package git
install_package curl
install_package vim

This approach is widely used in provisioning scripts, Ansible roles, and container entrypoints.

Container Workflows and Multi-Stage Builds

When building containers, you often start from an openSUSE base image but need to install dependencies that documentation only describes for APT or DNF. The opensuse/tumbleweed image is the standard base:

FROM opensuse/tumbleweed

# Refresh and install packages in one layer
RUN zypper --non-interactive refresh && \
    zypper --non-interactive install --no-recommends \
        python311 \
        python311-pip \
        git \
        curl \
        gcc \
        python311-devel && \
    zypper clean --all

WORKDIR /app
COPY . .
RUN pip3 install --no-cache-dir -r requirements.txt

CMD ["python3", "app.py"]

The --no-recommends flag keeps the image lean by skipping recommended (but not strictly required) packages, mirroring the philosophy of apt install --no-install-recommends.

Best Practices

1. Use Zypper as Your Primary Tool on openSUSE

Resist the temptation to install APT or Pacman on openSUSE. Mixing package managers that target different formats or metadata systems will eventually break dependency resolution. Learn the zypper equivalents and use them consistently.

2. Prefer --non-interactive in Scripts

sudo zypper --non-interactive install nginx

This prevents scripts from hanging on interactive prompts, equivalent to -y in APT/DNF or --noconfirm in Pacman.

3. Use zypper dup Only on Tumbleweed

On openSUSE Tumbleweed (rolling release), zypper dup performs a distribution upgrade and is the correct way to keep the system current. On openSUSE Leap (regular release), use zypper update for routine updates and reserve dup for major version migrations.

4. Pin Repositories with Priorities

When adding third-party repositories, assign priorities to prevent unwanted package replacements:

# Add a repo with a specific priority (lower number = higher priority)
sudo zypper ar -p 90 https://example.com/repo.repo thirdparty

# View priorities
zypper repos -p

5. Clean Caches Regularly

sudo zypper clean --all

This removes downloaded RPMs and metadata, freeing disk space — analogous to dnf clean all or paccache -r on Arch.

6. Lock Packages to Prevent Unwanted Updates

# Lock a package
sudo zypper al kernel-default

# List locks
zypper ll

# Remove a lock
sudo zypper rl kernel-default

This is equivalent to apt-mark hold or adding a package to IgnorePkg in /etc/pacman.conf.

7. Verify Package Integrity

openSUSE signs all official packages with GPG keys. When adding a repository, zypper will prompt you to accept its signing key. Always verify the key fingerprint against the official source before accepting.

# View imported GPG keys
rpm -qa gpg-pubkey

# Import a key manually
sudo rpm --import https://example.com/repo.key

Quick Reference Cheat Sheet

| Operation          | APT                  | DNF                  | Pacman        | Zypper                  |
|--------------------|----------------------|----------------------|---------------|-------------------------|
| Refresh repos      | apt update           | dnf check-update     | pacman -Sy    | zypper refresh          |
| Install            | apt install pkg      | dnf install pkg      | pacman -S pkg | zypper install pkg      |
| Remove             | apt remove pkg       | dnf remove pkg       | pacman -R pkg | zypper remove pkg       |
| Remove + deps      | apt autoremove       | dnf autoremove       | pacman -Rs    | zypper rm --clean-deps  |
| Update all         | apt upgrade          | dnf upgrade          | pacman -Su    | zypper update           |
| Full upgrade       | apt full-upgrade     | dnf system-upgrade   | pacman -Syu   | zypper dup              |
| Search             | apt search pkg       | dnf search pkg       | pacman -Ss    | zypper search pkg       |
| Info               | apt show pkg         | dnf info pkg         | pacman -Si    | zypper info pkg         |
| List installed     | apt list --installed | dnf list installed   | pacman -Q     | zypper se -i            |
| List repos         | apt-cache policy     | dnf repolist         | (in pacman.conf)| zypper repos          |
| Clean cache        | apt clean            | dnf clean all        | paccache -r   | zypper clean --all      |

Conclusion

openSUSE's native package management ecosystem — centered on zypper, libzypp, and RPM — is powerful, fast, and well-suited to both desktop and enterprise use. While APT, DNF, and Pacman cannot (and should not) replace zypper on an openSUSE system, understanding their command equivalents is an essential skill for developers who work across distributions, write portable automation scripts, or maintain container images. By mastering the translation table between these tools and following best practices like using --non-interactive in scripts, pinning repository priorities, and choosing the right upgrade command for your release model, you can move fluidly between Debian, Fedora, Arch, and openSUSE environments without friction. The package manager is the gateway to your system's software lifecycle — knowing more than one fluently makes you a more versatile and effective developer.

— Ad —

Google AdSense will appear here after approval

← Back to all articles