Linux Comm Zypper
[ Linux Command Encyclopaedia](#)
* * *
zypper is the command-line package management tool in openSUSE and SUSE Linux Enterprise (SLE) distributions, used for managing software package installation, updates, removal, and queries. It is the default package manager for these distributions, with functionality similar to apt in Debian/Ubuntu systems or yum/dnf in Red Hat systems.
* * *
## zypper Basic Syntax
The basic syntax format for zypper command is as follows:
zypper
### Global Options
* `--help` or `-h`: Display help information
* `--version` or `-V`: Display version information
* `--quiet` or `-q`: Quiet mode, reduce output
* `--verbose` or `-v`: Verbose mode, increase output information
* `--no-refresh`: Do not refresh software sources
* `--non-interactive` or `-n`: Non-interactive mode, automatically answer default questions
* * *
## Common zypper Commands
### Refresh Software Sources
zypper refresh
Or abbreviated as:
zypper ref
### Install Packages
zypper install
Or abbreviated as:
zypper in
### Remove Packages
zypper remove
Or abbreviated as:
zypper rm
### Update System
zypper update
Or abbreviated as:
zypper up
### Search Packages
zypper search
Or abbreviated as:
zypper se
### View Package Information
zypper info
Or abbreviated as:
zypper if
### List Installed Packages
zypper packages --installed-only
### Clean Cache
zypper clean
* * *
## Advanced Usage
### Install Specific Version of Package
zypper install =
### Add Software Source
zypper addrepo
Or abbreviated as:
zypper ar
### Remove Software Source
zypper removerepo
Or abbreviated as:
zypper rr
### List All Software Sources
zypper repos
Or abbreviated as:
zypper lr
### Lock Package Version
zypper addlock
### View Package Dependencies
zypper info --requires
### Verify Package Integrity
zypper verify
* * *
## Practical Application Examples
### Example 1: Install Development Tools
## Instance
zypper refresh
zypper install-t pattern devel_basis
### Example 2: Search and Install Text Editor
## Instance
zypper se editor
zypper install vim
### Example 3: Update System and Automatically Agree to All Licenses
zypper --non-interactive update --auto-agree-with-licenses
### Example 4: Add Packman Software Source and Install Multimedia Decoder
## Instance
zypper ar-f http://ftp.gwdg.de/pub/linux/misc/packman/suse/openSUSE_Leap_15.3/ packman
zypper dup --from packman --allow-vendor-change
zypper install ffmpeg
* * *
## Common Problem Solutions
### 1. Dependency Conflicts
When encountering dependency conflicts, you can try:
zypper dup
Or specify to allow vendor changes:
zypper install --allow-vendor-change
### 2. Lock Packages
If you need to prevent a package from being updated:
zypper addlock
### 3. Rollback Operations
zypper records all transactions, you can view the history:
zypper history
Then rollback to a specific transaction:
zypper rollback
* * *
## Comparison Between zypper and Other Package Management Tools
| Function | zypper | apt (Debian) | dnf/yum (RHEL) |
| --- | --- | --- | --- |
| Refresh Software Sources | `zypper ref` | `apt update` | `dnf makecache` |
| Install Packages | `zypper in` | `apt install` | `dnf install` |
| Remove Packages | `zypper rm` | `apt remove` | `dnf remove` |
| System Update | `zypper up` | `apt upgrade` | `dnf upgrade` |
| Search Packages | `zypper se` | `apt search` | `dnf search` |
| Software Source Management | `zypper ar` | `add-apt-repository` | `dnf config-manager` |
* * *
## Best Practice Recommendations
1. **Regular Updates**: Keep the system updated to get the latest security patches and feature improvements
## Instance
zypper refresh
zypper update
2. **Use Patterns for Installation**: openSUSE provides predefined package combinations (patterns)
zypper install -t pattern
3. **Clean Cache**: Regularly clean the downloaded package cache to free up disk space
zypper clean
4. **View Changes**: Before executing installation or updates, use the `--dry-run` option to preview the operations to be performed
zypper install --dry-run
5. **Backup Important Data**: Backup important data before performing major system updates
* * *
By mastering zypper commands, you can efficiently manage packages in openSUSE/SLE systems, keeping the system secure and stable. It is recommended that beginners start with basic commands and gradually try more advanced features.
* * Linux Command Encyclopaedia](#)
YouTip