当前位置:网站首页>zypper命令使用示例
zypper命令使用示例
2022-06-11 21:34:00 【51CTO】
Zypper是OpenSUSE和企业版SUSE中软件包管理器ZYpp的命令行接口。 主要用于:1.管理软件包:zypper可用来安装、删除、更新和查询本地或远程的软件包。2.管理仓库:zypper可用命令行添加、删除、启用或禁用库。 |

I. 用zypper管理软件包
1. 安装包
语法: # zypper install 示例:安装Mozilla firefox
[[email protected] ~]# zypper install MozillaFirefox
Loading repository data...
Reading installed packages...
Resolving package dependencies...
The following NEW packages are going to be installed:
MozillaFirefox MozillaFirefox-branding-SLED
The following packages are not supported by their vendor:
MozillaFirefox MozillaFirefox-branding-SLED
2 new packages to install.
Overall download size: 964.0 KiB. After the operation, additional 3.4 MiB will be used.
Continue? [y/n/?] (y): y
Retrieving package MozillaFirefox-3.6.16-0.2.1.x86_64 (1/2), 949.0 KiB (3.4 MiB unpacked)
Retrieving: MozillaFirefox-3.6.16-0.2.1.x86_64.rpm [done]
Installing: MozillaFirefox-3.6.16-0.2.1 [done]
Retrieving package MozillaFirefox-branding-SLED-3.5-1.1.5.x86_64 (2/2), 15.0 KiB (34.0 KiB unpacked)
Retrieving: MozillaFirefox-branding-SLED-3.5-1.1.5.x86_64.rpm [done]
Installing: MozillaFirefox-branding-SLED-3.5-1.1.5 [done]
- 1.
- 2.
- 3.
- 4.
- 5.
- 6.
- 7.
- 8.
- 9.
- 10.
- 11.
- 12.
- 13.
- 14.
- 15.
- 16.
- 17.
2. 安装源码包
语法:# zypper source-install 示例:从库中安装 apache
[[email protected] ~]# zypper source-install apache2-mod_nss
Reading installed packages...
Loading repository data...
Resolving package dependencies...
Retrieving package mozilla-nss-devel-3.12.8-1.2.1.x86_64 (2/3), 473.0 KiB (2.6 MiB unpacked)
Retrieving: mozilla-nss-devel-3.12.8-1.2.1.x86_64.rpm [done]
Installing: mozilla-nss-devel-3.12.8-1.2.1 [done]
Retrieving: apache2-mod_nss-1.0.8-17.5.src.rpm [done]
- 1.
- 2.
- 3.
- 4.
- 5.
- 6.
- 7.
- 8.
3. 更新包
更新某一软件包: # zypper update 更新所有软件包: # zypper update
查看所有可用的更新列表:# zypper list-updates
4. 删除包
语法:# zypper remove 示例:移除Mozilla Firefox
[[email protected] ~]# zypper remove MozillaFirefox
Loading repository data...
Reading installed packages...
Resolving package dependencies...
The following packages are going to be REMOVED:
MozillaFirefox MozillaFirefox-branding-SLED
2 packages to remove.
After the operation, 3.4 MiB will be freed.
Continue? [y/n/?] (y): y
Removing MozillaFirefox-branding-SLED-3.5-1.1.5 [done]
Removing MozillaFirefox-3.6.16-0.2.1 [done]
- 1.
- 2.
- 3.
- 4.
- 5.
- 6.
- 7.
- 8.
- 9.
- 10.
- 11.
5. 查找包
语法:# zypper search 示例:查找所有usb开头的软件包
[[email protected] ~]# zypper search usb*
Loading repository data...
Reading installed packages...
S | Name | Summary | Type
--+---------------------+----------------------------------------------------------------+--------
| usb_modeswitch | A mode switching tool for controlling multiple-device USB gear | package
| usb_modeswitch-data | A mode switching tool for controlling multiple-device USB gear | package
| usbip-devel | Headers and static libraries | package
i | usbutils | Tools and libraries for USB devices | package
- 1.
- 2.
- 3.
- 4.
- 5.
- 6.
- 7.
- 8.
- 9.
- 10.
6. 查看软件包详情
语法: zypper info 示例:查看usbutils的信息
[[email protected] ~]# zypper info usbutils
Loading repository data...
Reading installed packages...
Information for package usbutils:
Repository: LINUXPROBE
Name: usbutils
Version: 0.73-38.19
Arch: x86_64
Vendor: SUSE LINUX Products GmbH, Nuernberg, Germany
Support Level: unknown
Installed: Yes
Status: up-to-date
Installed Size: 461.0 KiB
Summary: Tools and libraries for USB devices
Description:
This package contains a utility for inspecting devices connected to USB
ports.
It requires kernel version 2.3.99-pre7 or newer, or the USB backport
which was introduced in 2.2.18 (supporting the /proc/bus/usb
interface).
- 1.
- 2.
- 3.
- 4.
- 5.
- 6.
- 7.
- 8.
- 9.
- 10.
- 11.
- 12.
- 13.
- 14.
- 15.
- 16.
- 17.
- 18.
- 19.
- 20.
7. 打补丁
查看所有可打补丁: zypper patches
安装指定补丁:zypper patch
8. 锁住包
软件包被锁之后将不能被移除或升级,下面演示一下如何加锁
1)加al选项锁住包文件“usbutils”, al 是 add lock的缩写
2) 加ll选项查看所有已被锁住的软件包, ll 是 List Locks的缩写
[[email protected] ~] # zypper ll
# | Name | Type | Repository
--+-----------------+---------+-----------
1 | usbutils | package | (any)
- 1.
- 2.
- 3.
- 4.
9. 解锁包
加rl选项解锁usbutils, rl 是 remove lock的缩写
[[email protected] ~] # zypper rl usbutils
1 lock has been successfully removed.
[[email protected] ~]# zypper ll
There are no package locks defined.
- 1.
- 2.
- 3.
- 4.
II. 用zypper管理仓库
10. 用zypper添加库
语法:# zypper addrepo
[[email protected] ~] # zypper addrepo --check --refresh --name "Mozilla-repo" http://download.opensuse.org/repositories/mozilla/SLE_11/ "Mozillarepo"
Adding repository 'Mozilla-repo' [done]
Repository 'Mozilla-repo' successfully added
Enabled: Yes
Autorefresh: Yes
URI: http://download.opensuse.org/repositories/mozilla/SLE_11/
- 1.
- 2.
- 3.
- 4.
- 5.
- 6.
11. 创建本地库
我们可以使用zypper从本地目录中创建一个包含所有rpm文件的本地库
语法: # zypper addrepo
示例:创建一个名为Linuxprobe_Repo的本地目录,包含所有rpm文件
[[email protected] ~] # zypper addrepo /var/stormgt/dsminst Linuxprobe_Repo
Adding repository 'Linuxprobe_Repo' [done]
Repository 'Linuxprobe_Repo' successfully added
Enabled: Yes
Autorefresh: No
URI: dir:///var/stormgt/dsminst
[[email protected] ~] # zypper search --repo Linuxprobe_Repo
Loading repository data...
Reading installed packages...
S | Name | Summary | Type
--+-------------+-----------------------------------------+--------
i | TIVsm-API | the API | package
i | TIVsm-API64 | the API | package
i | TIVsm-BA | the Backup Archive Client | package
i | gskcrypt32 | IBM GSKit Cryptography Runtime | package
i | gskcrypt64 | IBM GSKit Cryptography Runtime | package
i | gskssl32 | IBM GSKit SSL Runtime With Acme Toolkit | package
i | gskssl64 | IBM GSKit SSL Runtime With Acme Toolkit | package
- 1.
- 2.
- 3.
- 4.
- 5.
- 6.
- 7.
- 8.
- 9.
- 10.
- 11.
- 12.
- 13.
- 14.
- 15.
- 16.
- 17.
- 18.
注:你也可以通过此命令添加NFS或FTP路径
12. 查看库
[[email protected] ~] # zypper lr
# | Alias | Name | Enabled | Refresh
--+--------------------------------------------------+--------------------------------------------------+---------+--------
1 | Mozillarepo | Mozilla-repo | Yes | Yes
2 | SUSE-Linux-Enterprise-Server-11-SP1 11.1.1-1.152 | SUSE-Linux-Enterprise-Server-11-SP1 11.1.1-1.152 | Yes | Yes
- 1.
- 2.
- 3.
- 4.
- 5.
查看repo完整的URI:
[[email protected] ~] # zypper lr --uri
# | Alias | Name | Enabled | Refresh | URI
--+--------------------------------------------------+--------------------------------------------------+---------+---------+----------------------------------------------------------
1 | Mozillarepo | Mozilla-repo | Yes | Yes | http://download.opensuse.org/repositories/mozilla/SLE_11/
2 | SUSE-Linux-Enterprise-Server-11-SP1 11.1.1-1.152 | SUSE-Linux-Enterprise-Server-11-SP1 11.1.1-1.152 | Yes | Yes | http://19.106.65.64/FUSELinux/600RC0
- 1.
- 2.
- 3.
- 4.
- 5.
13. 在库中搜索包
列出指定库Mozillarepo的所有软件包
[[email protected] ~] # zypper search --repo Mozillarepo
Loading repository data...
Reading installed packages...
S | Name | Summary | Type
--+--------------------------------------+-------------------------------------------------------------------------+-----------
i | MozillaFirefox | Mozilla Firefox Web Browser | package
i | MozillaFirefox-branding-SLED | SLED branding of MozillaFirefox | package
| MozillaFirefox-branding-openSUSE | openSUSE branding of MozillaFirefox | package
| MozillaFirefox-branding-openSUSE | openSUSE branding of MozillaFirefox | srcpackage
- 1.
- 2.
- 3.
- 4.
- 5.
- 6.
- 7.
- 8.
- 9.
- 10.
14. 库重命名
重命名库可以用 renamerepo 选项
示例:将库"Linuxprobe_Repo"的名字改成"MyLinuxRepo"
[[email protected] ~] # zypper renamerepo Linuxprobe_Repo MyLinuxRepo
Repository 'Linuxprobe_Repo' renamed to 'MyLinuxRepo'.
- 1.
- 2.
15. 删除库
用removerepo选项来移除库
[[email protected] ~] # zypper removerepo MyLinuxRepo
Removing repository 'MyLinuxRepo' [done]
Repository 'MyLinuxRepo has been removed.
- 1.
- 2.
- 3.
16. 备份库
用export选项可以备份一系列库文件
[[email protected] ~] # zypper lr --export /var/tmp/backup.repo
Repositories have been successfully exported to /var/tmp/backup.repo.
- 1.
- 2.
17. 从备份文件中添加库
18. 禁用/使用库
示例: 用 modifyrepo 选项的 -d 参数来禁用Mozilla库
[[email protected] ~] # zypper modifyrepo -d Mozillarepo
Repository 'Mozillarepo' has been successfully disabled.
- 1.
- 2.
示例: 用 modifyrepo选项 -e 参数来允许使用Mozilla库
[[email protected] ~] # zypper modifyrepo -e Mozillarepo
Repository 'Mozillarepo' has been successfully enabled.
- 1.
- 2.
19. 刷新库
示例: 刷新Mozilla库
[[email protected] ~] # zypper refresh Mozillarepo
Repository 'Mozilla-repo' is up to date.
Specified repositories have been refreshed.
- 1.
- 2.
- 3.
示例: 自动刷新指定库
[[email protected] ~] # zypper modifyrepo --refresh Linuxprobe_Repo
Autorefresh has been enabled for repository 'Linuxprobe_Repo'.
- 1.
- 2.
边栏推荐
- Software test plan
- RPA丨首席财务官如何找到数字化转型“超级入口”?
- [thinking about life] words and sounds
- Bug -- coredump usage
- Flutter series: detailed explanation of container layout commonly used in flutter
- 即将首发 | 业界首个零售数字化创新白皮书,解锁全链路数字化致胜秘籍
- Customer information management software
- Object creation process of JVM
- Hangzhou Electric Zhongchao 91006 guess the weight
- [Part 15] use and basic principle of forkjoinpool [key]
猜你喜欢

