SuSE Linux Enterprise Server (SLES) package management demystified
-------------------------------------------------------------------

Author: Leo Eraly  - leo@unstable.be

This is the first part of a document about package management on SLES

Quite often I get questions about installing software and managing
packages on a SLES system.
That's why I decided to gather some bits about how the software
management system works.


Package management
-------------------

A package management is a system (collection of tools) that allow a
user to manage the installed software on a machine. By managing we
mean: installing, upgrading, removing, configuring,... of software.
This software is mostly delivered under the form of a package.

A package is an archive that contains all the necessary bits and
pieces that are required by a piece of software. Usually this includes
the binaries, configuration files, documentation, and if needed some
post and pre install scripts. Next to that a package also contains
important information such as the name ,version, checksums, change
logs, etc...
Depending of the content of a package, it can be made available for a
specific architecture (i586 , x86_64) or for any architecture (noarch)

A package could also depend on other packages, this means that a
package requires certain software that is provided by another package.
This is called dependencies.

Repository
----------

A repository is a collection of packages that can be installed. It can
be made available via different sources like http, ftp, dvd, local
directory, ...
A repository stores all packages and also contains some meta data with
information about everything that is available from the repository. 
Possible repository meta data formats are:

	1.repomd/yum
	The metadata is stored in gzipped XML files in a repodata directory.
	This repodata directory contains following files
		repomd.xml
		primary.xml.gz
		filelists.xml.gz
		other.xml.gz

	For extra security this data can also be signed by using a
	private/public key infrastructure.
	http://en.opensuse.org/Standards/Rpm_Metadata

	2.Yast repository metadata
	The metadata is stored in 2 flat files.
		content
		media.1/media
	This information could also be signed.
	This is the format that is currently still used by the CD/DVD
	installation
	http://en.opensuse.org/Standards/YaST2_Repository_Metadata

RPM
----

SuSE is using the RPM package management system. RPM stands for Red
hat Package Manager.
The packages that are used by RPM are typically called RPM packages. 
e.g aspell-mk-0.50-19.2.i586.rpm

All information related to packages that are installed on a system is
stored in a database, the RPM database. It's located under
/var/lib/rpm and is made up out of different files. 
RPM uses Berkeley DB files to store it's information. Every time you
install, remove, update, ... a package this database is updated with
the new information.

These files are vital to your system and therefore a cron job to
backup this DB is automatically installed on a SuSE system.

Libzypp
--------

libzypp is a software management engine that contains powerful
dependency resolver. This is needed because RPM itself cannot
determine these dependencies, it will only complain if a certain
dependency is missing when installing software but it's unable to
install those dependencies automatically.

Therefore it's normally up to the front ends that are built on top of
RPM to solve this kind of stuff. Examples of such a front ends are
smart and apt-get. The major disadvantage is that every front end has
to solve this itself often with mixed results. That's why Novell
decided to create a library to resolve these issues called libzypp.
It's a combination of Ximian's libredcarpet and the package manager
that's in Yast. This gives some advantages like better resolving and
the fact that different front ends no longer need to implement
resolving
libzypp is currently capable to support the following meta data
standards. repomd/yum , yast format
 
libzypp will call rpm to execute the actual actions like installing,
removing, upgrading,... It's important to understand that libzypp
works on top of RPM, it's not replacing RPM in any way.

http://en.opensuse.org/Libzypp

ZMD
----

ZMD is the abbreviation for Zenworks Linux Management Daemon. It's a
back-end daemon that is responsible for performing software
management. It's build on top of libzypp so it's using the resolving
mechanisms inside libzypp. ZMD is written in C# and requires mono to
run.

ZMD has it's own SQLite database (/var/lib/zmd/zmd.db)  to store all
necessary information.

http://en.opensuse.org/Zmd

RUG
----

Rug is the command line front end to ZMD. It does nothing more than
telling ZMD to exeute certain actions.

http://en.opensuse.org/Using_rug

Zypper
-------

Zypper is a command line package manager that is also built on top of
libzypp. It does not require ZMD and has it's own database
(/var/lib/zypp). It's backwards compatible with RUG.

http://en.opensuse.org/Zypper