{"id":5755,"date":"2022-06-11T10:23:35","date_gmt":"2022-06-11T02:23:35","guid":{"rendered":"http:\/\/gulass.cn\/?p=5755"},"modified":"2022-06-11T20:47:39","modified_gmt":"2022-06-11T12:47:39","slug":"zypper-commands-examples","status":"publish","type":"post","link":"https:\/\/gulass.cn\/zypper-commands-examples.html","title":{"rendered":"zypper\u547d\u4ee4\u4f7f\u7528\u793a\u4f8b"},"content":{"rendered":"
\n

\u672c\u6587\u7531gulass.cn\u56e2\u961f\u6210\u5458\u70e8\u5b50<\/span>\u6574\u7406\u53d1\u5e03\uff0c\u70b9\u6b64\u67e5\u770b\u6700\u65b0Linux\u8d44\u8baf<\/a><\/span><\/strong>\u3002<\/p>\n<\/div>\n\n\n\n
\u5bfc\u8bfb<\/td>\nZypper\u662fOpenSUSE\u548c\u4f01\u4e1a\u7248SUSE\u4e2d\u8f6f\u4ef6\u5305\u7ba1\u7406\u5668ZYpp\u7684\u547d\u4ee4\u884c\u63a5\u53e3\u3002 \u4e3b\u8981\u7528\u4e8e\uff1a1.\u7ba1\u7406\u8f6f\u4ef6\u5305\uff1azypper\u53ef\u7528\u6765\u5b89\u88c5\u3001\u5220\u9664\u3001\u66f4\u65b0\u548c\u67e5\u8be2\u672c\u5730\u6216\u8fdc\u7a0b\u7684\u8f6f\u4ef6\u5305\u30022.\u7ba1\u7406\u4ed3\u5e93\uff1azypper\u53ef\u7528\u547d\u4ee4\u884c\u6dfb\u52a0\u3001\u5220\u9664\u3001\u542f\u7528\u6216\u7981\u7528\u5e93\u3002<\/strong><\/td>\n<\/tr>\n<\/tbody>\n<\/table>\n

\"OpenSUSE\"<\/p>\n

I. \u7528zypper\u7ba1\u7406\u8f6f\u4ef6\u5305<\/strong><\/div>\n

1. \u5b89\u88c5\u5305<\/strong>
\n\u8bed\u6cd5\uff1a # zypper install \u793a\u4f8b\uff1a\u5b89\u88c5Mozilla firefox<\/p>\n

[root@linuxprobe ~]# zypper install MozillaFirefox\r\nLoading repository data...\r\nReading installed packages...\r\nResolving package dependencies...\r\nThe following NEW packages are going to be installed:\r\n  MozillaFirefox MozillaFirefox-branding-SLED\r\nThe following packages are not supported by their vendor:\r\n  MozillaFirefox MozillaFirefox-branding-SLED\r\n2 new packages to install.\r\nOverall download size: 964.0 KiB. After the operation, additional 3.4 MiB will be used.\r\nContinue? [y\/n\/?] (y): y\r\nRetrieving package MozillaFirefox-3.6.16-0.2.1.x86_64 (1\/2), 949.0 KiB (3.4 MiB unpacked)\r\nRetrieving: MozillaFirefox-3.6.16-0.2.1.x86_64.rpm [done]\r\nInstalling: MozillaFirefox-3.6.16-0.2.1 [done]\r\nRetrieving package MozillaFirefox-branding-SLED-3.5-1.1.5.x86_64 (2\/2), 15.0 KiB (34.0 KiB unpacked)\r\nRetrieving: MozillaFirefox-branding-SLED-3.5-1.1.5.x86_64.rpm [done]\r\nInstalling: MozillaFirefox-branding-SLED-3.5-1.1.5 [done]\r\n<\/pre>\n

2. \u5b89\u88c5\u6e90\u7801\u5305<\/strong>
\n\u8bed\u6cd5\uff1a# zypper source-install \u793a\u4f8b\uff1a\u4ece\u5e93\u4e2d\u5b89\u88c5 apache<\/p>\n

[root@linuxprobe ~]# zypper source-install apache2-mod_nss\r\nReading installed packages...\r\nLoading repository data...\r\nResolving package dependencies...\r\nRetrieving package mozilla-nss-devel-3.12.8-1.2.1.x86_64 (2\/3), 473.0 KiB (2.6 MiB unpacked)\r\nRetrieving: mozilla-nss-devel-3.12.8-1.2.1.x86_64.rpm [done]\r\nInstalling: mozilla-nss-devel-3.12.8-1.2.1 [done]\r\nRetrieving: apache2-mod_nss-1.0.8-17.5.src.rpm [done]\r\n<\/pre>\n

3. \u66f4\u65b0\u5305<\/strong><\/p>\n

\u66f4\u65b0\u67d0\u4e00\u8f6f\u4ef6\u5305\uff1a # zypper update \u66f4\u65b0\u6240\u6709\u8f6f\u4ef6\u5305\uff1a # zypper update
\n\u67e5\u770b\u6240\u6709\u53ef\u7528\u7684\u66f4\u65b0\u5217\u8868\uff1a# zypper list-updates<\/p>\n

4. \u5220\u9664\u5305<\/strong><\/p>\n

\u8bed\u6cd5\uff1a# zypper remove \u793a\u4f8b\uff1a\u79fb\u9664Mozilla Firefox<\/p>\n

[root@linuxprobe ~]# zypper remove MozillaFirefox\r\nLoading repository data...\r\nReading installed packages...\r\nResolving package dependencies...\r\nThe following packages are going to be REMOVED:\r\n  MozillaFirefox MozillaFirefox-branding-SLED\r\n2 packages to remove.\r\nAfter the operation, 3.4 MiB will be freed.\r\nContinue? [y\/n\/?] (y): y\r\nRemoving MozillaFirefox-branding-SLED-3.5-1.1.5 [done]\r\nRemoving MozillaFirefox-3.6.16-0.2.1 [done]\r\n<\/pre>\n

5. \u67e5\u627e\u5305<\/strong><\/p>\n

\u8bed\u6cd5\uff1a# zypper search \u793a\u4f8b\uff1a\u67e5\u627e\u6240\u6709usb\u5f00\u5934\u7684\u8f6f\u4ef6\u5305<\/p>\n

[root@linuxprobe ~]# zypper search usb*\r\nLoading repository data...\r\nReading installed packages...\r\n\r\nS | Name                | Summary                                                        | Type\r\n--+---------------------+----------------------------------------------------------------+--------\r\n  | usb_modeswitch      | A mode switching tool for controlling multiple-device USB gear | package\r\n  | usb_modeswitch-data | A mode switching tool for controlling multiple-device USB gear | package\r\n  | usbip-devel         | Headers and static libraries                                   | package\r\ni | usbutils            | Tools and libraries for USB devices                            | package\r\n<\/pre>\n

6. \u67e5\u770b\u8f6f\u4ef6\u5305\u8be6\u60c5<\/strong><\/p>\n

\u8bed\u6cd5\uff1a zypper info \u793a\u4f8b\uff1a\u67e5\u770busbutils\u7684\u4fe1\u606f<\/p>\n

[root@linuxprobe ~]# zypper info usbutils\r\nLoading repository data...\r\nReading installed packages...\r\nInformation for package usbutils:\r\nRepository: LINUXPROBE\r\nName: usbutils\r\nVersion: 0.73-38.19\r\nArch: x86_64\r\nVendor: SUSE LINUX Products GmbH, Nuernberg, Germany\r\nSupport Level: unknown\r\nInstalled: Yes\r\nStatus: up-to-date\r\nInstalled Size: 461.0 KiB\r\nSummary: Tools and libraries for USB devices\r\nDescription:\r\nThis package contains a utility for inspecting devices connected to USB\r\nports.\r\nIt requires kernel version 2.3.99-pre7 or newer, or the USB backport\r\nwhich was introduced in 2.2.18 (supporting the \/proc\/bus\/usb\r\ninterface).\r\n<\/pre>\n

7. \u6253\u8865\u4e01<\/strong><\/p>\n

\u67e5\u770b\u6240\u6709\u53ef\u6253\u8865\u4e01: zypper patches
\n\u5b89\u88c5\u6307\u5b9a\u8865\u4e01\uff1azypper patch<\/p>\n

8. \u9501\u4f4f\u5305<\/strong><\/p>\n

\u8f6f\u4ef6\u5305\u88ab\u9501\u4e4b\u540e\u5c06\u4e0d\u80fd\u88ab\u79fb\u9664\u6216\u5347\u7ea7\uff0c\u4e0b\u9762\u6f14\u793a\u4e00\u4e0b\u5982\u4f55\u52a0\u9501
\n1\uff09\u52a0al\u9009\u9879\u9501\u4f4f\u5305\u6587\u4ef6\u201cusbutils\u201d, al \u662f add lock\u7684\u7f29\u5199<\/p>\n

[root@linuxprobe ~] # zypper al usbutils\r\nSpecified lock has been successfully added.\r\n<\/pre>\n

2) \u52a0ll\u9009\u9879\u67e5\u770b\u6240\u6709\u5df2\u88ab\u9501\u4f4f\u7684\u8f6f\u4ef6\u5305, ll \u662f List Locks\u7684\u7f29\u5199<\/p>\n

[root@linuxprobe ~] # zypper ll\r\n# | Name            | Type    | Repository\r\n--+-----------------+---------+-----------\r\n1 | usbutils        | package | (any)\r\n<\/pre>\n

9. \u89e3\u9501\u5305<\/strong><\/p>\n

\u52a0rl\u9009\u9879\u89e3\u9501usbutils, rl \u662f remove lock\u7684\u7f29\u5199<\/p>\n

[root@linuxprobe ~] #  zypper rl usbutils\r\n1 lock has been successfully removed.\r\n[root@linuxprobe ~]# zypper ll\r\nThere are no package locks defined.\r\n<\/pre>\n
II. \u7528zypper\u7ba1\u7406\u4ed3\u5e93<\/strong><\/div>\n

10. \u7528zypper\u6dfb\u52a0\u5e93<\/strong><\/p>\n

\u8bed\u6cd5\uff1a# zypper addrepo<\/p>\n

[root@linuxprobe ~] # zypper addrepo --check --refresh --name \"Mozilla-repo\" http:\/\/download.opensuse.org\/repositories\/mozilla\/SLE_11\/ \"Mozillarepo\"\r\nAdding repository 'Mozilla-repo' [done]\r\nRepository 'Mozilla-repo' successfully added\r\nEnabled: Yes\r\nAutorefresh: Yes\r\nURI: http:\/\/download.opensuse.org\/repositories\/mozilla\/SLE_11\/\r\n<\/pre>\n

11. \u521b\u5efa\u672c\u5730\u5e93<\/strong><\/p>\n

\u6211\u4eec\u53ef\u4ee5\u4f7f\u7528zypper\u4ece\u672c\u5730\u76ee\u5f55\u4e2d\u521b\u5efa\u4e00\u4e2a\u5305\u542b\u6240\u6709rpm\u6587\u4ef6\u7684\u672c\u5730\u5e93
\n\u8bed\u6cd5\uff1a # zypper addrepo<\/p>\n

\u793a\u4f8b\uff1a\u521b\u5efa\u4e00\u4e2a\u540d\u4e3aLinuxprobe_Repo\u7684\u672c\u5730\u76ee\u5f55\uff0c\u5305\u542b\u6240\u6709rpm\u6587\u4ef6<\/p>\n

[root@linuxprobe ~] # zypper addrepo \/var\/stormgt\/dsminst Linuxprobe_Repo\r\nAdding repository 'Linuxprobe_Repo' [done]\r\nRepository 'Linuxprobe_Repo' successfully added\r\nEnabled: Yes\r\nAutorefresh: No\r\nURI: dir:\/\/\/var\/stormgt\/dsminst\r\n[root@linuxprobe ~] # zypper search --repo Linuxprobe_Repo\r\nLoading repository data...\r\nReading installed packages...\r\nS | Name        | Summary                                 | Type\r\n--+-------------+-----------------------------------------+--------\r\ni | TIVsm-API   | the API                                 | package\r\ni | TIVsm-API64 | the API                                 | package\r\ni | TIVsm-BA    | the Backup Archive Client               | package\r\ni | gskcrypt32  | IBM GSKit Cryptography Runtime          | package\r\ni | gskcrypt64  | IBM GSKit Cryptography Runtime          | package\r\ni | gskssl32    | IBM GSKit SSL Runtime With Acme Toolkit | package\r\ni | gskssl64    | IBM GSKit SSL Runtime With Acme Toolkit | package\r\n<\/pre>\n

\u6ce8\uff1a\u4f60\u4e5f\u53ef\u4ee5\u901a\u8fc7\u6b64\u547d\u4ee4\u6dfb\u52a0NFS\u6216FTP\u8def\u5f84<\/p>\n

12. \u67e5\u770b\u5e93<\/strong><\/p>\n

[root@linuxprobe ~] # zypper lr\r\n# | Alias                                            | Name                                             | Enabled | Refresh\r\n--+--------------------------------------------------+--------------------------------------------------+---------+--------\r\n1 | Mozillarepo                                      | Mozilla-repo                                     | Yes     | Yes\r\n2 | SUSE-Linux-Enterprise-Server-11-SP1 11.1.1-1.152 | SUSE-Linux-Enterprise-Server-11-SP1 11.1.1-1.152 | Yes     | Yes\r\n<\/pre>\n

\u67e5\u770brepo\u5b8c\u6574\u7684URI\uff1a<\/p>\n

[root@linuxprobe ~] # zypper lr --uri\r\n# | Alias                                            | Name                                             | Enabled | Refresh | URI\r\n--+--------------------------------------------------+--------------------------------------------------+---------+---------+----------------------------------------------------------\r\n1 | Mozillarepo                                      | Mozilla-repo                                     | Yes     | Yes     | http:\/\/download.opensuse.org\/repositories\/mozilla\/SLE_11\/\r\n2 | 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\r\n<\/pre>\n

13. \u5728\u5e93\u4e2d\u641c\u7d22\u5305<\/strong>
\n\u5217\u51fa\u6307\u5b9a\u5e93Mozillarepo\u7684\u6240\u6709\u8f6f\u4ef6\u5305<\/p>\n

[root@linuxprobe ~] # zypper search --repo Mozillarepo\r\nLoading repository data...\r\nReading installed packages...\r\n\r\nS | Name                                 | Summary                                                                 | Type\r\n--+--------------------------------------+-------------------------------------------------------------------------+-----------\r\ni | MozillaFirefox                       | Mozilla Firefox Web Browser                                             | package\r\ni | MozillaFirefox-branding-SLED         | SLED branding of MozillaFirefox                                         | package  \r\n  | MozillaFirefox-branding-openSUSE     | openSUSE branding of MozillaFirefox                                     | package\r\n  | MozillaFirefox-branding-openSUSE     | openSUSE branding of MozillaFirefox                                     | srcpackage\r\n<\/pre>\n

14. \u5e93\u91cd\u547d\u540d<\/strong><\/p>\n

\u91cd\u547d\u540d\u5e93\u53ef\u4ee5\u7528 renamerepo \u9009\u9879
\n\u793a\u4f8b\uff1a\u5c06\u5e93\"Linuxprobe_Repo\"\u7684\u540d\u5b57\u6539\u6210\"MyLinuxRepo\"<\/p>\n

[root@linuxprobe ~] # zypper renamerepo Linuxprobe_Repo MyLinuxRepo\r\nRepository 'Linuxprobe_Repo' renamed to 'MyLinuxRepo'.\r\n<\/pre>\n

15. \u5220\u9664\u5e93<\/strong><\/p>\n

\u7528removerepo\u9009\u9879\u6765\u79fb\u9664\u5e93<\/p>\n

[root@linuxprobe ~] # zypper removerepo MyLinuxRepo\r\nRemoving repository 'MyLinuxRepo' [done]\r\nRepository 'MyLinuxRepo has been removed.\r\n<\/pre>\n

16. \u5907\u4efd\u5e93<\/strong><\/p>\n

\u7528export\u9009\u9879\u53ef\u4ee5\u5907\u4efd\u4e00\u7cfb\u5217\u5e93\u6587\u4ef6<\/p>\n

[root@linuxprobe ~] # zypper lr --export \/var\/tmp\/backup.repo\r\nRepositories have been successfully exported to \/var\/tmp\/backup.repo.\r\n<\/pre>\n

17. \u4ece\u5907\u4efd\u6587\u4ef6\u4e2d\u6dfb\u52a0\u5e93<\/strong><\/p>\n

[root@linuxprobe ~] # zypper addrepo \/var\/tmp\/backup.rep\r\n<\/pre>\n

18. \u7981\u7528\/\u4f7f\u7528\u5e93<\/strong><\/p>\n

\u793a\u4f8b\uff1a \u7528 modifyrepo \u9009\u9879\u7684 -d \u53c2\u6570\u6765\u7981\u7528Mozilla\u5e93<\/p>\n

[root@linuxprobe ~] # zypper modifyrepo -d Mozillarepo\r\nRepository 'Mozillarepo' has been successfully disabled.\r\n<\/pre>\n

\u793a\u4f8b\uff1a \u7528 modifyrepo\u9009\u9879 -e \u53c2\u6570\u6765\u5141\u8bb8\u4f7f\u7528Mozilla\u5e93<\/p>\n

[root@linuxprobe ~] # zypper modifyrepo -e Mozillarepo\r\nRepository 'Mozillarepo' has been successfully enabled.\r\n<\/pre>\n

19. \u5237\u65b0\u5e93<\/strong><\/p>\n

\u793a\u4f8b\uff1a \u5237\u65b0Mozilla\u5e93<\/p>\n

[root@linuxprobe ~] # zypper refresh Mozillarepo\r\nRepository 'Mozilla-repo' is up to date.\r\nSpecified repositories have been refreshed.\r\n<\/pre>\n

\u793a\u4f8b\uff1a \u81ea\u52a8\u5237\u65b0\u6307\u5b9a\u5e93<\/p>\n

[root@linuxprobe ~] # zypper modifyrepo --refresh Linuxprobe_Repo\r\nAutorefresh has been enabled for repository 'Linuxprobe_Repo'.\r\n<\/pre>\n
\n

\u672c\u6587\u5730\u5740\uff1ahttp:\/\/gulass.cn\/zypper-commands-examples.html<\/a>\u7f16\u8f91\uff1a\u70e8\u5b50\uff0c\u5ba1\u6838\u5458\uff1a\u5218\u9044<\/span><\/p>\n<\/blockquote>\n","protected":false},"excerpt":{"rendered":"

\u5bfc\u8bfb Zypper\u662fOpenSUSE\u548c\u4f01\u4e1a\u7248SUSE\u4e2d\u8f6f\u4ef6\u5305\u7ba1\u7406\u5668ZYpp\u7684\u547d\u4ee4\u884c\u63a5\u53e3\u3002 \u4e3b\u8981\u7528\u4e8e\uff1a1.\u7ba1\u7406\u8f6f […]<\/p>\n","protected":false},"author":317,"featured_media":5765,"comment_status":"open","ping_status":"open","sticky":false,"template":"","format":"standard","meta":{"_acf_changed":false,"footnotes":""},"categories":[55],"tags":[],"class_list":["post-5755","post","type-post","status-publish","format-standard","has-post-thumbnail","hentry","category-thread"],"acf":[],"_links":{"self":[{"href":"https:\/\/gulass.cn\/wp-json\/wp\/v2\/posts\/5755","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/gulass.cn\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/gulass.cn\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/gulass.cn\/wp-json\/wp\/v2\/users\/317"}],"replies":[{"embeddable":true,"href":"https:\/\/gulass.cn\/wp-json\/wp\/v2\/comments?post=5755"}],"version-history":[{"count":12,"href":"https:\/\/gulass.cn\/wp-json\/wp\/v2\/posts\/5755\/revisions"}],"predecessor-version":[{"id":244854,"href":"https:\/\/gulass.cn\/wp-json\/wp\/v2\/posts\/5755\/revisions\/244854"}],"wp:featuredmedia":[{"embeddable":true,"href":"https:\/\/gulass.cn\/wp-json\/wp\/v2\/media\/5765"}],"wp:attachment":[{"href":"https:\/\/gulass.cn\/wp-json\/wp\/v2\/media?parent=5755"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/gulass.cn\/wp-json\/wp\/v2\/categories?post=5755"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/gulass.cn\/wp-json\/wp\/v2\/tags?post=5755"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}