Flutter implements the JD address selection component

JVM object allocation policy TLAB
![[Part 15] use and basic principle of forkjoinpool [key]](/img/36/e21b16ec92d444149bc793f340f9f3.jpg)
[Part 15] use and basic principle of forkjoinpool [key]

LeetCode-110-平衡二叉树

How does the chief financial officer of RPA find the "super entrance" of digital transformation?

The gateway starts other microservices first. When the gateway is started, the gateway cannot be started and there is no exception log; Start the gateway first, and all services can be started normall

LeetCode-155-最小栈

A collection of commonly used open source data sets for face recognition

LeetCode-32-最长有效括号

2021牛客多校5 Double Strings
随机推荐
Using the sap ui5 cli command line tool to build and run SAP ui5 applications
Codeworks round 740 Div. 2 problem solving Report
Jenkins+allure integrated report construction
[Part 14] source code analysis and application details of completionservice class [key]
Field queryIndexFieldnameService in xxxImpl required a single bean, but 19 were found:
JVM|本地方法接口;本地方法栈
实现 TabLayout 下标与文字等长,选中字体大小改变
Deriving Kalman filter from probability theory
JVM | local method interface; Native Method Stack
UML系列文章(29)体系结构建模---模式和框架
Refresh and upgrade | innovation, starting from cloud store
Chain storage structure of linear table
JVM method area
table_ Display status
How does the chief financial officer of RPA find the "super entrance" of digital transformation?
Jenkins+allure integrated report construction
flutter系列之:flutter中常用的container layout详解
一步步把 SAP UI5 应用部署到 SAP BTP Kyma 运行环境中去
如何利用RPA机器人开启货代行业数字化转型第一步?
Leetcode-32- longest valid bracket