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 :
