SuSE package manager, zypper

I have recently acquainted with SuSE linux, and I looked for package manager that I can use to manage software packages. I've 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 package manager such as zypper, you'll have tell zypper where to grab the necessary package files. Repositories provide binary packages that you can download and install with 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.

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

Tags: 

Comments

Add new comment

Filtered HTML

  • Web page addresses and e-mail addresses turn into links automatically.
  • Allowed HTML tags: <a> <em> <strong> <cite> <blockquote> <code> <ul> <ol> <li> <dl> <dt> <dd>
  • Lines and paragraphs break automatically.

Plain text

  • No HTML tags allowed.
  • Web page addresses and e-mail addresses turn into links automatically.
  • Lines and paragraphs break automatically.