How to manage packages in openSUSE with Zypper

With Zypper, you can perform several functions from package installation to uninstallation using the command line. Here's how you can use Zypper and its command line options to manage packages in openSUSE.

Every Linux distribution has a default package manager to manage packages. Similar to APT on Debian, Pacman on Arch Linux, and DNF/YUM on RHEL, openSUSE comes with the Zypper package manager.

With Zypper, you can perform several functions from package installation to uninstallation using the command line. Here's how you can use Zypper and its command line options to manage packages in openSUSE.

Package management in openSUSE

Zypper is an easy command-line tool for package management in openSUSE, allowing you to install, remove, and update packages and manage repositories. Additionally, you can list installed packages and available updates, search for a package, and print information about the package.

openSUSE uses the RPM package format. RPM packages typically contain the package name, version, and architecture. There are two command-line ways to manage RPM packages in openSUSE: Zypper and RPM.

Note : You must have root access to install, upgrade, or remove any packages in your openSUSE system.

Add repository in openSUSE

To add a repository in openSUSE, you will need to provide the repository URL and alias. Alias ​​is a short, easy-to-remember name for a repository. Open terminal and run Zypper with the ar (addrepo) command to add the repository to your system:

zypper ar -f 

For example, to add the Skype repository, run:

zypper ar -f https://repo.skype.com/rpm/stable skype

The -f option enables automatic refresh.

Delete the archive using Zypper

To remove a repository in openSUSE, use Zypper with the rr command (removerepo) and alias the repository as follows:

 

zypper rr 

For example, to delete the Skype archive, the command would be:

zypper rr skype

Refresh the archive with Zypper

To refresh the repository manually, run:

zypper refresh

This command allows you to fetch package changes from the configured repository.

List all repositories in openSUSE

To list all defined repositories, use Zypper with the repos or lr method:

zypper lr

This command displays information about repositories such as their name and status (enabled or disabled).

Install packages in openSUSE with Zypper

To install a package, use the zypper command, followed by the print method (install) and the package name:

zypper in package_name

For example, to install Skype on openSUSE, the command would be:

zypper in skypeforlinux

You can also install multiple packages at once by providing a space-separated list of package names:

zypper in package1 package2 package3

Search for packages with Zypper

By default, Zypper searches for a package in all repositories, i.e. both in the list of installed packages and among those that are not installed. To search for a specific package in all repositories, use the se (search) command with Zypper:

zypper se package_name

Use the -s option to view detailed package information:

zypper se -s package_name

How to manage packages in openSUSE with Zypper Picture 1How to manage packages in openSUSE with Zypper Picture 1

 

To search for a package only in the list of installed packages, use:

zypper se -i package_name

List installed packages in openSUSE

With Zypper, you can also query the package database to discover what is currently installed on your openSUSE system. To do this, use Zypper with -i (--installed-only) :

zypper se -i

You can also save this list by redirecting its output to a file:

zypper se -i > installed_packages

To find detailed information about a specific installed package, use:

zypper info package_name

How to manage packages in openSUSE with Zypper Picture 2How to manage packages in openSUSE with Zypper Picture 2

Remove packages in openSUSE using Zypper

Removing a package with Zypper is as easy as installing it. To remove a package you don't need anymore, use Zypper with the rm (remove) method and the package name:

zypper rm package_name

Update packages with Zypper

Keeping packages up to date is the most common package management practice. Using Zypper, you can view and install all available updates. Run the following to see all available updates for installed packages:

zypper list-updates

Once you have the list, you now have the option to update all packages or just a single package. To update all installed packages that have any newer versions available, use the up (update) command :

zypper up

To update individual packages, specify the package with the update or install command:

zypper up package_name

Or:

zypper install package_name

Install packages locally in openSUSE using RPM

For local RPM packages that you downloaded manually, you can use the RPM or Zypper utility to install them. Use the following format to install it using RPM:

rpm -Uvh rpm_package

To install an RPM package using Zypper, use:

zypper install rpm_package

There are several other command line options you can use with Zypper to complete various tasks. You can see all the options with the help command:

 

zypper help
5 ★ | 2 Vote