zypper 使用方法
zypper 使用方法
zypper 为OpenSUSE和 SLES SUSE系统下的包管理工具,跟Ubuntu的apt-get,CentOS的yum一样的功能;
下面以安装工具Perf为例演示如何使用zypper。
1. 添加源
zypper addrepo --check --refresh --name "openSUSE:Factory" http://download.opensuse.org/tumbleweed/repo/oss/ "openSUSE:Factory-repo"
2. 更新源
zypper refresh
MINI-G06-ts-01:~ # zypper refresh
Repository 'SLE-Module-Containers-Pool' is up to date.
Repository 'SLE-Module-Containers-Updates' is up to date.
Repository 'SLE-Module-Toolchain-Updates' is up to date.
Repository 'SLE12-SP3-SDK-Pool' is up to date.
Repository 'SLE12-SP3-SDK-Updates' is up to date.
Repository 'SLE12/SLES12-SP3-LTSS-Updates' is up to date.
Repository 'SLES12-SP3-Pool' is up to date.
Repository 'SLES12-SP3-Updates' is up to date.
Repository 'debugToolsRepo' is up to date.
All repositories have been refreshed.
3.安装工具包
MINI-G06-ts-01:~ # zypper install perf
Loading repository data...
Reading installed packages...
Resolving package dependencies...
The following 140 NEW packages are going to be installed:
Mesa Mesa-libEGL1 Mesa-libGL1 Mesa-libglapi0 adwaita-icon-theme at-spi2-atk-common at-spi2-atk-gtk2 at-spi2-core cantarell-fonts cups-libs dbus-1-x11 dconf desktop-translations fuse gcr-data gcr-lang gcr-prompter gcr-viewer gd
gdk-pixbuf-lang gdk-pixbuf-loader-rsvg gdk-pixbuf-query-loaders gio-branding-SLE glib-networking glib-networking-lang glib2-tools gnome-icon-theme gnome-icon-theme-symbolic gsettings-backend-dconf gsettings-desktop-schemas
gsettings-desktop-schemas-lang gtk2-branding-SLED gtk2-data gtk2-lang gtk2-metatheme-adwaita gtk2-theming-engine-adwaita gtk2-tools gtk3-data gtk3-lang gtk3-metatheme-adwaita gtk3-tools gvfs gvfs-backends gvfs-fuse gvfs-lang
hicolor-icon-theme json-glib-lang libLLVM libX11-xcb1 libXcursor1 libXdamage1 libXfixes3 libXft2 libXinerama1 libXpm4 libXrandr2 libXxf86vm1 libarchive13 libatasmart4 libatk-1_0-0 libatk-bridge-2_0-0 libatspi0 libavahi-client3
libavahi-common3 libavahi-glib1 libbluray1 libcairo-gobject2 libcairo2 libcdio14 libcdio_cdda1 libcdio_paranoia1 libcolord2 libdatrie1 libdconf1 libdrm2 libdrm_amdgpu1 libdrm_intel1 libdrm_nouveau2 libdrm_radeon1 libelf0 libepoxy0
libexif12 libgbm1 libgck-1-0 libgcr-3-1 libgdata22 libgdk_pixbuf-2_0-0 libgio-2_0-0 libgnutls28 libgoa-1_0-0 libgphoto2-6 libgphoto2-6-lang libgraphite2-3 libgtk-2_0-0 libgtk-3-0 libgudev-1_0-0 libharfbuzz0 libhogweed2 libjasper1
libjbig2 libjson-glib-1_0-0 liblockdev1 libmozjs-17_0 libmtp9 libnettle4 liboauth0 libpango-1_0-0 libpciaccess0 libpixman-1-0 libpolkit0 librest0 librsvg-2-2 libsecret-1-0 libsecret-lang libslang2 libsoup-2_4-1 libsoup-lang libthai-data
libthai0 libtiff5 libudisks2-0 libvpx1 libxcb-dri2-0 libxcb-dri3-0 libxcb-glx0 libxcb-present0 libxcb-render0 libxcb-shm0 libxcb-sync1 libxcb-xfixes0 libxshmfence1 lockdev metatheme-adwaita-common perf polkit polkit-default-privs
shared-mime-info udisks2 udisks2-lang wallpaper-branding-SLE
The following 21 recommended packages were automatically selected:
cantarell-fonts gcr-lang gcr-viewer gdk-pixbuf-lang glib-networking-lang glib2-tools gsettings-desktop-schemas-lang gtk2-branding-SLED gtk2-data gtk2-lang gtk3-lang gvfs gvfs-backends gvfs-fuse gvfs-lang json-glib-lang libgphoto2-6-lang
libsecret-lang libsoup-lang udisks2 udisks2-lang
140 new packages to install.
Overall download size: 69.1 MiB. Already cached: 0 B. After the operation, additional 224.1 MiB will be used.
Continue? [y/n/...? shows all options] (y): y
Retrieving package dbus-1-x11-1.8.22-29.17.12.x86_64 (1/140), 71.7 KiB ( 30.2 KiB unpacked)
Retrieving: dbus-1-x11-1.8.22-29.17.12.x86_64.rpm ...
4.删除包
zypper remove perf
5. 查找包
#支持正则查包
MINI-G06-ts-01:~ # zypper search perf
Loading repository data...
Reading installed packages...
S | Name | Summary | Type
---+--------------------+----------------------------------------------------------+-----------
| gperf | A Compiler Tool for Generating Perfect Hash Functions | package
| gperftools | Performance Tools for C++ | package
| gperftools-devel | Performance tools for C++ | package
i+ | iperf | A tool and library to measure network performance. | package
| junitperf | JUnit extension for performance and scalability testing | package
| pcp-pmda-perfevent | Performance Co-Pilot (PCP) metrics for hardware counters | package
i+ | perf | Performance Monitoring Tools for Linux | package
| perf | Performance Monitoring Tools for Linux | srcpackage
| perftest | IB Performance tests | package
| qperf | Measure socket and RDMA performance | package
| x11perf | Utility to test X11 server performance | package
6. 更新包
zypper update perf
7. 包信息
MINI-G06-ts-01:~ # zypper info perf
Loading repository data...
Reading installed packages...
Information for package perf:
-----------------------------
Repository : SLES12-SP3-Updates
Name : perf
Version : 4.4.155-45.14.2
Arch : x86_64
Vendor : SUSE LLC <https://www.suse.com/>
Support Level : Level 3
Installed Size : 6.2 MiB
Installed : Yes
Status : up-to-date
Source package : perf-4.4.155-45.14.2.src
Summary : Performance Monitoring Tools for Linux
Description :
This package provides a userspace tool 'perf', which monitors performance for
either unmodified binaries or the entire system. It requires a Linux kernel
which includes the Performance Counters for Linux (PCL) subsystem (>= 2.6.31).
This subsystem utilizes the Performance Monitoring Unit (PMU) / hardware
counters of the underlying cpu architecture (if supported).
8. 查看源信息
MINI-G06-ts-01:~ # zypper lr --url
Repository priorities are without effect. All enabled repositories share the same priority.
# | Alias | Name | Enabled | GPG Check | Refresh | URI
--+------------------------------------+-------------------------------+---------+-----------+---------+------------------------------------------------------------------------------------------------------------
1 | SLE-Module-Containers-Pool-repo | SLE-Module-Containers-Pool | Yes | (r ) Yes | Yes | https://arm.sero.gic.xxx.se/artifactory/proj-suse-repos-rpm-local/SLE12/SLE-Module-Containers-Pool/
9 | debugToolsRepo | debugToolsRepo | Yes | ( p) Yes | No | dir:///opt/miep/tools/debugtools/repo