20 Zypper Command Examples to Manage Packages on SUSE Linux

Suse-Azure.png

yum is for CentOS and Redhat.

apt-get is for Debian and Ubuntu.

In the same way, zypper is for SUSE Linux.

Zypper is a command line tool for package management in OpenSUSE and SUSE Enterprise Linux platforms.

On a high-level, you can manage two different things using zypper command:

  1. Manage Packages: Zypper is used to install, remove, update and query the software packages of local or remote media.
  2. Manage Repositories: Zypper also has the ability to work with repositories. You can add, remove, enable or disable repositories from command line. It also has the ability to prioritize your repositories during installation process.

I. Manage Packages using Zypper

1. Install a Package using zypper

To install a package using zypper command, use the following syntax:

zypper install <package Name>

For example, to install the Mozilla firefox and all its dependencies, execute the following:

# zypper install MozillaFirefox Loading repository data... Reading installed packages... Resolving package dependencies... The following NEW packages are going to be installed: MozillaFirefox MozillaFirefox-branding-SLED The following packages are not supported by their vendor: MozillaFirefox MozillaFirefox-branding-SLED 2 new packages to install. Overall download size: 964.0 KiB. After the operation, additional 3.4 MiB will be used. Continue? [y/n/?] (y): y Retrieving package MozillaFirefox-3.6.16-0.2.1.x86_64 (1/2), 949.0 KiB (3.4 MiB 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 (2/2), 15.0 KiB (34.0 KiB unpacked) Retrieving: MozillaFirefox-branding-SLED-3.5-1.1.5.x86_64.rpm [done] Installing: MozillaFirefox-branding-SLED-3.5-1.1.5 [done]

2. Install Source Package

To install source package in a repository, use the source-install option as shown below.

# zypper source-install apache2-mod_nss Reading installed packages... Loading repository data... Resolving package dependencies... Retrieving package mozilla-nss-devel-3.12.8-1.2.1.x86_64 (2/3), 473.0 KiB (2.6 MiB 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 a Package

Once a package is installed, you can upgrade it to a new version when it becomes available using the update command as shown below.

The following will upgrade only MozillaFirefox package.

zypper update MozillaFirefox

The following will upgrade all the packages on your system to the latest version.

zypper update

You can also view all the available updates using the list-updates option as shown below.

zypper list-updates

4. System Wide Full Distribution Upgrade

To perform a full distribution upgrade on the system, use the dup option along with zypper as shown below:

# zypper dup 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. Loading repository data... Reading installed packages... Computing distribution upgrade... The following NEW packages are going to be installed: drbd-xen libsoftokn3-32bit mozilla-nspr-32bit mozilla-nss-32bit mozilla-nss-certs-32bit suseRegister xen yast2-registration yast2-registration-branding-SLE The following packages are going to be upgraded: libfreebl3-32bit libnsssharedhelper0 libnsssharedhelper0-32bit The following packages are going to change vendor: libfreebl3-32bit SUSE LINUX Products GmbH, Nuernberg, Germany -> openSUSE Build Service libnsssharedhelper0 SUSE LINUX Products GmbH, Nuernberg, Germany -> openSUSE Build Service libnsssharedhelper0-32bit SUSE LINUX Products GmbH, Nuernberg, Germany -> openSUSE Build Service

5. Delete a Package

To remove a package, use the remove option as shown below. This will also remove all the depedencies.

# zypper remove MozillaFirefox Loading repository data... Reading installed packages... Resolving package dependencies... The following packages are going to be REMOVED: MozillaFirefox MozillaFirefox-branding-SLED 2 packages to remove. After the operation, 3.4 MiB will be freed. Continue? [y/n/?] (y): y Removing MozillaFirefox-branding-SLED-3.5-1.1.5 [done] Removing MozillaFirefox-3.6.16-0.2.1 [done]

6. Search for a Specific Package

To search for a package from a repository use the following command. You can also use wild card in the keyword.

In this example, it will search for all packages that starts with the keyword “usb”.

# zypper search usb* Loading repository data... Reading installed packages... S | Name | Summary | Type --+

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Google+ photo

You are commenting using your Google+ account. Log Out / Change )

Connecting to %s