Chapter 31. Zypper

Objectives

  • Explain what zypper is
  • Discuss the queries zypper can be used for
  • Install, remove and upgrade packages using zypper

What is Zypper?

It is homologous to yum and apt but for SUSE Linux and openSUSE. This tool can manage the installation, removal, upgrade and update of packages either localy or remotely.

Zypper Queries

  • Show a list of available updates
    • $ zypper list-updates
  • List available repositories
    • $ zypper repos
  • Search repositories for string
    • $ zypper search <string>
  • List information about package
    • $ zypper info <package>
  • Search repositories to ascertain what packages provide a file
    • $ zypper search --provides <file>

Installing, Removing and Upgrading

  • Install or update packages
    • $ sudo zypper install package
  • Do not ask for confirmation when installing or upgrading
    • $ sudo zypper --non-interactive install <package>
      • This is equivalent to
        • $ sudo yum install -y <package>
  • ​​​Update all installed packages
    • $ sudo zypper update
  • Update a specific package without asking for confirmation
    • $ sudo zypper --non-interactive update
  • Remove a package from the system
    • $ sudo zypper remove <package>
      • Be careful removing packages since its behavior is similar to yum's, in which it will remove the package and those who depend on it

Additional Zypper Commands

Using zypper through its cli (command line interface)

$ sudo zypper shell
> install bash
...
> exit

​Because zypper supports the readline library, you can use all the same command line editing functions in the zypper shell available in the bash shell.

To add a new repository

$ sudo zypper addrepo URI alias

Which is located at the supplied URI and will use the supplied alias

To remove a repository from the list

$ sudo zypper removerepo alias

​Using the alias of the repo you want to delete