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.

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
$ 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

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
$ 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 repo_alias
$ sudo zypper ar 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

Share and Enjoy

  • Twitter
  • Facebook
  • Google Plus
  • Email
  • RSS
Tagged with: , , , , ,
Posted in The Linux and Unix Articles!
One comment on “How to install, find and remove packages with zypper
  1. Gunjan Shah says:

    I list of steps of project deployment, there is a command which creates problems.

    sudo zypper -n –no-gpg-checks refresh –force -r ic-rpm-snapshots

    I go details of zypper refresh but what is –force -r option ?
    Can anyone please explain me this command ?

Leave a Reply

Your email address will not be published. Required fields are marked *




Subscribe to get the latest Linux news and how to guides directly on your e-mail!