Zypper Commands To Manage Packages in SUSE

We show you different commands to manage packages in SUSE Linux using Zypper.

SUSE is an operating system focused on organizational management providing multiple options for performance, reliability, scalability, and development.

In its edition SUSE Linux Enterprise Edition we will have at hand a variety of business applications and features suitable for everything related to a production environment and in version 12 we find unique features of this great system.

Zypper Help Commands

When we run zypper without any parameters, the result will be a list of all the global options and commands to use:

If we want to get help on a specific command, enter ‘in' (install), and execute the following commands:

zypper help in
zypper help install

Another useful option is to look for a particular package before its installation, in this case, we execute the following syntax:

zypper se “Package_Name”

Get detailed information about a pattern package we must use the following command:

zypper info -t pattern (package)

To access the Zypper Shell and run the session from there, we can use any of the following options:

zypper shell
zypper sh

To exit this Shell session, we execute exit.

Zypper Repository Management

It is possible to use the commands zypper repos or zypper lr to list all the repositories defined in SUSE:

We can see this same result with your URI:

zypper lr -u

If we want to look at them in order of priority we will execute:

zypper lr -p

To update the repositories in SUSE Linux, we have some of the following options:

zypper refresh
zypper ref

How To Modify a Repository

In SUSE Linux zypper we can use the commands modifyrepo or zypper mr to disable or enable Zypper repositories.

Before disabling the selected repository, we must know that in Zypper, each repository has its unique number, which is used to disable or enable a repository.

To see this number we execute zypper lr. There, as we see, there are 3 repositories.

To disable a repository in SUSE, we will execute the following syntax:

zypper mr -d (ID)

Now, to enable a repository, we run the following:

zypper mr -e (ID)

To add a new repository in SUSE Linux, let's execute the following syntax_

zypper ar (Repository_Path)

For example, to add the Apache repository we run:

zypper ar http://download.opensuse.org/repositories/Apache/SLE_12_SP3/Apache.repo

If we want to rename a repository, we are going to use the following syntax:

zypper nr (ID Repo) "New name"

To delete a SUSE repository, we must know its name and execute the following:

zypper rr (Repository Name)

Useful Ways to Manage Packages with Zypper

With Zypper we can carry out some tasks on the packages in SUSE Linux.

To install a new package based on its name, for example, to install a package such as Mozilla Firefox we will execute the following:

zypper in MozillaFirefox

With Zypper we have several alternatives to install packages like:

Using the version

zypper in 'gcc <5.1'

Using its architecture

zypper in gcc.i386

Specifying the repository

zypper in amarok upd:libxine1

Using wildcards

zypper in php5*

Install and delete a package simultaneously:

zypper in nano -vi

Install an rpm package:

zypper in teamviewer*.rpm

To remove a package with Zypper, just execute the following:

zypper rm "package"

To update the packages using Zypper we can run any of the following options:

zypper up
zypper update

Clear the Zypper cache:

zypper clean

If we want to clean metadata and cache all the packages in a single command, it is possible to use -all / -a:

zypper clean -a

To see the records of any package that has been installed, updated or deleted through Zypper, it is registered in the /var/log/zypp/ history directory; we can execute the following:

cat /var/log/zypp/history

In addition to this, Zypper gives us the opportunity to update the operating system with the execution of the following command:

zypper dist-upgrade

In this way, Zypper is a package and repository manager in SUSE.

Similar Posts

Leave a Reply

Your email address will not be published. Required fields are marked *