translated by cycoe

This commit is contained in:
cycoe 2018-11-19 12:18:50 +08:00
commit 662fe112a8

View File

@ -58,79 +58,75 @@ root@kerneltalks # zypper
--disable-system-resolvables
Do not read installed packages.
Commands:
help, ? Print help.
shell, sh Accept multiple commands at once.
命令:
help, ? 打印帮助
shell, sh 允许多命令
Repository Management:
repos, lr List all defined repositories.
addrepo, ar Add a new repository.
removerepo, rr Remove specified repository.
renamerepo, nr Rename specified repository.
modifyrepo, mr Modify specified repository.
refresh, ref Refresh all repositories.
clean Clean local caches.
仓库管理:
repos, lr 列出所有自定义仓库
addrepo, ar 添加一个新仓库
removerepo, rr 移除指定仓库
renamerepo, nr 重命名指定仓库
modifyrepo, mr 修改指定仓库
refresh, ref 刷新所有仓库
clean 清除本地缓存
Service Management:
services, ls List all defined services.
addservice, as Add a new service.
modifyservice, ms Modify specified service.
removeservice, rs Remove specified service.
refresh-services, refs Refresh all services.
服务管理:
services, ls 列出所有自定义服务
addservice, as 添加一个新服务
modifyservice, ms 修改指定服务
removeservice, rs 移除指定服务
refresh-services, refs 刷新所有服务
Software Management:
install, in Install packages.
remove, rm Remove packages.
verify, ve Verify integrity of package dependencies.
source-install, si Install source packages and their build
dependencies.
软件管理:
install, in 安装包
remove, rm 移除包
verify, ve 确认包依赖的完整性
source-install, si 安装源码包及其构建依赖
install-new-recommends, inr
Install newly added packages recommended
by installed packages.
安装由已安装包建议一并安装的新包
Update Management:
update, up Update installed packages with newer versions.
list-updates, lu List available updates.
patch Install needed patches.
list-patches, lp List needed patches.
dist-upgrade, dup Perform a distribution upgrade.
patch-check, pchk Check for patches.
更新管理:
update, up 更新已安装包至更新版本
list-updates, lu 列出可用更新
patch 安装必要的补丁
list-patches, lp 列出必要的补丁
dist-upgrade, dup 进行发行版更新
patch-check, pchk 检查补丁
Querying:
search, se Search for packages matching a pattern.
info, if Show full information for specified packages.
patch-info Show full information for specified patches.
pattern-info Show full information for specified patterns.
product-info Show full information for specified products.
patches, pch List all available patches.
packages, pa List all available packages.
patterns, pt List all available patterns.
products, pd List all available products.
what-provides, wp List packages providing specified capability.
查询:
search, se 查找符合匹配模式的包
info, if 展示特定包的完全信息
patch-info 展示特定补丁的完全信息
pattern-info 展示特定模式的完全信息
product-info 展示特定产品的完全信息
patches, pch 列出所有可用的补丁
packages, pa 列出所有可用的包
patterns, pt 列出所有可用的模式
products, pd 列出所有可用的产品
what-provides, wp 列出提供特定功能的包
Package Locks:
addlock, al Add a package lock.
removelock, rl Remove a package lock.
locks, ll List current package locks.
cleanlocks, cl Remove unused locks.
包锁定:
addlock, al 添加一个包锁定
removelock, rl 移除一个包锁定
locks, ll 列出当前的包锁定
cleanlocks, cl 移除无用的锁定
Other Commands:
versioncmp, vcmp Compare two version strings.
targetos, tos Print the target operating system ID string.
licenses Print report about licenses and EULAs of
installed packages.
download Download rpms specified on the commandline to a local directory.
source-download Download source rpms for all installed packages
to a local directory.
其他命令:
versioncmp, vcmp 比较两个版本字符串
targetos, tos 打印目标操作系统 ID 字符串
licenses 打印已安装包的证书和 EULAs 报告
download 使用命令行下载指定 rpm 包到本地目录
source-download 下载所有已安装包的源码 rpm 包到本地目录
Subcommands:
subcommand Lists available subcommands.
子命令:
subcommand 列出可用子命令
Type 'zypper help <command>' to get command-specific help.
输入 'zypper help <command>' 来获得特定命令的帮助。
```
##### How to install package using zypper
##### 如何使用 zypper 安装包
`zypper` takes `in` or `install` switch to install package on your system. Its same as [yum package installation][3], supplying package name as argument and package manager (zypper here) will resolve all dependencies and install them along with your required package.
`zypper` 通过 `in``install` 开关来在你的系统上安装包。它的用法与 [yum package installation][3] 相同。你只需要提供包名作为参数,包管理器(此处是 zypper就会处理所有的依赖并与你指定的包一并安装。
```
# zypper install telnet
@ -152,13 +148,13 @@ Checking for file conflicts: ...................................................
(1/1) Installing: telnet-1.2-165.63.x86_64 .......................................................................................................................[done]
```
Above output for your reference in which we installed `telnet` package.
以上是我们安装 `telnet` 包时的输出,供你参考。
Suggested read : [Install packages in YUM and APT systems][3]
推荐阅读 : [在 YUM 和 APT 系统中安装包][3]
##### How to remove package using zypper
##### 如何使用 zypper 移除包
For erasing or removing packages in Suse Linux, use `zypper` with `remove` or `rm` switch.
要在 Suse Linux 中擦除或移除包,使用 `zypper` 命令附带 `remove``rm` 开关。
```
root@kerneltalks # zypper rm telnet
@ -174,13 +170,13 @@ After the operation, 113.3 KiB will be freed.
Continue? [y/n/...? shows all options] (y): y
(1/1) Removing telnet-1.2-165.63.x86_64 ..........................................................................................................................[done]
```
We removed previously installed telnet package here.
我们在此处移除了先前安装的 telnet 包。
##### Check dependencies and verify integrity of installed packages using zypper
##### 使用 zypper 检查依赖或者认证已安装包的完整性
There are times when one can install package by force ignoring dependencies. `zypper` gives you power to scan all installed packages and checks for their dependencies too. If any dependency is missing, it offers you to install/rempve it and hence maintain integrity of your installed packages.
有时可以通过强制忽略依赖关系来安装软件包。`zypper` 使你能够扫描所有已安装的软件包并检查其依赖性。如果缺少任何依赖项,它将提供你安装或重新安装它的机会,从而保持已安装软件包的完整性。
Use `verify` or `ve` switch with `zypper` to check integrity of installed packages.
使用附带 `verify``ve` 开关的 `zypper` 命令来检查已安装包的完整性。
```
root@kerneltalks # zypper ve
@ -191,11 +187,11 @@ Reading installed packages...
Dependencies of all installed packages are satisfied.
```
In above output, you can see last line confirms that all dependencies of installed packages are completed and no action required.
在上面的输出中,你能够看到最后一行说明已安装包的所有依赖都已安装完全,并且无需更多操作。
##### How to download package using zypper in Suse Linux
##### 如何在 Suse Linux 中使用 zypper 下载包
`zypper` offers way to download package in local directory without installation. You can use this downloaded package on another system with same configuration. Packages will be downloaded to `/var/cache/zypp/packages/<repo>/<arch>/` directory.
`zypper` 提供了一种方法使得你能够将包下载到本地目录而不去安装它。你可以在其他具有同样配置的系统上使用这个已下载的软件包。包会被下载至 `/var/cache/zypp/packages/<repo>/<arch>/` 目录。
```
root@kerneltalks # zypper download telnet
@ -213,13 +209,13 @@ total 52
-rw-r--r-- 1 root root 53025 Feb 21 03:17 telnet-1.2-165.63.x86_64.rpm
```
You can see we have downloaded telnet package locally using `zypper`
你能看到我们使用 `zypper` 将 telnet 包下载到了本地。
Suggested read : [Download packages in YUM and APT systems without installing][4]
推荐阅读 : [在 YUM 和 APT 系统中只下载包而不安装][4]
##### How to list available package update in zypper
##### 如何使用 zypper 列出可用包更新
`zypper` allows you to view all available updates for your installed packages so that you can plan update activity in advance. Use `list-updates` or `lu` switch to show you list of all available updates for installed packages.
`zypper` 允许你浏览已安装包的所有可用更新,以便你可以提前计划更新活动。使用 `list-updates``lu` 开关来显示已安装包的所有可用更新。
```
root@kerneltalks # zypper lu
@ -236,11 +232,11 @@ v | SLE-Module-Containers12-Updates | containerd | 0.2.5+gitr6
v | SLES12-SP3-Updates | crash | 7.1.8-4.3.1 | 7.1.8-4.6.2 | x86_64
v | SLES12-SP3-Updates | rsync | 3.1.0-12.1 | 3.1.0-13.10.1 | x86_64
```
Output is properly formatted for easy reading. Column wise it shows name of repo where package belongs, package name, installed version, new updated available version & architecture.
输出特意被格式化以便于阅读。每一列分别代表包所属仓库名称、包名、已安装版本、可用的更新版本和架构。
##### List and install patches in Suse linux
##### 在 Suse Linux 中列出和安装补丁
Use `list-patches` or `lp` switch to display all available patches for your Suse Linux system which needs to be applied.
使用 `list-patches``lp` 开关来显示你的 Suse Linux 系统需要被应用的所有可用补丁。
```
root@kerneltalks # zypper lp
@ -263,13 +259,13 @@ Found 37 applicable patches:
37 patches needed (18 security patches)
```
Output is pretty much nicely organised with respective headers. You can easily figure out and plan your patch update accordingly. We can see out of 37 patches available on our system 18 are security ones and needs to be applied on high priority!
使用相应的表头可以很好地组织输出。你可以轻松地找出并根据情况计划你的补丁更新。我们能看到在我们的系统中37 个可用补丁中有 18 个是安全补丁,需要被高优先级应用!
You can install all needed patches by issuing `zypper patch` command.
你可以通过发出 `zypper patch` 命令安装所有需要的补丁。
##### How to update package using zypper
##### 如何使用 zypper 更新包
To update package using zypper, use `update` or `up` switch followed by package name. In above list updates command we learned that `rsync` package update is available on our server. Let update it now
要使用 zypper 更新包,使用 `update``up` 开关后接包名。在上述列出的更新命令中,我们知道在我们的服务器上 `rsync` 包更新可用。让我们现在来更新它吧!
```
root@kerneltalks # zypper update rsync
@ -291,9 +287,9 @@ Checking for file conflicts: ...................................................
(1/1) Installing: rsync-3.1.0-13.10.1.x86_64 .....................................................................................................................[done]
```
##### Search package using zypper in Suse Linux
##### 在 Suse Linux 上使用 zypper 查找包
If you are not sure about full package name, no worries. You can search packages in zypper by supplying search string with `se` or `search` switch
如果你不确定包的全名也不要担心。你可以使用 zypper 附带 `se``search` 开关并提供查找字符串来查找包。
```
root@kerneltalks # zypper se lvm
@ -313,11 +309,11 @@ i+ | lvm2 | Logical Volume Manager Tools | package
| lvm2-devel | Development files for LVM2 | package
```
In above example we searched `lvm` string and came up with the list shown above. You can use `Name` in zypper install/remove/update commands.
在上述示例中我们查找了 `lvm` 字符串并得到了如上输出列表。你能在 zypper install/remove/update 命令中使用 `Name` 字段的名字。
##### Check installed package information using zypper
##### 使用 zypper 检查已安装包信息
You can check installed packages details using zypper. `info` or `if` switch will list out information of installed package. It can also displays package details which is not installed. In that case, `Installed` parameter will reflect `No` value.
你能够使用 zypper 检查已安装包的详细信息。`info` 或 `if` 开关将列出已安装包的信息。它也可以显示未安装包的详细信息,在该情况下,`Installed` 参数将返回 `No` 值。
```
root@kerneltalks # zypper info rsync
Refreshing service 'SMT-http_smt-ec2_susecloud_net'.
@ -350,9 +346,9 @@ Description :
for backups and mirroring and as an improved copy command for everyday use.
```
##### List repositories using zypper
##### 使用 zypper 列出仓库
To list repo use `lr` or `repos` switch with zypper command. It will list all available repos which includes enabled and not-enabled both repos.
使用 zypper 命令附带 `lr``repos` 开关列出仓库。
```
root@kerneltalks # zypper lr
@ -369,11 +365,11 @@ Repository priorities are without effect. All enabled repositories share the sam
6 | SMT-http_smt-ec2_susecloud_net:SLE-Module-Containers12-Debuginfo-Updates | SLE-Module-Containers12-Debuginfo-Updates | No | ---- | ----
```
here you need to check enabled column to check which repos are enabled and which are not.
此处你需要检查 `enabled` 列来确定哪些仓库是已被启用的而哪些没有。
##### Add and remove repo in Suse Linux using zypper
##### 在 Suse Linux 中使用 zypper 添加或移除仓库
To add repo you will need URI of repo/.repo file or else you end up in below error.
要添加仓库你需要仓库或 .repo 文件的 URI否则你会遇到如下错误。
```
root@kerneltalks # zypper addrepo -c SLES12-SP3-Updates
@ -381,7 +377,7 @@ If only one argument is used, it must be a URI pointing to a .repo file.
```
With URI, you can add repo like below :
使用 URI你可以像如下方式添加仓库
```
root@kerneltalks # zypper addrepo -c http://smt-ec2.susecloud.net/repo/SUSE/Products/SLE-SDK/12-SP3/x86_64/product?credentials=SMT-http_smt-ec2_susecloud_net SLE-SDK12-SP3-Pool
@ -397,18 +393,18 @@ Priority : 99 (default priority)
Repository priorities are without effect. All enabled repositories share the same priority.
```
Use `addrepo` or `ar` switch with `zypper` to add repo in Suse. Followed by URI and lastly you need to provide alias as well.
在 Suse 中使用附带 `addrepo``ar` 开关的 `zypper` 命令添加仓库,后接 URI 以及你需要提供一个别名。
To remove repo in Suse, use `removerepo` or `rr` switch with `zypper`.
要在 Suse 中移除一个仓库,使用附带 `removerepo``rr` 开关的 `zypper` 命令。
```
root@kerneltalks # zypper removerepo nVidia-Driver-SLE12-SP3
Removing repository 'nVidia-Driver-SLE12-SP3' ....................................................................................................................[done]
Repository 'nVidia-Driver-SLE12-SP3' has been removed.
```
##### Clean local zypper cache
##### 清除 zypper 本地缓存
Cleaning up local zypper caches with `zypper clean` command
使用 `zypper clean` 命令清除 zypper 本地缓存。
```
root@kerneltalks # zypper clean
@ -420,7 +416,7 @@ All repositories have been cleaned up.
via: https://kerneltalks.com/commands/12-useful-zypper-command-examples/
作者:[KernelTalks][a]
译者:[译者ID](https://github.com/译者ID)
译者:[cycoe](https://github.com/cycoe)
校对:[校对者ID](https://github.com/校对者ID)
本文由 [LCTT](https://github.com/LCTT/TranslateProject) 原创编译,[Linux中国](https://linux.cn/) 荣誉推出