Introduction to Zypper Package manager For OpenSUSE and SLE

Zypper is the command line package manager on openSUSE and SLE. It’s also a repository manager, having the capability of adding and removing repositories. It was first introduced in OpenSUSE 10.2 and SUSE Linux Enterprise 10 SP1.

Check Version

[email protected]:~> zypper --version
zypper 1.12.31

Managing Software Packages

install package

sudo zypper install <package_name>

remove a package

sudo zypper remove <package_name>

update all installed packages with newer versions

sudo zypper up

install local rpm package

sudo zypper install /path/to/the/local-rpm-package.rpm

Zypper install local rpm package

Managing Repositories

Refresh repositories.This is equivalent to sudo apt-get update command in Debian and Ubuntu.

sudo zypper refresh

list all repositories

zypper repos

zypper refresh repository

You can see the name and alias of your repos, whether it’s enabled or not. You can find duplicate repos with this command if your system has duplicate repos.

Remove a repository

sudo zypper removerepo <name-of-the-repo>

check which repository a package belongs to

zypper info <package_name>

check package info

Repo files

.repo files on OpenSUSE are similiar to .repo files on RHEL, CentOS and Fedora.

.repo files are stored under /etc/zypp/repos.d directory.

openSUSE repo files

The text in the [ ] is the alias of the repo.  keeppackages=0 means zypper will delete the rpm package from cache once the installation is complete.

repo alias

You can remove a repo from OpenSUSE using sudo zypper removerepo <alias-of-repo> command, The same can be achieved by deleting the corresponding .repo file. For example, if I delete google-chrome.repo file, then Google Chrome repo will be remove from my system and I will not receieve any updates for Google Chrome browser.

Rate this tutorial
[Total: 0 Average: 0]