Source: http://www.linuxidc.com/Linux/2014-11/109214.htm
Zypper is the command line interface used by SUSE Linux to install, upgrade, uninstall, manage warehouses, and perform various package queries. This article will discuss several examples of different commands in Zypper.
Grammar:
- # Zypper [--global-opts] <command> [--command-opts] [command-arguments]
The parts in brackets are not required. The simplest way to execute zypper is to enter Zypper and.
Example 1: List the available global options and commands
Open terminal, enter zypper and press ENTER, it will show all available global options and commands.
- Linux-xa3t: ~# zypper
Example 2: Getting help with a command from Zypper
Syntax: zypper help [command]
- Linux-xa3t: ~# zypper help remove
- Remove (rm)[options]<capability> ...
- Remove Packages with specified capabilities.
- A capability is NAME[. ARCH] [op<VERSION;],where OP is one of <,<=,=, >=, a.
- Command options:
- -r,--<alias|#|>load only the specified repository
- -T,--type <type>type of package , patch, Pattern, product).
- Default:package.
- -N,--name Select packages by plain name, not by capability.
- -C,--capability Select Packages by capability.
- --Debug-Solver Create Solver test Case for debugging.
- -R,--No-Force-resolution don't force the solver to find Solution,let it ask.
- --Force-resolution force the Solver to Find a solution (even an aggressive one).
- -u,--clean-deps automatically remove unneeded dependencies.
- -U,--no-clean-deps no automatic removal of unneeded dependencies.
- -D,--dry-run Test the removal, do not actually remove .
Example 3: Open Zypper shell/session
- Linux-xa3t: ~# zypper sh
- Zypper>
Or
- Linux-xa3t: ~# zypper Shell
- Zypper>
Example 4: List the defined warehouses
- Linux-xa3t: ~# zypper repos
Or
- Linux-xa3t: ~# zypper lr
4.1) List the URI of the warehouse in tabular form
4.2) List warehouses in priority order
- Linux-xa3t: ~# zypper lr-p
Example 5: Refreshing the Warehouse
- Linux-xa3t: ~# zypper ref
- Repository' Opensuse-13.1-non-oss ' is up to date.
- Repository' Opensuse-13.1-oss ' is up to date.
- Repository' Opensuse-13.1-update ' is up to date.
- Repository' Opensuse-13.1-update-non-oss ' is up to date.
- All repositories has been refreshed.
Example 6: Modifying the Zypper Warehouse
Zypper warehouses can be modified by aliases, numbers, or URIs, or through the options ' –all, –remote, –local, –medium-type '.
linux-xa3t:~ # zypper mr-d 6 #禁用6号仓库 linux-xa3t:~ # zypper mr-rk-p the upd #启用自动书信并为 ' upd ' warehouse set rpm file ' cache ' and set it to the priority of Linux -xa3t:~ # zypper Mr-ka #为所有的仓库禁用rpm文件缓存 linux-xa3t:~ # zypper Mr-kt #为远程仓库设置rpm文件缓存
Example 7: Adding a warehouse
Syntax: URL or alias for zypper Addrepo or Zypper ar < warehouse >
- Linux-xa3t: ~# zypper ar http://download.opensuse.org/update/13.1/update
- Adding repository ' Update '..... ..... ..... ....... .................. [done]
- Repository' Update ' successfully added
- Enabled:Yes
- AutoRefresh:No
- GPG Check:Yes
- URI: http://download.opensuse.org/update/13.1/
Example 8: Removing a warehouse
Syntax: Zypper Removerepo < warehouse name > < aliases >
Or
Zypper RR < warehouse name > < alias >
- Linux-xa3t: ~# zypper RR opensuse-13.1-1.10 opensuse-13.1-1.10
- Removing repository ' opensuse-13.1-1.10 '.......... .......... [done]
- Repository' opensuse-13.1-1.10 ' has been removed.
for more details, please read on to the next page. Highlights : http://www.linuxidc.com/Linux/2014-11/109214p2.htm
SUSE Linux–zypper Command Example