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 > Servers >
Share
Shulou(Shulou.com)06/01 Report--
This article mainly introduces the practical zypper commands in linux, which are very detailed and have certain reference value. Friends who are interested must finish reading them.
Suse Linux uses zypper for package management, which is a package management system provided by the ZYpp package management engine.
The zypper command with no arguments lists all the available options, which is much easier to use than referring to the detailed man manual.
Root@kerneltalks # zypper usage: zypper [--global-options] [--command-options] [arguments] zypper [--command-options] [arguments] Global options:-- help,-h help-- version,-V output version number-- promptids output zypper user prompt list-- config -c uses the specified configuration file to replace the default-- user-defined transaction id-- quiet, used by userdata in history and plug-ins,-Q ignores normal output Only print error message-verbose,-v increase verbosity-color-whether no-color enables color mode If tty supports-- no-abbrev,-A table text does not use the abbreviation-- table-style,-s table style (integer)-- non-interactive,-n does not ask any options, automatically use the default answer-- non-interactive-include-reboot-patches for patches with the restart flag Do not use interactive mode-- xmlout,-x switch to XML output-- ignore-unknown,-I ignore unknown packages-- reposd-dir,-D use custom repository file directory-- cache-dir -C enables optional paths for all caches-- raw-cache-dir enables optional raw metadata cache paths-- solv-cache-dir enables optional solv file cache paths-- pkg-cache-dir enables optional package cache path repository options:-- no-gpg-checks ignores GPG check failures and skips -- gpg-auto-import-keys automatically trusts and imports the signing key of the new repository-- plus-repo -p use additional repositories-plus-content also uses disabled repositories to provide specific keywords try to use the'--plus-content debug' option to enable repositories-disable-repositories does not read metadata from repositories-no-refresh does not refresh repositories -- no-cd ignores repositories in CD/DVD-- no-remote ignores remote repositories-- releasever sets the $releasever variable (default: distribution) in all .repo files Target Options:-- root -R operates under another root path-disable-system-resolvables does not read the installed package command: help,? Printing help shell, sh allows many commands for warehouse management: repos, lr lists all custom warehouse addrepo, ar adds a new warehouse removerepo, rr removes the specified warehouse renamerepo, nr renames the specified warehouse modifyrepo Mr modifies specified repository refresh, ref refreshes all repositories clean clears local cache service management: services, ls lists all custom services addservice, as adds a new service modifyservice, ms modifies specified service removeservice Rs removes the specified service refresh-services, refs refreshes all service software management: install, in installation package remove, rm removal package verify, ve confirmation package dependency integrity source-install, si installation source package and its build dependency install-new-recommends Inr installation is managed by new package updates that are recommended to be installed with the installed package: update, up update installed package to newer version list-updates, lu lists available updates patch installation necessary patch list-patches Lp lists necessary patches dist-upgrade, dup updates patch-check for distribution, pchk checks patches query: search, se finds packages that match the pattern info If displays complete information of a specific package patch-info shows complete information of a specific patch pattern-info shows complete information of a specific mode product-info shows complete information of a particular product patches, pch lists all available patch packages Pa lists all available packages patterns, pt lists all available mode products, pd lists all available product what-provides, wp lists package locks that provide specific functions: addlock, al adds a package lock removelock Rl removes a package lock locks, ll lists the current package lock cleanlocks, cl removes useless lock other commands: versioncmp, vcmp compare two versions of the string targetos Tos prints target operating system ID string licenses prints certificates and EULAs reports of installed packages download downloads the specified rpm package to the local directory using the command line source-download downloads the source code rpm package of all installed packages to the local directory subcommand: subcommand List the available subcommands to enter 'zypper help' to get help for specific commands. How to use zypper to install packages
Zypper installs packages on your system through the in or install subcommand. It is used the same as the yum package installation. You only need to provide the package name as a parameter, and the package manager (in this case, zypper) will handle all dependencies and install it with the package you specify.
# zypper install telnetRefreshing service 'SMT-http_smt-ec2_susecloud_net'.Refreshing service' cloud_update'.Loading repository data...Reading installed packages...Resolving package dependencies... The following NEW package is going to be installed: telnet 1 new package to install.Overall download size: 51.8 KiB. Already cached: 0 B. After the operation, additional 113.3 KiB will be used.Continue? [y/n/...? Shows all options] (y): yRetrieving package telnet-1.2-165.63.x86_64 (1Compact 1) 51.8 KiB (113.3 KiB unpacked) Retrieving: telnet-1.2-165.63.x86_64.rpm. .. [done] Checking for file conflicts:.... ... [done] (1amp 1) Installing: telnet-1.2-165.63.x86_64. .... [done]
The above is the output when we installed the telnet package for your reference.
Recommended reading: install packages on YUM and APT systems
How to use zypper to remove a package
To erase or remove a package in Suse Linux, use the remove or rm subcommand that comes with zypper.
Root@kerneltalks # zypper rm telnetLoading repository data...Reading installed packages...Resolving package dependencies... The following package is going to be REMOVED: telnet 1 package to remove.After the operation, 113.3 KiB will be freed.Continue? [y/n/...? Shows all options] (y): y (1Acer 1) Removing telnet-1.2-165.63.x86_64. .. [done]
We remove the previously installed telnet package here.
Use zypper to check dependencies or authenticate the integrity of installed packages
Sometimes you can install a package by forcing you to ignore dependencies. Zypper enables you to scan all installed packages and check for dependencies. If any dependencies are missing, it will give you the opportunity to install or reinstall it, thus maintaining the integrity of the installed package.
Use the zypper command with the verify or ve subcommand to check the integrity of the installed package.
Root@kerneltalks # zypper veRefreshing service 'SMT-http_smt-ec2_susecloud_net'.Refreshing service' cloud_update'.Loading repository data...Reading installed packages... Dependencies of all installed packages are satisfied.
In the above output, you can see the * line indicating that all dependencies of the installed package are fully installed and no more action is required.
How to use zypper to download packages in Suse Linux
Zypper provides a way to download the package to a local directory without installing it. You can use this downloaded package on other systems with the same configuration. The package is downloaded to the / var/cache/zypp/packages/// directory.
Root@kerneltalks # zypper download telnetRefreshing service 'SMT-http_smt-ec2_susecloud_net'.Refreshing service' cloud_update'.Loading repository data...Reading installed packages...Retrieving package telnet-1.2-165.63.x86_64 (1Compact 1) 51.8 KiB (113.3 KiB unpacked) (1 KiB unpacked) / var/cache/zypp/packages/SMT-http_smt-ec2_susecloud_net:SLES12-SP3-Pool/x86_64/telnet-1.2-165.63.x86_64.rpm. [done] download: Done. # ls-lrt / var/cache/zypp/packages/SMT-http_smt-ec2_susecloud_net:SLES12-SP3-Pool/x86_64/total 52murr RWMurray-1 root root 53025 Feb 21 03:17 telnet-1.2-165.63.x86_64.rpm
You can see that we downloaded the telnet package locally using zypper.
Recommended reading: download packages but not install them on YUM and APT systems
How to use zypper to list available package updates
Zypper allows you to browse all available updates for installed packages so that you can plan update activities in advance. Use the list-updates or lu subcommand to display all available updates for the installed package.
Root@kerneltalks # zypper luRefreshing service 'SMT-http_smt-ec2_susecloud_net'.Refreshing service' cloud_update'.Loading repository data...Reading installed packages...S | Repository | Name | Current Version | Available Version | Arch-- |-- -|-v | SLES12-SP3 -Updates | at-spi2-core | 2.20.2-14.3.1 | x86room64v | SLES12-SP3-Updates | bash | 4.3-82.1 | 4.3-83.5. 2 | x86room64v | SLES12-SP3-Updates | ca-certificates-mozilla | 2.711.1 | 2.2212.3.1 | noarchv | SLE-Module-Containers12-Updates | containerd | 0.2.5+gitr639_422e31c-20.2 | 0.2.9+gitr706_06b9cb351610-16 .8.1 | x86room64v | SLES12-SP3-Updates | crash | 7.1.8-4.3.1 | 7.1.8-4.6.2 | x86room64v | SLES12-SP3-Updates | rsync | 3.1.0-12.1 | | 3.1.0-13.10.1 | x86room64 |
The output is deliberately formatted for easy reading. Each column represents the name of the warehouse to which the package belongs, the package name, the installed version, the available updated version, and the schema.
List and install patches in Suse Linux
Use the list-patches or lp subcommand to display all available patches that your Suse Linux system needs to be applied.
Root@kerneltalks # zypper lpRefreshing service 'SMT-http_smt-ec2_susecloud_net'.Refreshing service' cloud_update'.Loading repository data...Reading installed packages... Repository | Name | Category | Severity | Interactive | Status | Summary-- | -|- -- SLE-Module-Containers12-Updates | SUSE-SLE-Module-Containers-12-2018-273 | security | important |-- | needed | Version update for docker Docker-runc, containerd Golang-github-docker-libnetworkSLE-Module-Containers12-Updates | SUSE-SLE-Module-Containers-12-2018-62 | recommended | low |-- | needed | Recommended update for sle2docker SLE-Module-Public-Cloud12-Updates | SUSE-SLE-Module-Public-Cloud-12-2018-268 | recommended | low |-- | needed | Recommended update for python-ecdsa SLES12-SP3-Updates | SUSE- SLE-SERVER-12-SP3-2018-116 | security | moderate |-- | needed | Security update for rsync-output clipped-SLES12-SP3-Updates | SUSE-SLE-SERVER-12-SP3-2018-89 | security | moderate |-- | needed | Security update for perl-XML-LibXML SLES12-SP3-Updates | | SUSE-SLE-SERVER-12-SP3-2018-90 | recommended | low |-- | needed | Recommended update for lvm2 Found 37 applicable patches:37 patches needed (18 security patches) |
The output can be well organized using the appropriate header. You can easily find out and plan your patch updates according to the situation. We can see that 18 of the 37 available patches in our system are security patches that need to be applied with high priority!
You can install all the required patches by issuing the zypper patch command.
How to update a package using zypper
To update a package using zypper, use the update or up subcommand followed by the package name. In the update commands listed above, we know that rsync package updates are available on our server. Let's update it now!
Root@kerneltalks # zypper update rsyncRefreshing service 'SMT-http_smt-ec2_susecloud_net'.Refreshing service' cloud_update'.Loading repository data...Reading installed packages...Resolving package dependencies... The following package is going to be upgraded: rsync 1 package to upgrade.Overall download size: 325.2 KiB. Already cached: 0 B. After the operation, additional 64.0 B will be used.Continue? [y/n/...? Shows all options] (y): yRetrieving package rsync-3.1.0-13.10.1.x86_64 (1Compact 1) 325.2 KiB (625.5 KiB unpacked) Retrieving: rsync-3.1.0-13.10.1.x86_64.rpm. .. [done] Checking for file conflicts:.... ... [done] (1amp 1) Installing: rsync-3.1.0-13.10.1.x86_64.. .. [done] use zypper to find packages on Suse Linux
Don't worry if you're not sure about the full name of the bag. You can use the se or search subcommands that come with zypper and provide a lookup string to find the package.
Root@kerneltalks # zypper se lvmRefreshing service 'SMT-http_smt-ec2_susecloud_net'.Refreshing service' cloud_update'.Loading repository data...Reading installed packages... S | Name | Summary | Type--- | libLLVM | Libraries for LLVM | package | libLLVM-32bit | Libraries for LLVM | package | llvm | | Low Level Virtual Machine | package | llvm-devel | Header Files for LLVM | package | lvm2 | Logical Volume Manager Tools | srcpackagei+ | lvm2 | Logical Volume Manager Tools | package | lvm2-devel | Development files for LVM2 | package |
In the above example, we looked up the lvm string and got the output list as above. You can use the name of the Name field in the zypper install/remove/update command.
Use zypper to check installed package information
You can use zypper to check the details of the installed package. The info or if subcommand lists information about installed packages. It can also display the details of the uninstalled package, in which case the Installed parameter returns the No value.
Root@kerneltalks # zypper info rsyncRefreshing service 'SMT-http_smt-ec2_susecloud_net'.Refreshing service' cloud_update'.Loading repository data...Reading installed packages... Information for package rsync:--Repository: SLES12-SP3-UpdatesName: rsyncVersion: 3.1.0-13.10.1Arch: x86_64Vendor: SUSE LLC Support Level: Level 3Installed Size: 625.5 KiBInstalled: YesStatus: up-to-dateSource package: rsync-3.1.0- 13.10.1.srcSummary: Versatile tool for fast incremental file transferDescription: Rsync is a fast and extraordinarily versatile file copying tool. It can copy locally, to/from another host over any remote shell, or to/from a remote rsync daemon. It offers a large number of options that control every aspect of its behavior and permit very flexible specification of the set of files to be copied. It is famous for its delta-transfer algorithm, which reduces the amount of data sent over the network by sending only the differences between the source files and the existing files in the destination. Rsync is widely used for backups and mirroring and as an improved copy command for everyday use. Use zypper to list warehouses
Use the zypper command to list the warehouse with the lr or repos subcommand.
Root@kerneltalks # zypper lrRefreshing service 'cloud_update'.Repository priorities are without effect. All enabled repositories share the same priority. # | Alias | Name | Enabled | GPG Check | Refresh--- |-- -|- -|-1 | SMT-http_smt-ec2_susecloud_net:SLE-Module-Adv-Systems-Management12-Debuginfo-Pool | SLE-Module-Adv-Systems-Management12-Debuginfo-Pool | No |-|-- 2 | SMT-http_smt-ec2_susecloud_net:SLE-Module-Adv-Systems-Management12-Debuginfo-Updates | SLE-Module-Adv-Systems-Management12-Debuginfo-Updates | No |- -- |-|-3 | SMT-http_smt-ec2_susecloud_net:SLE-Module-Adv-Systems-Management12-Pool | SLE-Module-Adv-Systems-Management12-Pool | Yes | (r) Yes | No 4 | SMT-http_smt-ec2_susecloud_net:SLE-Module-Adv-Systems-Management12-Updates | SLE-Module-Adv-Systems-Management12-Updates | Yes | | (r) Yes | Yes 5 | SMT-http_smt-ec2_susecloud_net:SLE-Module-Containers12-Debuginfo-Pool | SLE-Module-Containers12-Debuginfo-Pool | No |-- |-6 | SMT-http_smt-ec2_susecloud_net:SLE-Module-Containers12-Debuginfo-Updates | SLE-Module-Containers12-Debuginfo-Updates | No | | |-|-|
Here you need to check the enabled column to determine which warehouses are enabled and which are not.
Use zypper to add or remove repositories in Suse Linux
To add a repository you need the URI of the repository or .repo file, otherwise you will encounter the following error.
Root@kerneltalks # zypper addrepo-c SLES12-SP3-UpdatesIf only one argument is used, it must be a URI pointing to a. Repo file.
Using URI, you can add repositories as follows:
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-PoolAdding repository 'SLE-SDK12-SP3-Pool'... .... [done] Repository 'SLE-SDK12-SP3-Pool' successfully added URI: http://smt-ec2.susecloud.net/repo/SUSE/Products/SLE-SDK/12-SP3/x86 _ 64/product?credentials=SMT-http_smt-ec2_susecloud_netEnabled: YesGPG Check: YesAutorefresh: NoPriority: 99 (default priority) Repository priorities are without effect. All enabled repositories share the same priority.
In Suse, use the zypper command with the addrepo or ar subcommand to add the repository, followed by URI and you need to provide an alias.
To remove a warehouse in Suse, use the zypper command with the removerepo or rr subcommand.
Root@kerneltalks # zypper removerepo nVidia-Driver-SLE12-SP3Removing repository 'nVidia-Driver-SLE12-SP3'. . [done] Repository 'nVidia-Driver-SLE12-SP3' has been removed. Clear the zypper local cache
Use the zypper clean command to clear the zypper local cache.
Root@kerneltalks # zypper cleanAll repositories have been cleaned up. The above is all the contents of the article "what are the practical zypper commands in linux?" Thank you for reading! Hope to share the content to help you, more related knowledge, welcome to follow the industry information channel!
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.