π§° Linux/Unix: SUSE Package Management β zypper Command Explained with Examples
π§² Introduction β Why Learn zypper on SUSE Linux?
If you use SUSE Linux Enterprise Server (SLES) or openSUSE, youβll manage packages using zypperβa powerful and script-friendly command-line interface to ZYpp, the package management engine. Whether updating software or handling repositories, zypper is fast, consistent, and great for automation.
π― In this guide, youβll learn:
- How to install, update, and remove software with zypper
- How to manage repositories and patches
- Real-world examples and outputs for each command
βοΈ What is zypper?
zypper is the official package manager for SUSE-based systems, used to install RPM packages, manage repositories, update the system, and resolve dependencies automatically.
π οΈ Syntax:
sudo zypper [command] [options]
π§ͺ Essential zypper Commands & Examples
πΉ 1. π Refresh Repositories
sudo zypper refresh
π€ Output:
Repository 'Main Repository' is up to date.
All repositories have been refreshed.
β Always run this before updates or installs.
πΉ 2. π₯ Install a Package
sudo zypper install nginx
π€ Output:
The following package is going to be installed:
  nginx
Continue? [y/n/v/...? shows all options] (y): y
β Installs the latest available version with dependencies.
πΉ 3. ποΈ Remove a Package
sudo zypper remove nginx
β Uninstalls the package cleanly, keeping shared dependencies.
πΉ 4. π§© Update All Installed Packages
sudo zypper update
π€ Output:
Reading installed packages...
Nothing to do.
β
 Equivalent to apt upgrade or dnf upgrade.
πΉ 5. π Search for a Package
zypper search git
π€ Output:
S | Name        | Summary
--+-------------+------------------------------
i | git         | Distributed Version Control
β
 i = installed, S = source package
πΉ 6. βΉοΈ View Package Info
zypper info git
π€ Output:
Name           : git
Version        : 2.35.3
Summary        : Distributed Version Control System
Repository     : Main Repository
πΉ 7. π§Ή Clean Package Cache
sudo zypper clean
β Frees up disk space by removing cached RPM files.
πΉ 8. π‘ Add a New Repository
sudo zypper addrepo https://download.opensuse.org/repositories/network/openSUSE_Tumbleweed/network.repo
π§  Use zypper repos to view all repositories.
π zypper Flags Summary
| Command | Action | 
|---|---|
| install | Install a package | 
| remove | Uninstall a package | 
| update | Update installed packages | 
| refresh | Refresh repository metadata | 
| search | Search available packages | 
| info | View package details | 
| addrepo | Add new repository | 
| clean | Clear package cache | 
| patch | Apply system patches | 
π§ Tool Comparison Table
| Feature | zypper | 
|---|---|
| System Type | openSUSE, SLES | 
| Format Support | .rpm | 
| Dependency Resolution | β Yes | 
| Update All Packages | β zypper update | 
| Repository Management | β zypper addrepo,repos | 
| GUI Alternative | β YaST (Yet Another Setup Tool) | 
π Summary β Recap & Next Steps
If you’re managing SUSE or openSUSE, zypper is your primary CLI tool for installing software, managing repositories, and keeping the system secure. It’s reliable, fast, and easily scriptable for automation and server deployment.
π Key Takeaways:
- Use zypper installandremoveto manage software packages.
- Use zypper refreshandupdatefor system maintenance.
- Use zypper repos,addrepo, andcleanfor repo and cache management.
β FAQs
β Can I install .rpm files manually with zypper?
β
 Yes. Use:
sudo zypper install ./package.rpm
β How do I fix broken dependencies?
β
 Run:
sudo zypper verify
β How do I update only a specific package?
β
 Use:
sudo zypper update vim
β Is there a GUI for zypper?
β
 Yes. Use YaST, the graphical control center for SUSE systems.
β How do I list installed packages?
β
 Run:
zypper search --installed-only
Share Now :
