How to install, find and remove packages with zypper

In this article I will show you how to use the OpenSUSE‘s zypper package manager to do administrative stuff.

Watch Free Movies

Installing, finding and removing packages are easy tasks that every Linux user should be able to do on his favourite distro.

1. How to check if a package is installed or not

zypper can display the installed packages, but rpm does the same thing faster.

So, you can use both zypper or rpm to find out if a package is installed or not:
$ zypper -is | grep packagename
Or:
$ rpm -qa | grep packagename

2. How to install packages with zypper:

zypper install (or zypper in) is the command for installing packages:

$ sudo zypper install nmap

Zypper is a very powerfull package manager. It can install more than one package with a single zypper command: sudo zypper in package1 package2.

To install and uninstall multiple packages with a single command, type a minus in front of the package you want to remove: sudo zypper in package1 -package2. (this will install package1 and uninstall package2)

To install a local rpm use sudo zypper in package.rpm
And for a remote rpm use: sudo zypper install http://link.to.file.com/pack.rpm

3. How to remove / uninstall packages:

zypper remove package and zypper rm package are used for uninstalling packages:

$ sudo zypper rm nmap

4. How to search for packages in the repos:

zypper has two different commands for searching packages by name: zypper search package and by pattern: zypper search -t pattern pattern

5. How to list the installed repos with zypper:

$ zypper repos
Or:
$ zypper lr

These commands display the repos in a table.

6. How to update the repos and the whole system:

Use this command to update the repolist:
$ sudo zypper refresh

And this command to update the system:
$ sudo zypper update

7. How to add a new repo with zypper:

$ sudo zypper addrepo http://link.to.repo.com/ repo_alias
OR:
$ sudo zypper ar http://link.to.repo.com/ repo_alias

8. How to delete a repo with zypper:

To delete a repo, use: sudo zypper rr repo_alias

9. How to install only the source package or only the dependencies:

Install only the source package: zypper in -D package
Install only the dependencies: zypper in -d package

Scroll to Top