Table of Contents
In this article, I will guide you through 50 Useful Zypper Command Examples to Manage Packages on OpenSUSE Linux. You might have heard about yum utility for managing packages on RHEL/CentOS Based Servers and apt-get utility on Ubuntu/Debian Based Servers. Similarly we have zypper utility available for OpenSUSE/SUSE based Servers.
Zypper is a very useful command Line Interface(CLI) Package Manager in OpenSUSE Linux used for installing, removing, updating and managing packages. It is also used in SUSE Linux. By default you will see zypper command available in your Server hence you don't have to install it separately. Here we will look into all the possible usages of zypper command in detail with the help of examples.
Zypper Command Examples to Manage Packages on OpenSUSE Linux
Also Read: How to Start and Enable SSHD Service in OpenSUSE Linux
Example 1: How to Check Zypper Version
If you want to check the zypper version then you need to use zypper -V
command as shown below. As shown in the output, current version is 1.14.36
.
localhost:~ # zypper -V zypper 1.14.36
-V : print version of zypper command and exit. More on zypper command Man Page.
NOTE:
root
user to run all the below commands. You can use any user with sudo
access to run all these commands. For more information Please check Step by Step: How to Add User to Sudoers to provide sudo
access to the User.Example 2: How to Install a Package Using Zypper
To install a package in OpenSUSE Linux you need to use zypper in <package_name>
or zypper install <package_name>
. In this example I am installing gcc package using zypper in gcc
command as shown below.
localhost:~ # zypper in gcc Loading repository data... Reading installed packages... Resolving package dependencies... The following 13 NEW packages are going to be installed: gcc gcc7 glibc-devel libasan4 libatomic1 libcilkrts5 libitm1 liblsan0 libmpx2 libmpxwrappers2 libtsan0 libubsan0 linux-glibc-devel 13 new packages to install. Overall download size: 22.6 MiB. Already cached: 0 B. After the operation, additional 83.3 MiB will be used. Continue? [y/n/v/...? shows all options] (y): y Retrieving package libasan4-7.5.0+r278197-lp152.2.46.x86_64 (1/13), 357.4 KiB ( 1.3 MiB unpacked) Retrieving: libasan4-7.5.0+r278197-lp152.2.46.x86_64.rpm .............................................................................................[done (6.6 KiB/s)] Retrieving package libcilkrts5-7.5.0+r278197-lp152.2.46.x86_64 (2/13), 60.7 KiB (120.1 KiB unpacked) Retrieving: libcilkrts5-7.5.0+r278197-lp152.2.46.x86_64.rpm .........................................................................................[done (13.5 KiB/s)] Retrieving package libmpx2-8.2.1+r264010-lp152.2.126.x86_64 (3/13), 19.1 KiB ( 18.3 KiB unpacked) Retrieving: libmpx2-8.2.1+r264010-lp152.2.126.x86_64.rpm ...............................................................................................[done (945 B/s)] Retrieving package libmpxwrappers2-8.2.1+r264010-lp152.2.126.x86_64 (4/13), 17.8 KiB ( 14.2 KiB unpacked) Retrieving: libmpxwrappers2-8.2.1+r264010-lp152.2.126.x86_64.rpm ....................................................................................[done (15.0 KiB/s)]
Example 3: How to Upgrade all the Packages in OpenSUSE Linux
If you want to upgrade all the packages of your OpenSUSE Server to the latest version then you need to use zypper update
command as shown below.
localhost:~ # zypper update Loading repository data... Reading installed packages... The following 22 NEW packages are going to be installed: kernel-default-5.3.18-lp152.57.1 libbind9-1600 libctf-nobfd0 libctf0 libdns1605 libirs1601 libisc1606 libisccc1600 libisccfg1600 libns1604 libuv1 libvulkan1 libyaml-cpp0_6 pipewire pipewire-modules pipewire-spa-plugins-0_2 pipewire-spa-tools pipewire-tools python3-pycairo raleway-fonts systemd-network virtualbox-kmp-default The following package is going to be REMOVED: python3-cairo The following 416 packages are going to be upgraded: ImageMagick ImageMagick-config-7-SUSE MozillaFirefox MozillaFirefox-translations-common NetworkManager NetworkManager-branding-openSUSE NetworkManager-lang PackageKit PackageKit-backend-zypp PackageKit-gstreamer-plugin PackageKit-gtk3-module PackageKit-lang aaa_base aaa_base-extras alsa apparmor-abstractions apparmor-docs apparmor-parser apparmor-parser-lang apparmor-profiles apparmor-utils apparmor-utils-lang audit autoyast2-installation avahi avahi-lang bind-utils binutils bluez brltty brltty-driver-at-spi2 brltty-driver-brlapi brltty-driver-speech-dispatcher brltty-driver-xwindow brltty-lang ca-certificates-mozilla cdda2wav cdrecord chrony chrony-pool-openSUSE cpupower cryptsetup curl device-mapper diffutils diffutils-lang dmidecode dracut e2fsprogs file file-magic findutils findutils-lang firebird flatpak fonttosfnt fwupd fwupd-lang gdm gdm-lang gdmflexiserver gettext-runtime ghostscript ghostscript-fonts-other ghostscript-fonts-std
Example 4: How to View all the Available Updates in OpenSUSE Linux
If you want to view all the available updates for your OpenSUSE Linux then you need to use zypper list-updates command as shown below.
localhost:~ # zypper list-updates Loading repository data... Reading installed packages... S | Repository | Name | Current Version | Available Version | Arch --+------------------------+-------------------------------------+---------------------------------------+------------------------------------------+------- v | Main Update Repository | ImageMagick | 7.0.7.34-lp152.11.6 | 7.0.7.34-lp152.12.6.1 | x86_64 v | Main Update Repository | ImageMagick-config-7-SUSE | 7.0.7.34-lp152.11.6 | 7.0.7.34-lp152.12.6.1 | x86_64 v | Main Update Repository | MozillaFirefox | 68.9.0-lp152.1.1 | 78.5.0-lp152.2.30.1 | x86_64 v | Main Update Repository | MozillaFirefox-translations-common | 68.9.0-lp152.1.1 | 78.5.0-lp152.2.30.1 | x86_64 v | Main Update Repository | NetworkManager | 1.22.6-lp152.1.4 | 1.22.10-lp152.2.3.1 | x86_64 v | Main Update Repository | NetworkManager-branding-openSUSE | 42.1-lp152.1.2 | 42.1-lp152.2.6.1 | noarch v | Main Update Repository | NetworkManager-lang | 1.22.6-lp152.1.4 | 1.22.10-lp152.2.3.1 | noarch v | Main Update Repository | PackageKit | 1.1.13-lp152.2.3 | 1.1.13-lp152.3.11.1 | x86_64 v | Main Update Repository | PackageKit-backend-zypp | 1.1.13-lp152.2.3 | 1.1.13-lp152.3.11.1 | x86_64 v | Main Update Repository | PackageKit-gstreamer-plugin | 1.1.13-lp152.2.3 | 1.1.13-lp152.3.11.1 | x86_64 v | Main Update Repository | PackageKit-gtk3-module | 1.1.13-lp152.2.3 | 1.1.13-lp152.3.11.1 | x86_64 v | Main Update Repository | PackageKit-lang | 1.1.13-lp152.2.3 | 1.1.13-lp152.3.11.1 | noarch
Example 5: How to Remove a Package Using Zypper Command
If you want to remove a package then you need to use zypper remove <package_name>
or zypper rm <package_name>
command. In this example we are removing gcc
package from OpenSUSE Linux Server using zypper remove gcc
command as shown below.
localhost:~ # zypper remove gcc Reading installed packages... Resolving package dependencies... The following package is going to be REMOVED: gcc 1 package to remove. No additional space will be used or freed after the operation. Continue? [y/n/v/...? shows all options] (y): y (1/1) Removing gcc-7-lp152.4.114.x86_64 ..........................................................................................................................[done]
Example 6: How to Search a Package from Repository
If you want to search a package from Repository then you need to use zypper search <package_name>
or zypper se <package_name>
command. In this example we are trying to search gcc
related packages using zypper search gcc*
command as shown below.
localhost:~ # zypper search gcc* Loading repository data... Reading installed packages... S | Name | Summary | Type --+---------------------+-----------------------------------------------------------+----------- | gcc | The system GNU C Compiler | package | gcc-32bit | The system GNU C Compiler | package | gcc-PIE | A default configuration to build all binaries in PIE mode | package | gcc-ada | The system GNU Ada Compiler | package | gcc-ada-32bit | The system GNU Ada Compiler | package | gcc-c++ | The system GNU C++ Compiler | package | gcc-c++-32bit | The system GNU C++ Compiler | package | gcc-fortran | The system GNU Fortran Compiler | package | gcc-fortran-32bit | The system GNU Fortran Compiler | package
Example 7: How to Install a Package by its Name Using Zypper Command
If you want to Install a Package by its name then you need to use -n
option with zypper install
command as shown below. In this example we are trying to install gcc
package with its name by using zypper install -n gcc
command.
localhost:~ # zypper install -n gcc Loading repository data... Reading installed packages... Resolving package dependencies... The following NEW package is going to be installed: gcc 1 new package to install. Overall download size: 10.1 KiB. Already cached: 0 B. No additional space will be used or freed after the operation. Continue? [y/n/v/...? shows all options] (y): y Retrieving package gcc-7-lp152.4.114.x86_64 (1/1), 10.1 KiB ( 0 B unpacked) Retrieving: gcc-7-lp152.4.114.x86_64.rpm .........................................................................................................................[done] Checking for file conflicts: .....................................................................................................................................[done] (1/1) Installing: gcc-7-lp152.4.114.x86_64 .......................................................................................................................[done]
Example 8: How to Get Information about a Package Using Zypper Command
If you to get the complete information about a certain package then you need to use zypper info <package_name>
command. In this example, we are trying to know more about gcc
package using zypper info gcc
command as shown below.
localhost:~ # zypper info gcc Loading repository data... Reading installed packages... Information for package gcc: ---------------------------- Repository : Main Repository Name : gcc Version : 7-lp152.4.114 Arch : x86_64 Vendor : openSUSE Installed Size : 0 B Installed : Yes Status : up-to-date Source package : gcc-7-lp152.4.114.src Summary : The system GNU C Compiler Description : The system GNU C Compiler.
Example 9: How to Upgrade a Specific Package in OpenSUSE Linux
If you want to upgrade a specific package then you need to use zypper update <package_name>
or zypper up <package_name>
command. In this example, we are trying to upgrade flatpak
package using zypper update flatpak
command as shown below.
localhost:~ # zypper update flatpak Loading repository data... Reading installed packages... Resolving package dependencies... The following package is going to be upgraded: flatpak 1 package to upgrade. Overall download size: 1.1 MiB. Already cached: 0 B. After the operation, additional 7.0 B will be used. Continue? [y/n/v/...? shows all options] (y): y Retrieving package flatpak-1.6.3-lp152.3.3.1.x86_64 (1/1), 1.1 MiB ( 4.8 MiB unpacked) Retrieving delta: ./x86_64/flatpak-1.6.3-lp152.2.1_lp152.3.3.1.x86_64.drpm, 235.1 KiB Retrieving: flatpak-1.6.3-lp152.2.1_lp152.3.3.1.x86_64.drpm .........................................................................................[done (15.0 KiB/s)] Applying delta: ./flatpak-1.6.3-lp152.2.1_lp152.3.3.1.x86_64.drpm ................................................................................................[done] Checking for file conflicts: .....................................................................................................................................[done] (1/1) Installing: flatpak-1.6.3-lp152.3.3.1.x86_64 ...............................................................................................................[done]
Example 10: How to View All the available patches in OpenSUSE Linux
To view all the available patches in OpenSUSE Linux you need to use zypper patches
command as shown below.
localhost:~ # zypper patches Retrieving repository 'Main Update Repository' metadata ..........................................................................................................[done] Building repository 'Main Update Repository' cache ...............................................................................................................[done] Loading repository data... Reading installed packages... Repository | Name | Category | Severity | Interactive | Status | Summary ----------------------------+--------------------+-------------+-----------+-------------+------------+---------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- Update Repository (Non-Oss) | openSUSE-2019-2154 | security | moderate | --- | not needed | Security update for opera Main Update Repository | openSUSE-2020-1001 | security | moderate | --- | not needed | Security update for rubygem-puma Main Update Repository | openSUSE-2020-1002 | security | important | --- | not needed | Security update for python-ipaddress Main Update Repository | openSUSE-2020-1004 | recommended | moderate | --- | not needed | Recommended update for lxd Main Update Repository | openSUSE-2020-1005 | security | moderate | --- | not needed | Security update for pdns-recursor Main Update Repository | openSUSE-2020-1006 | recommended | moderate | --- | not needed | Recommended update for resource-agents Main Update Repository | openSUSE-2020-1007 | security | moderate | --- | not needed | Security update for ntp Main Update Repository | openSUSE-2020-1008 | recommended | moderate | --- | not needed | Recommended update for keepassxc Main Update Repository | openSUSE-2020-1009 | recommended | moderate | --- | needed | Recommended update for dracut Main Update Repository | openSUSE-2020-1010 | recommended | important | --- | needed | Recommended update for yast2-installation Main Update Repository | openSUSE-2020-1011 | security | important | --- | not needed | Security update for singularity Main Update Repository | openSUSE-2020-1012 | recommended | moderate | --- | not needed | Recommended update for pan Main Update Repository | openSUSE-2020-1014 | security | important | --- | not needed | Security update for google-compute-engine
Example 11: How to Lock a Package Using zypper command
If you want to lock a certain package then you need to use zypper al <package_name>
command. In this example we are trying to lock gcc package using zypper al gcc
command as shown below.
localhost:~ # zypper al gcc Specified lock has been successfully added.
Example 12: How to remove lock from a package Using zypper command
To remove the lock from a package you need to use zypper rl <package_name>
command as shown below. In this example we are removing lock from gcc
package by using zypper rl gcc
command.
localhost:~ # zypper rl gcc 1 lock has been successfully removed.
Example 13: How to Check if there is a lock on any of the packages
If you want to check for a defined packages locks then you need to use zypper ll
command as shown below.
localhost:~ # zypper ll There are no package locks defined.
Example 14: How to View all the Repositories in OpenSUSE Linux
If you want to view all the repositories in your OpenSUSE Server then you need to use zypper lr
command as shown below.
localhost:~ # zypper lr Repository priorities are without effect. All enabled repositories share the same priority. # | Alias | Name | Enabled | GPG Check | Refresh ---+---------------------------+------------------------------------+---------+-----------+-------- 1 | openSUSE-Leap-15.2-1 | openSUSE-Leap-15.2-1 | No | ---- | ---- 2 | repo-debug | Debug Repository | No | ---- | ---- 3 | repo-debug-non-oss | Debug Repository (Non-OSS) | No | ---- | ---- 4 | repo-debug-update | Update Repository (Debug) | No | ---- | ---- 5 | repo-debug-update-non-oss | Update Repository (Debug, Non-OSS) | No | ---- | ---- 6 | repo-non-oss | Non-OSS Repository | Yes | (r ) Yes | Yes 7 | repo-oss | Main Repository | Yes | (r ) Yes | Yes 8 | repo-source | Source Repository | No | ---- | ---- 9 | repo-source-non-oss | Source Repository (Non-OSS) | No | ---- | ---- 10 | repo-update | Main Update Repository | Yes | (r ) Yes | Yes 11 | repo-update-non-oss | Update Repository (Non-Oss) | Yes | (r ) Yes | Yes
Example 15: How to Install a Package Using Its Source Package
If you want to install a package using its source package then you need to use zypper source-install <package_name>
command as shown below. In this example we are installing mariadb
package using its source package by using zypper source-install mariadb
command.
localhost:~ # zypper source-install mariadb Loading repository data... Reading installed packages... Resolving package dependencies... The following 51 NEW packages are going to be installed: autoconf automake bison bison-lang cmake cmake-full cmake-man gcc gcc-c++ gcc7-c++ judy-devel judy-doc keyutils-devel krb5-devel libJudy1 libaio-devel libarchive-devel libboost_headers1_66_0-devel libbz2-devel libcom_err-devel libedit-devel libevent-devel libjsoncpp19 libopenssl-1_1-devel libopenssl-devel libpcre16-0 libpcrecpp0 libpcreposix0 libpq5 librhash0 libstdc++-devel libstdc++6-devel-gcc7 libtool libuv1 libverto-devel libxml2-devel lzo-devel ncurses-devel pam-devel pcre-devel psqlODBC readline-devel sqlite3 systemd-devel systemd-rpm-macros tack tcpd-devel unixODBC unixODBC-devel xz-devel zlib-devel The following source package is going to be installed: mariadb The following 3 recommended packages were automatically selected: bison-lang judy-doc psqlODBC 51 new packages to install, 1 source package. Overall download size: 114.7 MiB. Already cached: 0 B. After the operation, additional 313.6 MiB will be used. Continue? [y/n/v/...? shows all options] (y): y Retrieving package autoconf-2.69-lp152.3.112.noarch (1/52), 706.0 KiB ( 2.2 MiB unpacked) Retrieving: autoconf-2.69-lp152.3.112.noarch.rpm ...................................................................................................[done (195.0 KiB/s)] Retrieving package bison-3.0.4-lp152.3.110.x86_64 (2/52), 483.6 KiB ( 1.2 MiB unpacked) Retrieving: bison-3.0.4-lp152.3.110.x86_64.rpm ......................................................................................................[done (16.4 KiB/s)] Retrieving package cmake-man-3.17.0-lp152.1.2.x86_64 (3/52), 610.6 KiB (530.0 KiB unpacked)
Example 16: How to Install Old Version of a Package Using zypper command
You can install old version of a package using zypper install --oldpackage <package_name>
command even if the latest version is already installed. In this example we are trying to install old openssl package using zypper install --oldpackage openssl-1.1.0i-1p151.1.1.noarch.rpm command as shown below. As you can see from the below output, this might break the openssl package by ignoring some of its dependencies so you need to double check before installing old version of a package.
localhost:~ # zypper install --oldpackage openssl-1.1.0i-lp151.1.1.noarch.rpm Loading repository data... Reading installed packages... Resolving package dependencies... Problem: nothing provides openssl-1_1 = 1.1.0i needed by openssl-1.1.0i-lp151.1.1.noarch Solution 1: do not install openssl-1.1.0i-lp151.1.1.noarch Solution 2: break openssl-1.1.0i-lp151.1.1.noarch by ignoring some of its dependencies Choose from above solutions by number or cancel [1/2/c/d/?] (c):
Example 17: How to Clean Up All the Repositories Information from Cache
If you want to clean up all the repositories cache then you need to use zypper clean
command as shown below.
localhost:~ # zypper clean All repositories have been cleaned up.
Example 18: How to Suppress Package Installation Output Using --quiet Option
If you want to suppress the package installation output then you need to use --quiet
option with zypper install command as shown below. In this example, we are trying to install sysstat
package with --quiet
option enabled by using zypper --quiet install sysstat
command as shown below.
localhost:~ # zypper --quiet install sysstat The following 5 NEW packages are going to be installed: metamail procmail sharutils sharutils-lang sysstat The following 2 recommended packages were automatically selected: metamail sharutils-lang 5 new packages to install. Overall download size: 967.6 KiB. Already cached: 0 B. After the operation, additional 3.4 MiB will be used. Continue? [y/n/v/...? shows all options] (y): y
Example 19: How to Suppress Package Removal Output Using --quiet Option
Like installation you can also use remove the package quietly without showing anything on the output. In this example we are trying to remove sysstat
package with --quiet
option enabled using zypper --quiet remove sysstat
command as shown below.
localhost:~ # zypper --quiet remove sysstat The following package is going to be REMOVED: sysstat 1 package to remove. After the operation, 1.4 MiB will be freed. Continue? [y/n/v/...? shows all options] (y): y
Example 20: How to Non-Interactively Install a Package Using zypper command
If you want to non-interactively install a package using zypper command then you need to use --non-interactive
option as shown below. This option allows the package to install without asking your confirmation. In this example we are trying to install sysstat
package non-interactively using zypper --non-interactive install sysstat
command.
localhost:~ # zypper --non-interactive install sysstat Loading repository data... Reading installed packages... Resolving package dependencies... The following NEW package is going to be installed: sysstat 1 new package to install. Overall download size: 374.9 KiB. Already cached: 0 B. After the operation, additional 1.4 MiB will be used. Continue? [y/n/v/...? shows all options] (y): y Retrieving package sysstat-12.0.2-lp152.9.7.1.x86_64 (1/1), 374.9 KiB ( 1.4 MiB unpacked) Retrieving: sysstat-12.0.2-lp152.9.7.1.x86_64.rpm ...................................................................................................[done (16.4 KiB/s)] Checking for file conflicts: .....................................................................................................................................[done] (1/1) Installing: sysstat-12.0.2-lp152.9.7.1.x86_64 ..............................................................................................................[done]
Example 21: How to Non-Interactively Remove a Package Using zypper Command
Similarly like installation you can also remove the package non-interactively. In this example we are trying to remove sysstat
package non-interactively using zypper --non-interactive remove sysstat
command as shown below.
localhost:~ # zypper --non-interactive remove sysstat Reading installed packages... Resolving package dependencies... The following package is going to be REMOVED: sysstat 1 package to remove. After the operation, 1.4 MiB will be freed. Continue? [y/n/v/...? shows all options] (y): y (1/1) Removing sysstat-12.0.2-lp152.9.7.1.x86_64 .................................................................................................................[done]
Example 22: How to Add a Repository in OpenSUSE Linux Using zypper Command
If you want to add a Repository in OpenSUSE Linux then you need to use zypper ar <repository_path> <alias>
command as shown below. In this example we are trying to add VLC repository using zypper ar http://download.videolan.org/pub/vlc/SuSE/Leap_15.0/ vlc
command.
localhost:~ # zypper ar http://download.videolan.org/pub/vlc/SuSE/Leap_15.0/ vlc Adding repository 'vlc' ..........................................................................................................................................[done] Repository 'vlc' successfully added URI : http://download.videolan.org/pub/vlc/SuSE/Leap_15.0/ Enabled : Yes GPG Check : Yes Autorefresh : No Priority : 99 (default priority) Repository priorities are without effect. All enabled repositories share the same priority.
Example 23: How to Remove a Repository Using zypper Command
If you want to remove a repository then you need to use zypper removerepo <package_name>
command. In this example we are trying to remove vlc
repo using zypper removerepo vlc
command as shown below.
localhost:~ # zypper removerepo vlc Removing repository 'vlc' ........................................................................................................................................[done] Repository 'vlc' has been removed.
Example 24: How to Rename a Repository in OpenSUSE Linux
You can also rename a repository by using zypper renamerepo <old_repo_name> <new_repo_name>
command. In this example we are renaming vlc
repo to vlc-new
by using zypper renamerepo vlc vlc-new
command as shown below.
localhost:~ # zypper renamerepo vlc vlc-new Repository 'vlc' renamed to 'vlc-new'.
Example 25: How to Disable a Repository in OpenSUSE Linux
If you need to disable a repository then you can easily do that by running zypper modifyrepo -d <package_name>
command. For example we are trying to disable vlc-new
repository by using zypper modifyrepo -d vlc-new
command as shown below.
localhost:~ # zypper modifyrepo -d vlc-new Repository 'vlc-new' has been successfully disabled.
Example 26: How to Enable a Repository in OpenSUSE Linux
Like disable, you can also enable the repository by using -e
option as shown below. In this example we are enabling vlc-new
repository by using zypper modifyrepo -e vlc-new
command.
localhost:~ # zypper modifyrepo -e vlc-new Repository 'vlc-new' has been successfully enabled.
Example 27: How to Install Only the Source for a Specific Package
If you are looking to install only the source of a specific package then you need to use zypper install -D <package_name>
command. In this example we are installing source of mariadb
package by using zypper install -D mariadb
command as shown below.
localhost:~ # zypper install -D mariadb Loading repository data... Reading installed packages... Resolving package dependencies... The following 4 NEW packages are going to be installed: mariadb mariadb-client mariadb-errormessages python3-mysqlclient The following recommended package was automatically selected: mariadb 4 new packages to install. Overall download size: 21.9 MiB. Already cached: 0 B. After the operation, additional 163.5 MiB will be used. Continue? [y/n/v/...? shows all options] (y): y
Example 28: How to Install Only the Build dependencies of a Specific Package
If you want to install only the build dependencies of a specific package then you need to use zypper source-install -d <package_name>
command. In this example we are trying to install build dependencies of sysstat
package using zypper source-install -d sysstat
command as shown below.
localhost:~ # zypper source-install -d sysstat Loading repository data... Reading installed packages... Resolving package dependencies... The following 2 NEW packages are going to be installed: libsensors4-devel update-desktop-files 2 new packages to install. Overall download size: 36.9 KiB. Already cached: 0 B. After the operation, additional 41.2 KiB will be used. Continue? [y/n/v/...? shows all options] (y): y Retrieving package libsensors4-devel-3.5.0-lp152.1.5.x86_64 (1/2), 23.1 KiB ( 23.8 KiB unpacked) Retrieving: libsensors4-devel-3.5.0-lp152.1.5.x86_64.rpm ............................................................................................[done (14.1 KiB/s)] Retrieving package update-desktop-files-84.87-lp152.3.2.noarch (2/2), 13.8 KiB ( 17.4 KiB unpacked) Retrieving: update-desktop-files-84.87-lp152.3.2.noarch.rpm ......................................................................................................[done] Checking for file conflicts: .....................................................................................................................................[done] (1/2) Installing: libsensors4-devel-3.5.0-lp152.1.5.x86_64 .......................................................................................................[done] (2/2) Installing: update-desktop-files-84.87-lp152.3.2.noarch ....................................................................................................[done]
Example 29: How to List All the Packages from a Certain Repository in OpenSUSE Linux
If you want to view all the packages from a certain repository then you need to use zypper pa -ir <repo_name>
command as shown below. In this example we are trying to check all the packages from repo-oss
repo using zypper pa -ir repo-oss
command as shown below.
localhost:~ # zypper pa -ir repo-oss Loading repository data... Reading installed packages... S | Repository | Name | Version | Arch ---+-----------------+----------------------------------------------+---------------------------------------+------- i | Main Repository | AppStream | 0.12.6-lp152.2.11 | x86_64 i | Main Repository | AppStream-lang | 0.12.6-lp152.2.11 | noarch i | Main Repository | GeoIP | 1.6.12-lp152.3.2 | x86_64 i | Main Repository | GeoIP-data | 1.6.12-lp152.3.2 | noarch i | Main Repository | ImageMagick | 7.0.7.34-lp152.11.6 | x86_64 i | Main Repository | ImageMagick-config-7-SUSE | 7.0.7.34-lp152.11.6 | x86_64 i | Main Repository | Mesa | 19.3.4-lp152.27.1 | x86_64 i | Main Repository | Mesa-demo-x | 8.3.0-lp152.3.7 | x86_64 i | Main Repository | Mesa-dri | 19.3.4-lp152.27.1 | x86_64
Example 30: How to Upgrade Current OpenSUSE Linux to Latest Version
If you want to upgrade current OpenSUSE Linux to latest version then you need to use zypper dist-upgrade
command as shown below.
localhost:~ # zypper dist-upgrade Loading repository data... Reading installed packages... Warning: You are about to do a distribution upgrade with all enabled repositories. Make sure these repositories are compatible before you continue. See 'man zypper' for more information about this command. Computing distribution upgrade... The following 22 NEW packages are going to be installed: kernel-default-5.3.18-lp152.57.1 libbind9-1600 libctf-nobfd0 libctf0 libdns1605 libirs1601 libisc1606 libisccc1600 libisccfg1600 libns1604 libvulkan1 libyaml-cpp0_6 openSUSE-release-ftp pipewire pipewire-modules pipewire-spa-plugins-0_2 pipewire-spa-tools pipewire-tools python3-pycairo raleway-fonts systemd-network virtualbox-kmp-default The following package is going to be REMOVED: python3-cairo The following 424 packages are going to be upgraded: ImageMagick ImageMagick-config-7-SUSE MozillaFirefox MozillaFirefox-translations-common NetworkManager NetworkManager-branding-openSUSE NetworkManager-lang PackageKit PackageKit-backend-zypp PackageKit-gstreamer-plugin PackageKit-gtk3-module PackageKit-lang aaa_base aaa_base-extras alsa apparmor-abstractions apparmor-docs apparmor-parser apparmor-parser-lang apparmor-profiles apparmor-utils apparmor-utils-lang audit autoyast2-installation avahi avahi-lang bind-utils binutils bluez brltty brltty-driver-at-spi2 brltty-driver-brlapi brltty-driver-speech-dispatcher brltty-driver-xwindow brltty-lang ca-certificates-mozilla cdda2wav cdrecord chrony
Example 31: How to Auto Agree to the License Agreements using zypper command
If you want to auto agree to the License agreements for the patch then you need to use zypper patch --auto-agree-with-license
command as shown below.
localhost:~ # zypper patch --auto-agree-with-licenses Loading repository data... Reading installed packages... Resolving package dependencies... The following NEW package is going to be installed: libyaml-cpp0_6 The following 7 NEW patches are going to be installed: openSUSE-2020-1019 openSUSE-2020-1065 openSUSE-2020-1515 openSUSE-2020-1615 openSUSE-2020-1794 openSUSE-2020-1980 openSUSE-2020-2007 The following 16 packages are going to be upgraded: PackageKit PackageKit-backend-zypp PackageKit-gstreamer-plugin PackageKit-gtk3-module PackageKit-lang libpackagekit-glib2-18 libsolv-tools libzypp python3-solv ruby-solv typelib-1_0-PackageKitGlib-1_0 yast2-packager yast2-pkg-bindings zypper zypper-log zypper-needs-restarting 16 packages to upgrade, 1 new. Overall download size: 0 B. Already cached: 7.2 MiB. After the operation, additional 805.4 KiB will be used. Note: Package manager restart required. (Run this command once again after the update stack got updated) Continue? [y/n/v/...? shows all options] (y):
Example 32: How to Refresh a Repository in OpenSUSE Linux using zypper command
If you want to refresh a repository then you need to use zypper refresh <repo-name>
command as shown below. In this example we are trying to refresh repo-oss
repo using zypper refresh repo-oss
command.
localhost:~ # zypper refresh repo-oss Repository 'Main Repository' is up to date. Specified repositories have been refreshed.
Example 33: How to Forcefully Install a Package in OpenSUSE Linux
If you are looking to forcefully install a package then you can use -f
option as shown below. In this example we are trying to install sysstat
package forcefully using zypper install -f sysstat
command.
localhost:~ # zypper install -f sysstat Loading repository data... Reading installed packages... Forcing installation of 'sysstat-12.0.2-lp152.9.7.1.x86_64' from repository 'Main Update Repository'. Resolving package dependencies... The following NEW package is going to be installed: sysstat 1 new package to install. Overall download size: 374.9 KiB. Already cached: 0 B. After the operation, additional 1.4 MiB will be used. Continue? [y/n/v/...? shows all options] (y): y Retrieving package sysstat-12.0.2-lp152.9.7.1.x86_64 (1/1), 374.9 KiB ( 1.4 MiB unpacked) Retrieving: sysstat-12.0.2-lp152.9.7.1.x86_64.rpm ................................................................................................................[done] Checking for file conflicts: .....................................................................................................................................[done] (1/1) Installing: sysstat-12.0.2-lp152.9.7.1.x86_64 ..............................................................................................................[done]
Example 34: How to List All the Language Codes using zypper command
If want to check all the language codes then you need to use zypper lloc
command as shown below.
localhost:~ # zypper lloc Code | Language | Requested ------+-------------------------+---------- en | English | Fallback en_US | English (United States) | Requested
Example 35: How to Show Complete Information About a Package in OpenSUSE Linux
If you are looking for complete information about a package then you need to use zypper product-info package:<package_name>
command as shown below. In this example we are looking for complete information about sysstat package using zypper product-info package:sysstat
command.
localhost:~ # zypper product-info package:sysstat Loading repository data... Reading installed packages... Information for package sysstat: -------------------------------- Repository : Main Update Repository Name : sysstat Version : 12.0.2-lp152.9.7.1 Arch : x86_64 Vendor : openSUSE Installed Size : 1.4 MiB Installed : Yes Status : up-to-date Source package : sysstat-12.0.2-lp152.9.7.1.src Summary : Sar and Iostat Commands for Linux Description : Sar and Iostat commands for Linux. The sar command collects and reports system activity information. The iostat command reports CPU statistics and I/O statistics for TTY devices and disks. The information collected by sar and iostat can be saved in a binary file for future inspection. Both commands now support SMP machines when displaying CPU utilization.
Example 36: How to List All Available Patterns in OpenSUSE Linux
If you want to list all the available patterns then you need to use zypper pt
command as shown below.
localhost:~ # zypper pt Loading repository data... Reading installed packages... S | Name | Version | Repository | Dependency ---+------------------------------+---------------------+--------------------+----------- | 32bit | 20171206-lp152.34.2 | Main Repository | i | apparmor | 20171206-lp152.34.2 | Main Repository | i | apparmor | 20171206-lp152.34.2 | @System | i+ | base | 20171206-lp152.34.2 | Main Repository | i+ | base | 20171206-lp152.34.2 | @System | | books | 20170319-lp152.5.3 | Main Repository | | ceph_base | 1.0-lp152.2.1 | Main Repository | | console | 20171206-lp152.34.2 | Main Repository | | container_runtime | 5.0-lp152.3.1 | Main Repository |
Example 37: How to List Available Products in OpenSUSE Linux
If you want to check all the available products then you need to use zypper pd
command as shown below.
localhost:~ # zypper pd Loading repository data... Reading installed packages... S | Repository | Internal Name | Name | Version | Arch | Is Base ---+--------------------+-----------------------+---------------------------------+---------+--------+-------- i+ | Main Repository | openSUSE | openSUSE Leap 15.2 | 15.2-1 | x86_64 | Yes | Non-OSS Repository | openSUSE-Addon-NonOss | openSUSE Leap 15.2 NonOSS Addon | 15.2-0 | x86_64 | No
Example 38: How to Download RPM File of a Package in Local Directory
If you only want to download the rpm file of a package then you need to use zypper download <package_name>
command as shown below. It will download the package in default directory. In this example we are trying to download sysstat
rpm package using zypper download sysstat
command. This will download the package under /var/cache/zypp/packages/repo-update/x86_64
path.
localhost:~ # zypper download sysstat Loading repository data... Reading installed packages... Retrieving package sysstat-12.0.2-lp152.9.7.1.x86_64 (1/1), 374.9 KiB ( 1.4 MiB unpacked) (1/1) /var/cache/zypp/packages/repo-update/x86_64/sysstat-12.0.2-lp152.9.7.1.x86_64.rpm ..........................................................................[done]
To check the downloaded package you can list it by using ls -lrt
command as shown below.
localhost:~ # ls -lrt /var/cache/zypp/packages/repo-update/x86_64/sysstat-12.0.2-lp152.9.7.1.x86_64.rpm -rw-r--r-- 1 root root 383928 Dec 19 08:01 /var/cache/zypp/packages/repo-update/x86_64/sysstat-12.0.2-lp152.9.7.1.x86_64.rpm
Example 39: How to Check If needs-reboot flag was set using zypper command
If you want to check if the systems requires reboot then you need to check the needs-rebooting
flag. You can check this flag by running zypper needs-rebooting
command as shown below. Since here no new core libraries or services had been updated so reboot is probably not required as of now. This output could be different in your case.
localhost:~ # zypper needs-rebooting No core libraries or services have been updated. Reboot is probably not necessary.
Example 40: How to List All the Packages Providing Specific Capability
If you want to List all the packages providing specific capability then you need to use zypper wp
command as shown below.
localhost:~ # zypper wp Command 'what-provides' is replaced by 'search --provides --match-exact'. See 'help search' for all available options. Loading repository data... Reading installed packages... S | Name | Summary | Type | xmgrace-devel | Grace library | package | xmh | Graphical user interface to send and read mail with MH | package | xmined | Graphical interface using Xterm of Mined text editor | package i | xml-commons-apis | APIs for DOM, SAX, and JAXP | package | xml-commons-apis-javadoc | Javadoc for xml-commons-apis | package | xml-commons-apis-manual | Manual for xml-commons-apis | package | xml-commons-resolver | Resolver subproject of xml-commons | package | xml-commons-resolver-javadoc | Javadoc for xml-commons-resolver | package | xml-im-exporter | XML Im-/Exporter | package | xml-im-exporter-javadoc | XML Im-/Exporter | package | xml-maven-plugin | Maven XML Plugin | package
Example 41: How to Search a Package Using Matching Pattern using zypper command
If you want to search a package using some matching pattern then you need to use zypper search <package_matching_pattern>
command as shown below. In this example we are trying to search all sysstat related packages using zypper search sysstat*
command.
localhost:~ # zypper search sysstat* Loading repository data... Reading installed packages... S | Name | Summary | Type ---+--------------+-------------------------------------------------+----------- i+ | sysstat | Sar and Iostat Commands for Linux | package | sysstat | Sar and Iostat Commands for Linux | srcpackage | sysstat-isag | Interactive System Activity Grapher for sysstat | package
Example 42: How to Check all the available zypper subcommand
To check all the available subcommand you need to use zypper subcommand
as shown below.
localhost:~ # zypper subcommand <subcommand> [--command-options] [arguments] Zypper subcommands are standalone executables that live in the zypper_execdir ('/usr/lib/zypper/commands'). For subcommands zypper provides a wrapper that knows where the subcommands live, and runs them by passing command-line arguments to them. If a subcommand is not found in the zypper_execdir, the wrapper will look in the rest of your $PATH for it. Thus, it's possible to write local zypper extensions that don't live in system space. Using zypper global-options together with subcommands, as well as executing subcommands in 'zypper shell' is currently not supported. Available zypper subcommands in '/usr/lib/zypper/commands' appstream-cache lifecycle Zypper subcommands available from elsewhere on your $PATH log Type 'zypper help <subcommand>' to get subcommand-specific help if available.
Example 43: How to Purge Old Kernels Using zypper command
If you have older kernel version in your server and you are looking to purge those kernels then you need to use zypper purge-kernels
command as shown below. It will keep the latest kernel and purge the old kernels.
localhost:~ # zypper purge-kernels Reading installed packages... Preparing to purge obsolete kernels... Configuration: latest,latest-1,running Running kernel release: 5.3.18-lp152.19-default Running kernel arch: x86_64 Resolving package dependencies... Nothing to do.
Example 44: How to Compare two version strings Using zypper command
You can use a special functionality of zypper command where it can compare two strings and shows which one is older. In this example we are comparing string 6.2
and 8.9
using zypper vcmp -m 6.2 8.9
command and from the output it shows that version 6.2
is older than 8.9
.
localhost:~ # zypper vcmp -m 6.2 8.9 6.2 is older than 8.9
Example 45: How to Print Target Operating System ID String Using zypper command
If you want to show the target Operating System ID String then you need to use zypper tos
command as shown below.
localhost:~ # zypper tos openSUSE-Leap-15.2-x86_64
Example 46: How to Start Zypper Shell and Run a Command
You can start a zypper shell and run commands from that shell. It can be start by using zypper sh
command and then you can run zypper managed commands there. For example in this case we are trying to remove sysstat
package from zypper shell using remove sysstat
command as shown below.
localhost:~ # zypper sh zypper> remove sysstat Reading installed packages... Resolving package dependencies... The following package is going to be REMOVED: sysstat 1 package to remove. After the operation, 1.4 MiB will be freed. Continue? [y/n/v/...? shows all options] (y): y (1/1) Removing sysstat-12.0.2-lp152.9.7.1.x86_64 .................................................................................................................[done] zypper> quit
Example 47: How to Take Backup of Repositories Using zypper Command
If you are planning to take backup of all the repositories then you need to use zypper lr --export <repo_path>
command as shown below. In this example we are taking the repository backup on /opt/repo.bkp
path using zypper lr --export /opt/repo.bkp
command.
localhost:~ # zypper lr --export /opt/repo.bkp Repositories have been successfully exported to /opt/repo.bkp.repo.
Example 48: How to Restore Repositories from Repo Backup Using zypper Command
You can also restore the repo from above taken backup by simply using zypper addrepo /opt/repo.bkp.repo
command as shown below. In this case since all the repos are already there so it won't restore any repo again.
localhost:~ # zypper addrepo /opt/repo.bkp.repo This is a changeable read-only media (CD/DVD), disabling autorefresh. Adding repository 'openSUSE-Leap-15.2-1' ........................................................................................................................[error] Repository named 'openSUSE-Leap-15.2-1' already exists. Please use another alias. Adding repository 'Debug Repository' ............................................................................................................................[error] Repository named 'repo-debug' already exists. Please use another alias. Adding repository 'Debug Repository (Non-OSS)' ..................................................................................................................[error] Repository named 'repo-debug-non-oss' already exists. Please use another alias. Adding repository 'Update Repository (Debug)' ...................................................................................................................[error] Repository named 'repo-debug-update' already exists. Please use another alias. Adding repository 'Update Repository (Debug, Non-OSS)' ..........................................................................................................[error] Repository named 'repo-debug-update-non-oss' already exists. Please use another alias. Adding repository 'Non-OSS Repository' ..........................................................................................................................[error]
Example 49: How to Check all the available Options of zypper Command
If you want to check all the available options of zipper command then you need to use zypper --help
command as shown below.
localhost:~ # zypper --help Usage: zypper [--GLOBAL-OPTIONS] <COMMAND> [--COMMAND-OPTIONS] [ARGUMENTS] zypper <SUBCOMMAND> [--COMMAND-OPTIONS] [ARGUMENTS] Global Options: --help, -h Help. --version, -V Output the version number. --promptids Output a list of zypper's user prompts. --config, -c <FILE> Use specified config file instead of the default. --userdata <STRING> User defined transaction id used in history and plugins. --quiet, -q Suppress normal output, print only error messages. --verbose, -v Increase verbosity. --color --no-color Whether to use colors in output if tty supports it. --no-abbrev, -A Do not abbreviate text in tables. Default: false --table-style, -s <INTEGER> Table style (0-11).
Example 50: How to Check Man Page of zypper command
If you want to check the man page of zypper command then you need to use man zypper
command as shown below.
localhost:~ # man zypper ZYPPER(8) ZYPPER ZYPPER(8) NAME zypper - Command-line interface to ZYpp system management library (libzypp) SYNOPSIS zypper [--global-opts] command [--command-opts] [command-arguments] zypper subcommand [--command-opts] [command-arguments] zypper help command DESCRIPTION zypper is a command-line interface to ZYpp system management library (libzypp). It can be used to install, update, remove software, manage repositories, perform various queries, and more. CONCEPTS Most of the following concepts are common for all applications based on the libzypp package management library, but there are some zypper specifics. System Packages The set of installed packages on a system is sometimes denoted as repository @System or System Packages. In contrast to available repositories providing packages which can be installed, @System provides packages which can only be deleted. Installed packages which are not also provided by at least one of the
Popular Recommendations:-
How to Start / Stop / Restart Network Service in OpenSUSE Linux
How to Check Stateful and Stateless Pods in Kubernetes Cluster
3 Easy Ways to Check/Find OpenSUSE Linux Version
6 Easy Steps to Setup and Manage Log rotation Using logrotate in Linux
Migrate CentOS 8 to CentOS Stream 8 in 6 Easy Steps
26 iostat, vmstat and mpstat command examples to Monitor Linux Performance
Practical Steps to Install iostat and mpstat command on Linux(RHEL/CentOS 7/8)
16 Fdisk command examples to Manage Disk Partitions in Linux