Network Security Internet Technology Development Database Servers Mobile Phone Android Software Apple Software Computer Software News IT Information

In addition to Weibo, there is also WeChat

Please pay attention

WeChat public account

Shulou

What is the function of the Zypper command in Linux

2025-02-25 Update From: SLTechnology News&Howtos shulou NAV: SLTechnology News&Howtos > Servers >

Share

Shulou(Shulou.com)06/01 Report--

This article introduces what is the role of the Zypper command in Linux, the content is very detailed, interested friends can refer to, hope to be helpful to you.

Zypper is a command line interface for installing, upgrading, uninstalling, managing warehouses and querying various packages in SUSE Linux. This article will discuss several examples of different commands for zypper.

Syntax:

The code is as follows:

# zypper [--global-opts] [--command-opts] [command-arguments]

The part in square brackets may not be needed. The easiest way to execute zypper is to type zypper and.

Example 1: list the available global options and commands

Open the terminal, type zypper and press enter, and it will display all available global options and commands.

The code is as follows:

Linux-xa3t:~ # zypper

Example 2: get help from a command in zypper

Syntax: zypper help [command]

The code is as follows:

Linux-xa3t:~ # zypper help remove

Remove (rm) [options]...

Remove packages with specified capabilities.

A capability is NAME [.ARCH] [OP], where OP is one of.

Command options:

-r,-- repo Load only the specified repository.

-t,-- type Type of package (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 Do not 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 a zypper shell/ session

The code is as follows:

Linux-xa3t:~ # zypper sh

Zypper >

Or

The code is as follows:

Linux-xa3t:~ # zypper shell

Zypper >

Example 4: list defined warehouses

The code is as follows:

Linux-xa3t:~ # zypper repos

Or

The code is as follows:

Linux-xa3t:~ # zypper lr

4.1) list the URI of the warehouse in tabular form

4.2) list warehouses by priority

The code is as follows:

Linux-xa3t:~ # zypper lr-p

Example 5: refresh the warehouse

The code is as follows:

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 have been refreshed.

Example 6: modify the zypper repository

The zypper repository can be modified by aliases, numbers, or URI, or by options such as'- all,-remote,-local,-medium-type'.

Linux-xa3t:~ # zypper mr-d 6 # disable Warehouse 6 linux-xa3t:~ # zypper mr-rk-p 70 upd # enable automatic correspondence and set rpm file 'cache' for 'upd' warehouse' and set it to 70 linux-xa3t:~ # zypper mr-Ka # disable rpm file cache linux-xa3t:~ # zypper mr-kt # for all warehouses set rpm file cache for remote repositories

Example 7: add a warehouse

Syntax: zypper addrepo or zypper ar

The code is as follows:

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: remove the warehouse

Syntax:

The code is as follows:

Zypper removerepo

Or

The code is as follows:

Zypper rr

[code] 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.

Example 9: install the package

Syntax: zypper install or zypper in

The code is as follows:

Linux-xa3t:~ # zypper install vlc

Example 10: uninstall the package

Syntax: zypper remove or zypper rm

The code is as follows:

Linux-xa3t:~ # zypper remove sqlite

Example 11: export and import warehouse

Export the syntax of the warehouse: zypper repos-export or zypper lr-e

The code is as follows:

Linux-xa3t:~ # zypper lr-export repo-backup/back.repo

Repositories have been successfully exported to repo-backup/back.repo.

Syntax for importing the warehouse:

The code is as follows:

Linux-xa3t:~ # zypper ar repo-backup/back.repo

Example 12: update a software package

Syntax: zypper update or zypper up

The code is as follows:

Linux-xa3t:~ # zypper update bash

Example 13: install the source package

Syntax: zypper source-install or zypper si

The code is as follows:

Linux-xa3t:~ # zypper source-install zypper

Example 14: install only dependency packages

The command in example 13 installs and builds dependencies for specific packages. If you want to install the source package, use the-D option

The code is as follows:

# zypper source-install-D package_name

Use-d only to install dependencies

The code is as follows:

# zypper source-install-d package_name

On the role of the Zypper command in Linux is shared here, I hope that the above content can be of some help to you, can learn more knowledge. If you think the article is good, you can share it for more people to see.

Welcome to subscribe "Shulou Technology Information " to get latest news, interesting things and hot topics in the IT industry, and controls the hottest and latest Internet news, technology news and IT industry trends.

Views: 0

*The comments in the above article only represent the author's personal views and do not represent the views and positions of this website. If you have more insights, please feel free to contribute and share.

Share To

Servers

Wechat

© 2024 shulou.com SLNews company. All rights reserved.

12
Report