In addition to Weibo, there is also WeChat
Please pay attention
WeChat public account
Shulou
2025-01-19 Update From: SLTechnology News&Howtos shulou NAV: SLTechnology News&Howtos > Development >
Share
Shulou(Shulou.com)06/01 Report--
This article will explain in detail how to use the zypper command in Linux. The editor thinks it is very practical, so I share it for you as a reference. I hope you can get something after reading this article.
Zypper is an easy-to-use command line package manager that uses a package management library called libzypp. Zypper can manipulate software installation sources (such as Build Service or standard openSUSE installation sources), search for packages, install, remove, or update packages, and so on. It can be used as stand-alone software, in scripts, or by other software.
Examples of zypper command usage
i. Managing software packages with zypper
1. Installation package
Syntax: # zypper install example: install Mozilla firefox
[root@linuxprobe] # zypper install MozillaFirefoxLoading repository data...Reading installed packages...Resolving package dependencies...The following NEW packages are going to be installed: MozillaFirefox MozillaFirefox-branding-SLEDThe following packages are not supported by their vendor: MozillaFirefox MozillaFirefox-branding-SLED2 new packages to install.Overall download size: 964.0 KiB. After the operation, additional 3.4 MiB will be used.Continue? [y/n/?] (y): yRetrieving package MozillaFirefox-3.6.16-0.2.1.x86_64 (1ap2), 949.0 KiB (3.4MiB 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 (2max 2) 15.0 KiB (34.0KiB unpacked) Retrieving: MozillaFirefox-branding-SLED-3.5-1.1.5.x86_64.rpm [done] Installing: MozillaFirefox-branding-SLED-3.5-1.1.5 [done]
two。 Install the source package
Syntax: # zypper source-install example: install apache from a library
[root@linuxprobe] # zypper source-install apache2-mod_nssReading installed packages...Loading repository data...Resolving package dependencies...Retrieving package mozilla-nss-devel-3.12.8-1.2.1.x86_64 (2Accord 3) 473.0 KiB (2.6MiB 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]
3. Update package
Update a package: # zypper update update all packages: # zypper update
View a list of all available updates: # zypper list-updates
4. Delete package
Syntax: # zypper remove example: remove Mozilla Firefox
[root@linuxprobe ~] # zypper remove MozillaFirefoxLoading repository data...Reading installed packages...Resolving package dependencies...The following packages are going to be REMOVED: MozillaFirefox MozillaFirefox-branding-SLED2 packages to remove.After the operation, 3.4 MiB will be freed.Continue? [y/n/?] (y): yRemoving MozillaFirefox-branding-SLED-3.5-1.1.5 [done] Removing MozillaFirefox-3.6.16-0.2.1 [done]
5. Look up the package
Syntax: # zypper search example: find all packages at the beginning of usb
[root@linuxprobe ~] # 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 | packagei | usbutils | | Tools and libraries for USB devices | package |
6. View package details
Syntax: zypper info example: view usbutils information
[root@linuxprobe] # zypper info usbutilsLoading repository data...Reading installed packages...Information for package usbutils:Repository: LINUXPROBEName: usbutilsVersion: 0.73-38.19Arch: x86_64Vendor: SUSE LINUX Products GmbH, Nuernberg, GermanySupport Level: unknownInstalled: YesStatus: up-to-dateInstalled Size: 461.0 KiBSummary: Tools and libraries for USB devicesDescription:This package contains a utility for inspecting devices connected to USBports.It requires kernel version 2.3.99-pre7 or newer, or the USB backportwhich was introduced in 2.2.18 (supporting the / proc/bus/usbinterface).
7. Make a patch
Check out all available patches: zypper patches
Install the specified patch: zypper patch
8. Lock the bag
Once the package is locked, it cannot be removed or upgraded. Here's how to lock it.
1) add the al option to lock the package file "usbutils". Al is the abbreviation of add lock.
[root@linuxprobe] # zypper al usbutilsSpecified lock has been successfully added.
\ 2) add the ll option to view all locked software packages. Ll is the abbreviation of List Locks.
[root@linuxprobe ~] # zypper ll# | Name | Type | Repository--+-1 | usbutils | package | (any)
9. Unlock the bag
Unlock usbutils with rl option. Rl is the abbreviation of remove lock.
[root@linuxprobe] # zypper rl usbutils1 lock has been successfully removed. [root@linuxprobe ~] # zypper llThere are no package locks defined.
ii. Managing Warehouse with zypper
10. Add libraries with zypper
Syntax: # zypper addrepo
[root@linuxprobe] # 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 addedEnabled: YesAutorefresh: YesURI: http://download.opensuse.org/repositories/mozilla/SLE_11/
11. Create a local library
We can use zypper to create a local library that contains all the rpm files from the local directory
Syntax: # zypper addrepo
Example: create a local directory called Linuxprobe_Repo that contains all rpm files
[root@linuxprobe ~] # zypper addrepo / var/stormgt/dsminst Linuxprobe_RepoAdding repository 'Linuxprobe_Repo' [done] Repository' Linuxprobe_Repo' successfully addedEnabled: YesAutorefresh: NoURI: dir:///var/stormgt/dsminst [root@linuxprobe ~] # zypper search-- repo Linuxprobe_RepoLoading repository data...Reading installed packages...S | Name | Summary | Type--+- -+-+-I | TIVsm-API | the API | packagei | TIVsm-API64 | the API | packagei | TIVsm-BA | the Backup Archive Client | | packagei | gskcrypt32 | IBM GSKit Cryptography Runtime | packagei | gskcrypt64 | IBM GSKit Cryptography Runtime | packagei | gskssl32 | IBM GSKit SSL Runtime With Acme Toolkit | packagei | gskssl64 | IBM GSKit SSL Runtime With Acme Toolkit | package |
Note: you can also add NFS or FTP paths through this command
twelve。 View the library
[root@linuxprobe ~] # zypper lr# | Alias | Name | Enabled | Refresh--+---+ -+-1 | Mozillarepo | Mozilla-repo | Yes | Yes2 | SUSE-Linux-Enterprise -Server-11-SP1 11.1.1-1.152 | SUSE-Linux-Enterprise-Server-11-SP1 11.1.1-1.152 | Yes | Yes
View the complete URI of repo:
[root@linuxprobe ~] # 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
13. Search for packages in the library
Lists all packages for the specified library Mozillarepo
[root@linuxprobe ~] # zypper search-- repo MozillarepoLoading repository data...Reading installed packages...S | Name | Summary | Type--+-- -+-+-I | MozillaFirefox | MozillaFirefox Web Browser | | packagei | MozillaFirefox-branding-SLED | SLED branding of MozillaFirefox | package | MozillaFirefox-branding-openSUSE | openSUSE branding of MozillaFirefox | package | MozillaFirefox-branding-openSUSE | openSUSE branding of MozillaFirefox | srcpackage |
14. Library renaming
Rename the library with the renamerepo option
Example: change the name of the library Linuxprobe_Repo to MyLinuxRepo
[root@linuxprobe ~] # zypper renamerepo Linuxprobe_Repo MyLinuxRepoRepository 'Linuxprobe_Repo' renamed to' MyLinuxRepo'.
15. Delete Library
Use the removerepo option to remove the library
[root@linuxprobe] # zypper removerepo MyLinuxRepoRemoving repository 'MyLinuxRepo' [done] Repository' MyLinuxRepo has been removed.
16. Reserve storehouse
You can back up a series of library files with the export option
[root@linuxprobe] # zypper lr-- export / var/tmp/backup.repoRepositories have been successfully exported to / var/tmp/backup.repo.
17. Add a library from a backup file
[root@linuxprobe ~] # zypper addrepo / var/tmp/backup.rep
18. Disable / use libraries
Example: disable the Mozilla library with the-d argument of the modifyrepo option
[root@linuxprobe] # zypper modifyrepo-d MozillarepoRepository 'Mozillarepo' has been successfully disabled.
Example: use the modifyrepo option-e parameter to allow the use of Mozilla libraries
[root@linuxprobe] # zypper modifyrepo-e MozillarepoRepository 'Mozillarepo' has been successfully enabled.
19. Refresh the library
Example: refresh the Mozilla library
[root@linuxprobe] # zypper refresh MozillarepoRepository 'Mozilla-repo' is up to date.Specified repositories have been refreshed.
Example: automatically refresh the specified library
[root@linuxprobe ~] # zypper modifyrepo-- refresh Linuxprobe_RepoAutorefresh has been enabled for repository 'Linuxprobe_Repo'.
This is the end of this article on "how to use zypper commands in Linux". I hope the above content can be of some help to you, so that you can learn more knowledge. if you think the article is good, please 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.
Continue with the installation of the previous hadoop.First, install zookooper1. Decompress zookoope
"Every 5-10 years, there's a rare product, a really special, very unusual product that's the most un
© 2024 shulou.com SLNews company. All rights reserved.