Zypper Commands In Linux With Examples - Part 2
To use zypper command in Linux
Zypper and YaST are the Package Manager for SUSE Linux that performs on top of RPM. YaST (Yet another Setup Tool) is a tool that performs on OpenSUSE and SUSE Enterprise edition to administer, setup and also configure SUSE Linux. Zypper is the command line interface of ZYpp package manager for removing, installing and updating SUSE.
To install a package
linuxhelp:~ # zypper install nano
Loading repository data...
Reading installed packages...
Resolving package dependencies...
The following 2 NEW packages are going to be installed:
nano nano-lang
The following recommended package was automatically selected:
nano-lang
2 new packages to install.
Overall download size: 550.0 KiB. Already cached: 0 B After the operation, additional
2.2 MiB will be used.
Continue? [y/n/? shows all options] (y): y
Retrieving package nano-2.3.6-1.1.x86_64 (1/2), 317.2 KiB (982.2 KiB unpacked)
Retrieving: nano-2.3.6-1.1.x86_64.rpm .............................[done (322.4 KiB/s)]
Retrieving package nano-lang-2.3.6-1.1.noarch (2/2), 232.8 KiB ( 1.2 MiB unpacked)
Retrieving: nano-lang-2.3.6-1.1.noarch.rpm ........................[done (362.0 KiB/s)]
Checking for file conflicts: ....................................................[done]
(1/2) Installing: nano-2.3.6-1.1 ................................................[done]
(2/2) Installing: nano-lang-2.3.6-1.1 ...........................................[done]
To install a package using version
linuxhelp:~ # zypper install ' gcc< 5.1'
Loading repository data...
Reading installed packages...
Resolving package dependencies...
The following 8 NEW packages are going to be installed:
gcc gcc48 glibc-devel libasan0 libatomic1 libitm1 libtsan0 linux-glibc-devel
.
.
.
(5/8) Installing: libtsan0-4.8.3+r212056-2.2.4 ..................................[done]
(6/8) Installing: glibc-devel-2.19-16.2.5 .......................................[done]
(7/8) Installing: gcc48-4.8.3+r212056-2.2.4 .....................................[done]
(8/8) Installing: gcc-4.8-7.1.2 .................................................[done]
To install a package with wildcards
linuxhelp:~ # zypper install nfs*
Loading repository data...
Reading installed packages...
' nfsidmap' providing ' nfs*' is already installed.
No update candidate for ' nfsidmap-0.25-6.1.2.x86_64' . The highest available version is already installed.
' nfs-client' providing ' nfs*' is already installed.
.
.
.
(1/6) Installing: latex2html-pngicons-2012-3.1.11 ...............................[done]
(2/6) Installing: nfs-kernel-server-1.3.0-4.2.1 .................................[done]
(3/6) Installing: nfs4-acl-tools-0.3.3-18.1.2 ...................................[done]
(4/6) Installing: nfsidmap-devel-0.25-6.1.2 .....................................[done]
(5/6) Installing: nfswatch-4.99.10-12.1.3 .......................................[done]
(6/6) Installing: nfs-doc-1.3.0-4.2.1 ...........................................[done]
To install a Package using pattern
linuxhelp:~ # zypper install -t pattern file_server
Loading repository data...
Reading installed packages...
Resolving package dependencies...
The following 13 NEW packages are going to be installed:
libiniparser0 libiniparser0-32bit nfs-client nfsidmap nfs-kernel-server
patterns-openSUSE-file_server samba-winbind samba-winbind-32bit tftp vsftpd
yast2-ftp-server yast2-nfs-server yast2-tftp-server
.
.
.
(11/13) Installing: samba-winbind-32bit-4.1.12-2.1 ..............................[done]
(12/13) Installing: nfs-client-1.3.0-4.2.1 ......................................[done]
Additional rpm output:
Updating /etc/sysconfig/nfs...
setting /sbin/mount.nfs to root:root 4755. (wrong permissions 0755)
(13/13) Installing: nfs-kernel-server-1.3.0-4.2.1 ...............................[done]
To install and remove package simultaneously
To install ' nano' package and remove the ' vi' package, run the following command.
linuxhelp:~ # zypper install nano -vi Loading repository data... Reading installed packages... ' -vi' not found in package names. Trying capabilities. Resolving package dependencies... The following 2 NEW packages are going to be installed: nano nano-lang The following package is going to be REMOVED: vim The following recommended package was automatically selected: nano-lang 2 new packages to install, 1 to remove. Overall download size: 550.0 KiB. Already cached: 0 B After the operation, 463.3 KiB will be freed. Continue? [y/n/? shows all options] (y): y Retrieving package nano-2.3.6-1.1.x86_64 (1/2), 317.2 KiB (982.2 KiB unpacked) Retrieving: nano-2.3.6-1.1.x86_64.rpm .............................[done (292.5 KiB/s)] Retrieving package nano-lang-2.3.6-1.1.noarch (2/2), 232.8 KiB ( 1.2 MiB unpacked) Retrieving: nano-lang-2.3.6-1.1.noarch.rpm ........................[done (325.7 KiB/s)] Checking for file conflicts: ....................................................[done] (1/3) Removing vim-7.4.461.hg.6253-1.5 ..........................................[done] (2/3) Installing: nano-2.3.6-1.1 ................................................[done] (3/3) Installing: nano-lang-2.3.6-1.1 ...........................................[done]
To install a rpm package
linuxhelp:/home/user1 # zypper install teamviewer_11.0.57095.i686.rpm
Loading repository data...
Reading installed packages...
Resolving package dependencies...
.
.
.
(17/22) Installing: libXext6-32bit-1.3.3-2.1.2 ..................................[done]
(18/22) Installing: libXdamage1-32bit-1.1.4-8.1.2 ...............................[done]
(19/22) Installing: libXtst6-32bit-1.2.2-4.1.2 ..................................[done]
(20/22) Installing: libXrandr2-32bit-1.4.2-4.1.2 ................................[done]
(21/22) Installing: libXinerama1-32bit-1.1.3-4.1.2 ..............................[done]
(22/22) Installing: teamviewer-11.0.57095-0 .....................................[done]
To Remove a Package
Use ‘ zypper remove‘ or ‘ zypper rm‘ commands to remove any package.
linuxhelp:~ # zypper remove teamviewer Loading repository data... Reading installed packages... Resolving package dependencies... The following package is going to be REMOVED: teamviewer 1 package to remove. After the operation, 184.5 MiB will be freed. Continue? [y/n/? shows all options] (y): y (1/1) Removing teamviewer-11.0.57095-0 ..........................................[done] Additional rpm output: Clearing assignments ... Done
To Update all packages
Use ‘ zypper update‘ or ‘ zypper up‘ to update all packages.
linuxhelp:~ # zypper update
Loading repository data...
Reading installed packages...
The following 727 package updates will NOT be installed:
aaa_base aaa_base-extras adwaita-icon-theme aisleriot alsa-utils
apparmor-abstractions apparmor-docs apparmor-parser apparmor-profiles apparmor-utils
.
.
.
Retrieving package yast2-inetd-doc-3.1.9-1.2.noarch
(1/1), 302.3 KiB ( 1.3 MiB unpacked)
Retrieving: yast2-inetd-doc-3.1.9-1.2.noarch.rpm ..................[done (213.7 KiB/s)]
Checking for file conflicts: ....................................................[done]
(1/1) Installing: yast2-inetd-doc-3.1.9-1.2 .....................................[done]
To update particular packages.
linuxhelp:~ # zypper update nano
Loading repository data...
Reading installed packages...
No update candidate for ' nano-2.3.6-1.1.x86_64' . The highest available version is already installed.
Resolving package dependencies...
Nothing to do.
You may use ‘ zypper source-install‘ or ‘ zypper si‘ commands to build packages from source.
To install source packages and also build their dependencies.
linuxhelp:~ # zypper si apache2
Reading installed packages...
Loading repository data...
Resolving package dependencies...
The following 27 NEW packages are going to be installed:
autoconf automake libapr1 libapr1-devel libapr-util1 libapr-util1-devel libcap-devel
libdb-4_8-devel libexpat-devel libopenssl-devel libpcrecpp0 libpcreposix0
.
.
.
(23/28) Installing: libapr-util1-devel-1.5.3-2.1.4 ..............................[done]
(24/28) Installing: pcre-devel-8.35-3.2.3 .......................................[done]
(25/28) Installing: automake-1.13.4-5.1.2 .......................................[done]
(26/28) Installing: readline-devel-6.2-75.3.1 ...................................[done]
(27/28) Installing: libxml2-devel-2.9.1-7.2.1 ...................................[done]
To install only the source for a package.
linuxhelp:~ # zypper install -D apache2 Loading repository data... Reading installed packages... Resolving package dependencies... The following 4 NEW packages are going to be installed: apache2 apache2-mod_dnssd apache2-prefork apache2-utils The following recommended package was automatically selected: apache2-prefork 4 new packages to install. Overall download size: 1.4 MiB. Already cached: 0 B After the operation, additional 4.4 MiB will be used. Continue? [y/n/? shows all options] (y): y
To install only the build dependencies for a package.
linuxhelp:~ # zypper si -D apache2 Reading installed packages... Loading repository data... Resolving package dependencies... Continue? [y/n/? shows all options] (y): y Installing source package apache2-2.4.10-28.1 Source package apache2-2.4.10-28.1 successfully installed.
To install a Package without user interaction
linuxhelp:~ # zypper --non-interactive install mariadb Loading repository data... Reading installed packages... Resolving package dependencies... The following 5 NEW packages are going to be installed: libmysqlcppconn6 libreoffice-base-drivers-mysql mariadb mariadb-client mariadb-errormessages 5 new packages to install. Overall download size: 9.4 MiB. Already cached: 0 B After the operation, additional 95.2 MiB will be used. Continue? [y/n/? shows all options] (y): y Retrieving package libmysqlcppconn6-1.1.2-6.2.2.x86_64 (1/5), 165.0 KiB (668.6 KiB unpacked) Retrieving: libmysqlcppconn6-1.1.2-6.2.2.x86_64.rpm ................[done (74.0 KiB/s)] Retrieving package mariadb-errormessages-10.0.13-2.3.2.x86_64 (2/5), 177.2 KiB ( 1.9 MiB unpacked) Retrieving: mariadb-errormessages-10.0.13-2.3.2.x86_64.rpm ........[done (236.1 KiB/s)] Retrieving package libreoffice-base-drivers-mysql-4.3.2.2-1.3.x86_64 (3/5), 397.6 KiB ( 1.0 MiB unpacked) Retrieving: libreoffice-base-drivers-mysql-4.3.2.2-1.3.x86_64.rpm .[done (247.1 KiB/s)] Retrieving package mariadb-client-10.0.13-2.3.2.x86_64 (4/5), 921.1 KiB ( 19.8 MiB unpacked) Retrieving: mariadb-client-10.0.13-2.3.2.x86_64.rpm ...............[done (186.3 KiB/s)] Retrieving package mariadb-10.0.13-2.3.2.x86_64 (5/5), 7.8 MiB ( 71.8 MiB unpacked) Retrieving: mariadb-10.0.13-2.3.2.x86_64.rpm ......................[done (445.9 KiB/s)] Checking for file conflicts: ....................................................[done] (1/5) Installing: libmysqlcppconn6-1.1.2-6.2.2 ..................................[done] (2/5) Installing: mariadb-errormessages-10.0.13-2.3.2 ...........................[done] (3/5) Installing: libreoffice-base-drivers-mysql-4.3.2.2-1.3 ....................[done] (4/5) Installing: mariadb-client-10.0.13-2.3.2 ..................................[done] (5/5) Installing: mariadb-10.0.13-2.3.2 .........................................[done] Update notifications were received from the following packages: mariadb-10.0.13-2.3.2.x86_64 (/var/adm/update-messages/mariadb-10.0.13-2.3.2) View the notifications now? [y/n] (n): n
To remove a Package without user interaction
linuxhelp:~ # zypper --non-interactive remove mariadb Loading repository data... Reading installed packages... Resolving package dependencies... The following package is going to be REMOVED: mariadb 1 package to remove. After the operation, 71.8 MiB will be freed. Continue? [y/n/? shows all options] (y): y (1/1) Removing mariadb-10.0.13-2.3.2 ............................................[done]
To clean zypper cache
If you would like to clean zypper cache, use the following command.
linuxhelp:~ # zypper clean
All repositories have been cleaned up.
To clean metadata and package cache.
linuxhelp:~ # zypper clean -a
All repositories have been cleaned up.
In order to view logs of any installed, updated or removed packages via zypper, run the following command. The location of log file is /var/log/zypp/history, you may use cat or any filters to get a custom output.
linuxhelp:~ # cat /var/log/zypp/history
2014-10-26 09:03:53|radd |InstallationImage|file:/usr/src/packages/BUILD/openSUSE-images-13.1/gnome_cd/home/rpmdir|
2014-10-26 09:03:57|install|at-spi2-atk-common|2.14.1-1.1|x86_64|root@opensuse|InstallationImage|6a8f519b4d72377a3ca977d5ccc025af61b07ddf5ed013b77755979bf85e8dd4|
2014-10-26 09:03:57|install|boost-license1_54_0|1.54.0-10.1.3|noarch|root@opensuse|InstallationImage|7987fbd4abb02f57022f3cc647864a58393508dbcead2f7a6da58cbb9b7baebd|
.
.
.
2016-06-18 01:18:24|install|mariadb|10.0.13-2.3.2|x86_64|root@linuxhelp|repo-oss|094fea241e802fc6981074a7ff1604799c86bcba|
# 2016-06-18 01:18:24 New update message /var/adm/update-messages/mariadb-10.0.13-2.3.2
# 2016-06-18 01:18:24 Error sending update message notification.
2016-06-18 01:19:43|remove |mariadb|10.0.13-2.3.2|x86_64|root@linuxhelp|
To Upgrade Suse Using Zypper
Using ‘ dist-upgrade‘ option along with zypper command helps you to upgrade your current Suse Linux to the latest version.
linuxhelp:~ # zypper dist-upgrade
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.
Building repository ' openSUSE-13.2-0' cache .....................................[done]
Retrieving repository ' openSUSE-13.2-Non-Oss' metadata ..........................[done]
Building repository ' openSUSE-13.2-Non-Oss' cache ...............................[done]
.
.
.
(1/7) Installing: AdobeICCProfiles-2.0-152.1.2 ..................................[done]
(2/7) Installing: unrar-5.1.7-2.1.2 .............................................[done]
(3/7) Installing: gnucash-docs-2.6.4-1.1 ........................................[done]
(4/7) Installing: poppler-data-0.4.7-1.2 ........................................[done]
(5/7) Installing: gstreamer-fluendo-mp3-21-5.3.1 ................................[done]
(6/7) Installing: flash-player-11.2.202.626-2.100.1 .............................[done]
(7/7) Installing: flash-player-gnome-11.2.202.626-2.100.1 .......................[done]
Comments ( 0 )
No comments available