Previous Chapter - Table of Contents - Next Chapter
For use on SUSE-based systems, zypper program provides higher level of intelligent services for using underlying rpm program, plays same role as yum on Red Hat-based systems. Can automatically resolve dependencies when installing, updating, removing packages. Accesses external software repositories, synchronizing with them, retrieving/installing software as needed.
- Explain what zypper is.
- Discuss the queries zypper can be used for.
- Install, remove, and upgrade packages using zypper.
- Learn additional and more advanced zypper commands.
zypper: command line tool for installing/managing packages in SUSE Linux and openSUSE. Very similar to yum in functionality, even in basic command syntax, also works with rpm packages.
Retrieves packages from repositories, installs, removes, updates while resolving any dependencies encountered. Equivalent in practice to yum and apt-get in that it can retrieve packages from repository and also resolve dependencies.
Some examples of commonly performed operations involving querying:
-
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>
-
Find which package provides file specified as argument:
$ zypper what-provides <file-path>
Some examples of commonly performed operations:
-
Install or update package(s):
$ sudo zypper install package
-
Do not ask for confirmation when installing or upgrading:
$ sudo zypper --non-interactive install <package>
This is useful for scripts and is equivalent to running
yum -y. -
Update all installed packages:
$ sudo zypper update
Giving package names as an argument will update only those packages and any required dependencies. Do this without asking for confirmation:
$ sudo zypper --non-interactive update
-
Remove a package from the system:
$ sudo zypper remove <package>
Like with yum, have to be careful with removal command, as any package that needs the package being removed would be removed as well.
Sometimes, number of zypper commands must be run in sequence. To avoid re-reading all databases for each command, can run zypper in shell mode:
$ sudo zupper shell
> install bash
...
> exitBecause zypper supports readline library, can use all the same command line editing function available in bash shell in zypper shell.
To add new repository:
$ sudo zypper addrepo URI aliaswhich is located at the supplied URI and will use supplied alias.
To remove repository from list:
$ sudo zypper removerepo aliasusing alias of repo you want to delete.
To clean up and save space in /var/cache/zypp:
$ sudo zypper clean [--all]