SuSE package manager, zypper

I have recently acquainted with SuSE Linux, and I looked for a package manager that I can use to manage software packages. I started out with Yast, but it wasn't very good at providing resolutions to dependency problems. Someone recommended Zypper over Yast and yast2, so here I am sharing my experience with Zypper.

What is Zypper?

Here is the definition of Zypper from Zypper Portal. Zypper is a command line package manager, which makes use of libzypp, providing functions like repository access, dependency solving, package installation, etc. YaST2 and RPM MetaData package repositories are supported. Zypper repositories are similar to the ones used in YaST, which also makes use of libzypp. Zypper can also handle repository extensions like patches, patterns, and products.

Manage Repositories

When working with a package manager such as zypper, you'll have to tell zipper where to grab the necessary package files. Repositories provide binary packages that you can download and install with a package manager like zypper. Here is the official Open SuSE repositories.

You must use the "root" user to manage repositories, packages, and rpm files.

To LIST repositories that are currently configured:

% zypper lr
# | Alias | Name | Enabled | Refresh
--+-------+------+---------+--------
1 | Geo   | Geo  | Yes     | No
2 | oss   | oss  | Yes     | No

To ADD a repository

Syntax: zypper ar URL name

# zypper ar http://download.opensuse.org/distribution/11.4/repo/oss/ OSS

To REMOVE a repository

Syntax: zypper rr name

Note: you can also remove a repository by the repo number from the zypper lr output. (see above)

# zypper rr OSS # zypper rr 2

By default, when a repository is added the newly added repository is automatically enabled.

To DISABLE a repository

Syntax: zypper mr -d {Name of Repository}

# zypper mr -d OSS

To ENABLE a repository

Syntax: zypper mr -e {Name of Repository}

# zypper mr -e OSS

To RENAME a repository:

Syntax: zypper nr {Old Name} {New Name}

# zypper nr OSS NONOSS

You may also export the repositories that are currently defined in your system.

Syntax: zypper lr -export {repo filename}

# zypper lr -export /root/export.repo

Your may restore ("import") the repositories from the exported repository file.

Syntax: zypper ar {repo filename}

# zypper ar /root/export.repo

Command Reference:

zypper repos – List current repositories.
zypper refresh – Refresh repositories.
zypper addrepo url repository – Add a new repository
zypper removerepo url repository – Remove a repository.

Manage Packages

Once you have one or more repositories configured, you may install or remove packages.

To INSTALL one or more packages from repositories

Syntax: zypper {install|in} :repositoy name}:{name of packages}

# zypper install php apache mysql # zypper install OSS:postgresql

To REMOVE one or more packages from repositories

Syntax: zypper {remove|rm} {name of packages}

# zypper remove php apache

Command Reference:

zypper in{stall} {package} – Install or Update packages on OpenSUSE
zypper in{stall} {package-version} – Use this to install a specific version of a package.
zypper in{stall} {package} {-package} {+package} – you can install and remove multiple packages at the same time using the + – switches.
zypper in{stall} -force {package} – This will force the installation or re-installation of a package.
zypper in{stall} {rpm-file} – You can use this to install rpm files.
zypper {rm|remove} {package} – Use this to remove packages from your system.
zypper {rm|remove} {package-version} – Use this to remove older versions of the specified package.
zypper {source-install|si} {package} – Install source packages.
zypper up{date} – Update all of the packages on your system.
zypper up{date} {package} – Update an individual package.
zypper dup – Update all packages, and upgrade your distribution if a newer version is available.
zypper help – Display the Zypper help files.
zypper info package – Get info about the specified package.

Conclusion

The exploration of Zypper as a robust command-line package manager for SuSE Linux reveals its efficiency and flexibility. The article serves as a practical guide, emphasizing the importance of Zypper in overcoming dependency issues and offering a superior alternative to Yast. From repository management to package installation and removal, the comprehensive command references provide users with the tools to navigate Zypper effectively. Whether installing specific versions, handling multiple packages simultaneously, or updating the entire system, Zypper proves to be a versatile and powerful tool in the SuSE Linux ecosystem. For those seeking a reliable package manager, Zypper emerges as a valuable asset, streamlining the software management process on SuSE Linux systems.

For more information, please visit OpenSuSE zypper(8) manpage.

Share this post

Comments (0)

    No comment

Leave a comment

All comments are moderated. Spammy and bot submitted comments are deleted. Please submit the comments that are helpful to others, and we'll approve your comments. A comment that includes outbound link will only be approved if the content is relevant to the topic, and has some value to our readers.


Login To Post Comment