ACC SHELL
<html><head><meta http-equiv="Content-Type" content="text/html; charset=ISO-8859-1"><title>Chapter 7. Managing Software with Command Line Tools</title><link rel="stylesheet" href="susebooks.css" type="text/css"><meta name="generator" content="DocBook XSL Stylesheets V1.75.2"><link rel="home" href="index.html" title="Documentation"><link rel="up" href="part.reference.software.html" title="Part II. Managing and Updating Software"><link rel="prev" href="cha.add-ons.html" title="Chapter 6. Installing Add-On Products"><link rel="next" href="part.reference.administration.html" title="Part III. Administration"></head><body bgcolor="white" text="black" link="#0000FF" vlink="#840084" alink="#0000FF"><div class="navheader"><table width="100%" summary="Navigation header" border="0" class="bctable"><tr><td width="80%"><div class="breadcrumbs"><p><a href="index.html"> Documentation</a><span class="breadcrumbs-sep"> > </span><a href="book.opensuse.reference.html">Reference</a><span class="breadcrumbs-sep"> > </span><a href="part.reference.software.html">Managing and Updating Software</a><span class="breadcrumbs-sep"> > </span><strong><a accesskey="p" title="Chapter 6. Installing Add-On Products" href="cha.add-ons.html"><span>◀</span></a> </strong></p></div></td></tr></table></div><div class="chapter" title="Chapter 7. Managing Software with Command Line Tools"><div class="titlepage"><div><div><h2 class="title"><a name="cha.sw_cl"></a>Chapter 7. Managing Software with Command Line Tools<span class="permalink"><a alt="Permalink" title="Copy Permalink" href="#cha.sw_cl">¶</a></span></h2></div></div></div><div class="toc"><p><b>Contents</b></p><dl><dt><span class="sect1"><a href="cha.sw_cl.html#sec.zypper">7.1. Using Zypper</a></span></dt><dt><span class="sect1"><a href="cha.sw_cl.html#sec.rpm">7.2. RPM—the Package Manager</a></span></dt></dl></div><a class="indexterm" name="id442955"></a><div class="abstract" title="Abstract"><p class="title"><b>Abstract</b></p><p>
This chapter describes Zypper and RPM, two command line tools for
managing software. For a definition of the terminology used in this
context (for example, <code class="literal">repository</code>,
<code class="literal">patch</code>, or <code class="literal">update</code>) refer to
<a class="xref" href="cha.y2.sw.html#sec.onlineupdate.terms" title="3.1. Definition of Terms">Section 3.1, “Definition of Terms”</a>.
</p></div><div class="sect1" title="7.1. Using Zypper"><div class="titlepage"><div><div><h2 class="title" style="clear: both"><a name="sec.zypper"></a>7.1. Using Zypper<span class="permalink"><a alt="Permalink" title="Copy Permalink" href="#sec.zypper">¶</a></span></h2></div></div></div><a class="indexterm" name="idx.zypper"></a><a class="indexterm" name="id443007"></a><a class="indexterm" name="id443014"></a><p>
Zypper is a command line package manager for installing, updating and
removing packages as well as for managing repositories.
It is especially useful for accomplishing remote software management tasks
or managing software from shell scripts.
</p><div class="sect2" title="7.1.1. General Usage"><div class="titlepage"><div><div><h3 class="title"><a name="sec.zypper.usage"></a>7.1.1. General Usage<span class="permalink"><a alt="Permalink" title="Copy Permalink" href="#sec.zypper.usage">¶</a></span></h3></div></div></div><p>
The general syntax of Zypper is:
</p><pre class="screen">zypper <code class="option">[global-options]</code> <em class="replaceable"><code>command</code></em> <code class="option">[command-options]</code> <code class="option">[arguments]</code> ...</pre><p>
The components enclosed in brackets are not required. The simplest way to
execute Zypper is to type its name, followed by a command. For example,
to apply all needed patches to the system type:
</p><pre class="screen">zypper patch</pre><p>
Additionally, you can choose from one or more global options by typing
them just before the command. For example,
<code class="option">--non-interactive</code> means running the command without
asking anything (automatically applying the default answers):
</p><pre class="screen">zypper --non-interactive patch</pre><p>
To use the options specific to a particular command, type them right
after the command. For example,
<code class="option">--auto-agree-with-licenses</code> means applying all needed
patches to the system without asking to confirm any licenses (they will
automatically be accepted):
</p><pre class="screen">zypper patch --auto-agree-with-licenses</pre><p>
Some commands require one or more arguments. When using the install
command, for example, you need to specify which package(s) to install:
</p><pre class="screen">zypper install mplayer</pre><p>
Some options also require an argument. The following command will list
all known patterns:
</p><pre class="screen">zypper search -t pattern</pre><p>
You can combine all of the above. For example, the following command will
install the <code class="systemitem">mplayer</code> and
<code class="systemitem">amarok</code> packages from the
<code class="literal">factory</code> repository while being verbose:
</p><pre class="screen">zypper -v install --from factory mplayer amarok</pre><p>
The <code class="option">--from</code> option makes sure to keep all repositories
enabled (for solving any dependencies) while requesting the package from
the specified repository.
</p><p>
Most Zypper commands have a <code class="literal">dry-run</code> option that does a
simulation of the given command. It can be used for test purposes.
</p><pre class="screen">zypper remove --dry-run MozillaFirefox</pre></div><div class="sect2" title="7.1.2. Installing and Removing Software with Zypper"><div class="titlepage"><div><div><h3 class="title"><a name="sec.zypper.softman"></a>7.1.2. Installing and Removing Software with Zypper<span class="permalink"><a alt="Permalink" title="Copy Permalink" href="#sec.zypper.softman">¶</a></span></h3></div></div></div><p>
To install or remove packages use the following commands:
</p><pre class="screen">zypper install <em class="replaceable"><code>package_name</code></em>
zypper remove <em class="replaceable"><code>package_name</code></em></pre><p>
Zypper knows various ways to address packages for the install and remove
commands:
</p><div class="variablelist"><dl><dt><span class="term">by the exact package name (and version number)</span></dt><dd><pre class="screen">zypper install MozillaFirefox</pre><p>
or
</p><pre class="screen">zypper install MozillaFirefox-3.5.3</pre></dd><dt><span class="term">by repository alias and package name</span></dt><dd><pre class="screen">zypper install mozilla:MozillaFirefox</pre><p>
Where <code class="literal">mozilla</code> is the alias of the repository from
which to install.
</p></dd><dt><span class="term">by package name using wildcards</span></dt><dd><p>
The following command will install all packages that have names
starting with <span class="quote">“<span class="quote">Moz</span>”</span>. Use with care, especially when
removing packages.
</p><pre class="screen">zypper install Moz*</pre></dd><dt><span class="term">by capability</span></dt><dd><p>
For example, if you would like to install a perl module without
knowing the name of the package, capabilities come in handy:
</p><pre class="screen">zypper install 'perl(Time::ParseDate)'</pre></dd><dt><span class="term">by capability and/or architecture and/or version</span></dt><dd><p>
Together with a capability you can specify an architecture (such as
<code class="literal">i586</code> or <code class="literal">x86_64</code>) and/or a
version. The version must be preceded by an operator:
<code class="literal"><</code> (lesser than), <code class="literal"><=</code>
(lesser than or equal), <code class="literal">=</code> (equal),
<code class="literal">>=</code> (greater than or equal),
<code class="literal">></code> (greater than).
</p><pre class="screen">zypper install 'firefox.x86_64'
zypper install 'firefox>=3.5.3'
zypper install 'firefox.x86_64>=3.5.3'</pre></dd><dt><span class="term">by path to the RPM file</span></dt><dd><p>
You can also specify a local or remote path to a package:
</p><pre class="screen">zypper install /tmp/install/MozillaFirefox.rpm
zypper install http://download.opensuse.org/repositories/mozilla/SUSE_Factory/x86_64/MozillaFirefox-3.5.3-1.3.x86_64.rpm</pre></dd></dl></div><p>
To install and remove packages simultaneously use the
<code class="literal">+/-</code> modifiers. To install
<code class="systemitem">emacs</code> and remove <code class="systemitem">vim</code>
simultaneously, use:
</p><pre class="screen">zypper install emacs -vim
</pre><p>
To remove <code class="systemitem">emacs</code> and install
<code class="systemitem">vim</code> simultaneously, use:
</p><pre class="screen">zypper remove emacs +vim
</pre><p>
To prevent the package name starting with the <code class="literal">-</code> being
interpreted as a command option, always use it as the second argument. If
this is not possible, precede it with <code class="literal">--</code>:
</p><pre class="screen">zypper install -emacs +vim # Wrong
zypper install vim -emacs # Correct
zypper install -- -emacs +vim # same as above
zypper remove emacs +vim # same as above</pre><p>
If (together with a certain package) you automatically want to remove any
packages that become unneeded after removing the specified package, use
the <code class="option">--clean-deps</code> option:
</p><pre class="screen">rm <em class="replaceable"><code>package_name</code></em> --clean-deps</pre><p>
By default, Zypper asks for a confirmation before installing or removing
a selected package, or when a problem occurs. You can override this
behavior using the <code class="option">--non-interactive</code> option. This option
must be given before the actual command (<span class="command"><strong>install</strong></span>,
<span class="command"><strong>remove</strong></span>, and <span class="command"><strong>patch</strong></span>) as in the
following:
</p><pre class="screen">zypper <code class="option">--non-interactive</code> install <em class="replaceable"><code>package_name</code></em></pre><p>
This option allows the use of Zypper in scripts and cron jobs.
</p><div class="warning"><table border="0" cellpadding="3" cellspacing="0" width="100%" summary="Warning: Do not Remove Mandatory System Packages"><tr class="head"><td width="32"><img alt="[Warning]" src="admon/warning.png"></td><th align="left">Do not Remove Mandatory System Packages</th></tr><tr><td colspan="2" align="left" valign="top"><p>
Do not remove packages such as <code class="systemitem">glibc</code>,
<code class="systemitem">zypper</code>, <code class="systemitem">kernel</code>, or
similar packages. These packages are mandatory for the system and, if
removed, may cause the system to become unstable or stop working
altogether.
</p></td></tr></table></div><div class="sect3" title="7.1.2.1. Installing Source Packages"><div class="titlepage"><div><div><h4 class="title"><a name="sec.zypper.softman.sources"></a>7.1.2.1. Installing Source Packages<span class="permalink"><a alt="Permalink" title="Copy Permalink" href="#sec.zypper.softman.sources">¶</a></span></h4></div></div></div><p>
<a class="indexterm" name="id443420"></a> If you want to install the corresponding source package of
a package, use:
</p><pre class="screen">zypper source-install <em class="replaceable"><code>package_name</code></em>
</pre><p>
That command will also install the build dependencies of the specified
package. If you do not want this, add the switch <code class="literal">-D</code>.
To install only the build dependencies use <code class="literal">-d</code>.
</p><pre class="screen">zypper source-install -d <em class="replaceable"><code>package_name</code></em> # source package only
zypper source-install -D <em class="replaceable"><code>package_name</code></em> # build dependencies only</pre><p>
Of course, this will only work if you have the repository with the
source packages enabled in your repository list (it is added by default,
but not enabled). See <a class="xref" href="cha.sw_cl.html#sec.zypper.instrepo" title="7.1.4. Managing Repositories with Zypper">Section 7.1.4, “Managing Repositories with Zypper”</a> for details
on repository management.
</p><p>
A list of all source packages available in your repositories can be
obtained with:
</p><pre class="screen">zypper search -t srcpackage</pre></div><div class="sect3" title="7.1.2.2. Utilities"><div class="titlepage"><div><div><h4 class="title"><a name="sec.zypper.softman.util"></a>7.1.2.2. Utilities<span class="permalink"><a alt="Permalink" title="Copy Permalink" href="#sec.zypper.softman.util">¶</a></span></h4></div></div></div><p>
To verify whether all dependencies are still fulfilled and to repair
missing dependencies, use:
</p><pre class="screen">zypper verify</pre><p>
In addition to dependencies that must be fulfilled, some packages
<span class="quote">“<span class="quote">recommend</span>”</span> other packages. These recommended packages are
only installed if actually available and installable. In case
recommended packages were made available after the recommending package
has been installed (by adding additional packages or hardware), use the
following command:
</p><pre class="screen">zypper install-new-recommends</pre><p>
This command is very useful after plugging in a webcam or WLAN device.
It will install drivers for the device and related software, if
available. Drivers and related software are only installable if certain
hardware dependencies are fulfilled.
</p></div></div><div class="sect2" title="7.1.3. Updating Software with Zypper"><div class="titlepage"><div><div><h3 class="title"><a name="sec.zypper.softup"></a>7.1.3. Updating Software with Zypper<span class="permalink"><a alt="Permalink" title="Copy Permalink" href="#sec.zypper.softup">¶</a></span></h3></div></div></div><p>
There are three different ways to update software using Zypper: by
installing patches, by installing a new version of a package or by
updating the entire distribution. The latter is achieved with the
<span class="command"><strong>zypper dist-upgrade</strong></span> command which is discussed in
<a class="xref" href="cha.update.html#sec.update.suselinux" title="14.1. Upgrading the System">Section 14.1, “Upgrading the System”</a>.
</p><div class="sect3" title="7.1.3.1. Installing Patches"><div class="titlepage"><div><div><h4 class="title"><a name="sec.zypper.softup.patch"></a>7.1.3.1. Installing Patches<span class="permalink"><a alt="Permalink" title="Copy Permalink" href="#sec.zypper.softup.patch">¶</a></span></h4></div></div></div><p>
To install all officially released patches applying to your system, just
run:
</p><pre class="screen">zypper patch</pre><p>
In this case, all patches available in your repositories are checked for
relevance and installed, if necessary. The above command is all you must enter in order to
apply them when needed.
</p><p>
Zypper knows three different commands to query for the availability of
patches:
</p><div class="variablelist"><dl><dt><span class="term"><span class="command"><strong>zypper patch-check</strong></span>
</span></dt><dd><p>
Lists the number of needed patches (patches, that apply to your
system but are not yet installed)
</p><pre class="screen">~ # zypper patch-check
Loading repository data...
Reading installed packages...
5 patches needed (1 security patch)</pre></dd><dt><span class="term"><span class="command"><strong>zypper list-patches</strong></span>
</span></dt><dd><p>
Lists all needed patches (patches, that apply to your system but are
not yet installed)
</p><pre class="screen">
~ # zypper list-patches
Loading repository data...
Reading installed packages...
Repository | Name | Version | Category | Status
------------------------------------+-----------+---------+----------+-------
Updates for openSUSE 11.3 11.3-1.82 | lxsession | 2776 | security | needed
</pre></dd><dt><span class="term"><span class="command"><strong>zypper patches</strong></span>
</span></dt><dd><p>
Lists all patches available for openSUSE, regardless of whether
they are already installed or apply to your installation.
</p></dd></dl></div><p>
It is also possible to list and install patches relevant to specific
issues. To list specific patches, use the <span class="command"><strong>zypper
list-patches</strong></span> command with the following options:
</p><div class="variablelist"><dl><dt><span class="term"><code class="option">--bugzilla[=<em class="replaceable"><code>number</code></em>] </code>
</span></dt><dd><p>
Lists all needed patches for Bugzilla issues. Optionally, you can
specify a bug number if you only want to list patches for this
specific bug.
</p></dd><dt><span class="term"><code class="option">--cve[=<em class="replaceable"><code>number</code></em>]</code>
</span></dt><dd><p>
Lists all needed patches for CVE (Common Vulnerabilities and
Exposures) issues, or only patches matching a certain CVE number, if
specified.
</p></dd></dl></div><p>
To install a patch for a specific Bugzilla or CVE issue, use the
following commands:
</p><pre class="screen">zypper patch --bugzilla=<em class="replaceable"><code>number</code></em></pre><p>
or
</p><pre class="screen">zypper patch --cve=<em class="replaceable"><code>number</code></em> </pre><p>
For example, to install a security patch with the CVE number
<code class="literal">CVE-2010-2713</code>, execute:
</p><pre class="screen">zypper patch --cve=CVE-2010-2713</pre></div><div class="sect3" title="7.1.3.2. Installing Updates"><div class="titlepage"><div><div><h4 class="title"><a name="sec.zypper.softup.update"></a>7.1.3.2. Installing Updates<span class="permalink"><a alt="Permalink" title="Copy Permalink" href="#sec.zypper.softup.update">¶</a></span></h4></div></div></div><p>
If a repository contains only new packages, but does not provide
patches, <span class="command"><strong>zypper patch</strong></span> does not show any effect.
To update all installed packages with newer available versions, use:
</p><pre class="screen">zypper update</pre><p>
To update individual packages, specify the package with either the
update or install command:
</p><pre class="screen">zypper update <em class="replaceable"><code>package_name</code></em>
zypper install <em class="replaceable"><code>package_name</code></em></pre><p>
A list of all new installable packages can be obtained with the command:
</p><pre class="screen">zypper list-updates</pre><p>
Note that this command only packages lists packages that match the
following criteria:
</p><div class="itemizedlist"><ul class="itemizedlist" type="bullet"><li class="listitem" style="list-style-type: disc"><p>
has the same vendor like the already installed package
</p></li><li class="listitem" style="list-style-type: disc"><p>
is provided by repositories with at least the same priority than the
already installed package
</p></li><li class="listitem" style="list-style-type: disc"><p>
is installable (all dependencies are satisfied)
</p></li></ul></div><p>
A list of <span class="emphasis"><em>all</em></span> new available packages (regardless
whether installable or not) can be obtained with:
</p><pre class="screen">zypper list-updates --all</pre><p>
To find out why a new package cannot be installed, just use the
<span class="command"><strong>zypper install</strong></span> or <span class="command"><strong>zypper update</strong></span>
command as described above.
</p></div><div class="sect3" title="7.1.3.3. Upgrading to a New Product Version"><div class="titlepage"><div><div><h4 class="title"><a name="sec.zypper.softup.upgrade"></a>7.1.3.3. Upgrading to a New Product Version<span class="permalink"><a alt="Permalink" title="Copy Permalink" href="#sec.zypper.softup.upgrade">¶</a></span></h4></div></div></div><p>
To easily upgrade your installation to a new product version
<span>(for example, from openSUSE 11.2 to openSUSE
11.3)</span>, first adjust your repositories to match the
current openSUSE repositories. For details, refer to
<a class="xref" href="cha.sw_cl.html#sec.zypper.instrepo" title="7.1.4. Managing Repositories with Zypper">Section 7.1.4, “Managing Repositories with Zypper”</a>. Then use the <span class="command"><strong>zypper
dist-upgrade</strong></span> command with the required repositories. This
command ensures that all packages will be installed from the
repositories currently enabled. For detailed instructions, refer to
<a class="xref" href="cha.update.html#sec.update.zypper" title="14.1.4. Distribution Upgrade with zypper">Section 14.1.4, “Distribution Upgrade with zypper”</a>.
</p><p>
To restrict the distribution upgrade to packages from a certain
repository while considering also the other repositories for satisfying
dependencies, use the <code class="option">--from</code> option and specify the
repository by either its alias, its number or URI.
</p><div class="note"><table border="0" cellpadding="3" cellspacing="0" width="100%" summary="Note: Differences between zypper update and zypper dist-upgrade"><tr class="head"><td width="32"><img alt="[Note]" src="admon/note.png"></td><th align="left">Differences between <span class="command"><strong>zypper update</strong></span> and <span class="command"><strong>zypper dist-upgrade</strong></span></th></tr><tr><td colspan="2" align="left" valign="top"><p>
Choose <span class="command"><strong>zypper update</strong></span> to update packages to newer
versions available for your product version while maintaining system
integrity. <span class="command"><strong>zypper update</strong></span> will honor the following
rules:
</p><table border="0" summary="Simple list" class="simplelist"><tr><td>no vendor changes</td></tr><tr><td>no architecture changes</td></tr><tr><td>no downgrades</td></tr><tr><td>keep installed packages</td></tr></table><p>
When executing <span class="command"><strong>zypper dist-upgrade</strong></span>, all packages
will be installed from the repositories currently enabled. This rule is
enforced, so packages might change vendor or architecture or even might
get downgraded. All packages that have unfulfilled dependencies after
the upgrade will be uninstalled.
</p></td></tr></table></div></div></div><div class="sect2" title="7.1.4. Managing Repositories with Zypper"><div class="titlepage"><div><div><h3 class="title"><a name="sec.zypper.instrepo"></a>7.1.4. Managing Repositories with Zypper<span class="permalink"><a alt="Permalink" title="Copy Permalink" href="#sec.zypper.instrepo">¶</a></span></h3></div></div></div><p>
All installation or patch commands of Zypper rely on a list of known
repositories. To list all repositories known to the system, use the
command:
</p><pre class="screen">zypper repos</pre><p>
The result will look similar to the following output:
</p><div class="example"><a name="ex.zypper.repos"></a><p class="title"><b>Example 7.1. Zypper—List of Known Repositories</b><span class="permalink"><a alt="Permalink" title="Copy Permalink" href="#ex.zypper.repos">¶</a></span></p><div class="example-contents"><pre class="screen">
# | Alias | Name | Enabled | Refresh
--+-----------------------+-----------------------+---------+--------
1 | Updates | Updates | Yes | Yes
2 | openSUSE 11.2-0 | openSUSE 11.2-0 | No | No
3 | openSUSE-11.2-Debug | openSUSE-11.2-Debug | No | Yes
4 | openSUSE-11.2-Non-Oss | openSUSE-11.2-Non-Oss | Yes | Yes
5 | openSUSE-11.2-Oss | openSUSE-11.2-Oss | Yes | Yes
6 | openSUSE-11.2-Source | openSUSE-11.2-Source | No | Yes</pre></div></div><br class="example-break"><p>
When specifying repositories in various commands, an alias, URI or
repository number from the <span class="command"><strong>zypper repos</strong></span> command output
can be used. A repository alias is a short version of the repository name
for use in repository handling commands. Note that the repository numbers
can change after modifying the list of repositories. The alias will never
change by itself.
</p><p>
By default, details as the URI or the priority of the repository are not
displayed. Use the following command to list all details:
</p><pre class="screen">zypper repos -d</pre><div class="sect3" title="7.1.4.1. Adding Repositories"><div class="titlepage"><div><div><h4 class="title"><a name="sec.zypper.instrepo.add"></a>7.1.4.1. Adding Repositories<span class="permalink"><a alt="Permalink" title="Copy Permalink" href="#sec.zypper.instrepo.add">¶</a></span></h4></div></div></div><p>
To add a repository, run
</p><pre class="screen">zypper addrepo <em class="replaceable"><code>URI</code></em> <em class="replaceable"><code>alias</code></em></pre><p>
<em class="replaceable"><code>URI</code></em> can either be an Internet repository, a
network resource, a directory or a CD or DVD (see
<a class="ulink" href="http://en.opensuse.org/openSUSE:Libzypp_URIs" target="_top">http://en.opensuse.org/openSUSE:Libzypp_URIs</a> for
details). The <em class="replaceable"><code>alias</code></em> is a shorthand and unique
identifier of the repository. You can freely choose it, with the only
exception that is has to be unique. Zypper will issue a warning if you
specify an alias that is already in use.
</p></div><div class="sect3" title="7.1.4.2. Removing Repositories"><div class="titlepage"><div><div><h4 class="title"><a name="sec.zypper.instrepo.rm"></a>7.1.4.2. Removing Repositories<span class="permalink"><a alt="Permalink" title="Copy Permalink" href="#sec.zypper.instrepo.rm">¶</a></span></h4></div></div></div><p>
If you want to remove a repository from the list, use the command
<span class="command"><strong>zypper removerepo</strong></span> together with the alias or number
of the repository you want to delete. For example, to remove the
repository listed as third entry in <a class="xref" href="cha.sw_cl.html#ex.zypper.repos" title="Example 7.1. Zypper—List of Known Repositories">Example 7.1, “Zypper—List of Known Repositories”</a>,
use the following command:
</p><pre class="screen">zypper removerepo 3</pre></div><div class="sect3" title="7.1.4.3. Modifying Repositories"><div class="titlepage"><div><div><h4 class="title"><a name="sec.zypper.instrepo.mofify"></a>7.1.4.3. Modifying Repositories<span class="permalink"><a alt="Permalink" title="Copy Permalink" href="#sec.zypper.instrepo.mofify">¶</a></span></h4></div></div></div><p>
Enable or disable repositories with <span class="command"><strong>zypper
modifyrepo</strong></span>. You can also alter the repository's properties
(such as refreshing behavior, name or priority) with this command. The
following command will enable the repository named
<code class="literal">updates</code>, turn on auto-refresh and set its priority to
20:
</p><pre class="screen">zypper modifyrepo -er -p 20 'updates'</pre><p>
Modifying repositories is not limited to a single repository—you
can also operate on groups:
</p><table border="0" summary="Simple list" class="simplelist"><tr><td><code class="option">-a</code>: all repositories</td></tr><tr><td><code class="option">-l</code>: local repositories</td></tr><tr><td><code class="option">-t</code>: remote repositories</td></tr><tr><td><code class="option">-m <em class="replaceable"><code>TYPE</code></em></code>: repositories
of a certain type (where <em class="replaceable"><code>TYPE</code></em> can be one of the
following: <code class="literal">http</code>, <code class="literal">https</code>, <code class="literal">ftp</code>,
<code class="literal">cd</code>, <code class="literal">dvd</code>, <code class="literal">dir</code>, <code class="literal">file</code>,
<code class="literal">cifs</code>, <code class="literal">smb</code>, <code class="literal">nfs</code>, <code class="literal">hd</code>,
<code class="literal">iso</code>) </td></tr></table><p>
To rename a repository alias, use the <code class="literal">renamerepo</code>
command. The following example changes the alias from <code class="literal">Mozilla
Firefox</code> to just <code class="literal">firefox</code>:
</p><pre class="screen">zypper renamerepo 'Mozilla Firefox' firefox</pre></div></div><div class="sect2" title="7.1.5. Querying Repositories and Packages with Zypper"><div class="titlepage"><div><div><h3 class="title"><a name="sec.zypper.query"></a>7.1.5. Querying Repositories and Packages with Zypper<span class="permalink"><a alt="Permalink" title="Copy Permalink" href="#sec.zypper.query">¶</a></span></h3></div></div></div><p>
Zypper offers various methods to query repositories or packages. To get
lists of all products, patterns, packages or patches available, use the
following commands:
</p><pre class="screen">zypper products
zypper patterns
zypper packages
zypper patches</pre><p>
To query all repositories for certain packages, use
<code class="literal">search</code>. It works on package names, or, optionally, on
package summaries and descriptions. Using the wildcards
<code class="literal">*</code> and <code class="literal">?</code> with the search term is
allowed. By default, the search is not case-sensitive.
</p><pre class="screen">zypper search firefox # simple search for "firefox"
zypper search "*fire*" # using wildcards
zypper search -d fire # also search in package descriptions and summaries
zypper search -u firefox # only display packages not already installed</pre><p>
To search for packages which provide a special capability, use the
command <code class="literal">what-provides</code>. For example, if you would like
to know which package provides the perl module
<code class="literal">SVN::Core</code>, use the following command:
</p><pre class="screen">zypper what-provides 'perl(SVN::Core)'</pre><p>
To query single packages, use <span class="command"><strong>info</strong></span> with an exact
package name as an argument. It displays detailed information about a
package. To also show what is required/recommended by the package, use
the options <code class="option">--requires</code> and
<code class="option">--recommends</code>:
</p><pre class="screen">zypper info --requires MozillaFirefox</pre><p>
The <code class="literal">what-provides <em class="replaceable"><code>package</code></em></code>
is similar to <span class="command"><strong>rpm -q --whatprovides
<em class="replaceable"><code>package</code></em></strong></span>, but rpm is only able to
query the RPM database (that is the database of all installed packages).
Zypper, on the other hand, will tell you about providers of the
capability from any repository, not only those that are installed.
</p><a class="indexterm" name="id444195"></a></div><div class="sect2" title="7.1.6. Configuring Zypper"><div class="titlepage"><div><div><h3 class="title"><a name="sec.zypper.configure"></a>7.1.6. Configuring Zypper<span class="permalink"><a alt="Permalink" title="Copy Permalink" href="#sec.zypper.configure">¶</a></span></h3></div></div></div><p>
Zypper now comes with a configuration file, allowing you to permanently
change Zypper's behavior (either system-wide or user-specific). For
system-wide changes, edit <code class="filename">/etc/zypp/zypper.conf</code>. For
user-specific changes, edit <code class="filename">~/.zypper.conf</code>. If
<code class="filename">~/.zypper.conf</code> does not yet exist, you can use
<code class="filename">/etc/zypp/zypper.conf</code> as template: copy it to
<code class="filename">~/.zypper.conf</code> and adjust it to your liking. Refer
to the comments in the file for help about the available options.
</p></div><div class="sect2" title="7.1.7. Troubleshooting"><div class="titlepage"><div><div><h3 class="title"><a name="sec.zypper.trouble"></a>7.1.7. Troubleshooting<span class="permalink"><a alt="Permalink" title="Copy Permalink" href="#sec.zypper.trouble">¶</a></span></h3></div></div></div><p>
In case you have problems to access packages from configured repositories
(for example, zypper cannot find a certain package though you know that
it exists in one the repositories), it can help to refresh the
repositories with:
</p><pre class="screen">zypper refresh</pre><p>
If that does not help, try
</p><pre class="screen">zypper refresh -fdb</pre><p>
This forces a complete refresh and rebuild of the database, including a
forced download of raw metadata.
</p></div><div class="sect2" title="7.1.8. For More Information"><div class="titlepage"><div><div><h3 class="title"><a name="sec.zypper.more"></a>7.1.8. For More Information<span class="permalink"><a alt="Permalink" title="Copy Permalink" href="#sec.zypper.more">¶</a></span></h3></div></div></div><p>
For more information on managing software from the command line, enter
<span class="command"><strong>zypper help</strong></span>, <span class="command"><strong>zypper
help <em class="replaceable"><code>command</code></em></strong></span> or refer to the
<code class="systemitem">zypper(8)</code> manpage. <span>For a
complete and detailed command reference, including <code class="literal">cheat
sheets</code> with the most important commands, and information on how
to use Zypper in scripts and applications, refer to
<a class="ulink" href="http://wiki.opensuse.org/SDB:Zypper_usage" target="_top">http://wiki.opensuse.org/SDB:Zypper_usage</a>. A list of
software changes for the latest openSUSE version can be found at
<a class="ulink" href="http://wiki.opensuse.org/SDB:Zypper_changes_11.3" target="_top">.</a>
</span>.
</p></div></div><div class="sect1" title="7.2. RPM—the Package Manager"><div class="titlepage"><div><div><h2 class="title" style="clear: both"><a name="sec.rpm"></a>7.2. RPM—the Package Manager<span class="permalink"><a alt="Permalink" title="Copy Permalink" href="#sec.rpm">¶</a></span></h2></div></div></div><a class="indexterm" name="idx.RPM"></a><a class="indexterm" name="id444331"></a><a class="indexterm" name="id444338"></a><a class="indexterm" name="id444346"></a><p>
RPM (RPM Package Manager) is used for managing software packages. Its main
commands are <span class="command"><strong>rpm</strong></span> and <span class="command"><strong>rpmbuild</strong></span>. The
powerful RPM database can be queried by the users, system administrators
and package builders for detailed information about the installed
software.
</p><a class="indexterm" name="id444365"></a><a class="indexterm" name="id444370"></a><p>
Essentially, <span class="command"><strong>rpm</strong></span> has five modes: installing,
uninstalling (or updating) software packages, rebuilding the RPM database,
querying RPM bases or individual RPM archives, integrity checking of
packages and signing packages. <span class="command"><strong>rpmbuild</strong></span> can be used to
build installable packages from pristine sources.
</p><p>
Installable RPM archives are packed in a special binary format. These
archives consist of the program files to install and certain meta
information used during the installation by <span class="command"><strong>rpm</strong></span> to
configure the software package or stored in the RPM database for
documentation purposes. RPM archives normally have the extension
<code class="filename">.rpm</code>.
</p><a class="indexterm" name="id444401"></a><a class="indexterm" name="id444409"></a><div class="tip"><table border="0" cellpadding="3" cellspacing="0" width="100%" summary="Tip: Software Development Packages"><tr class="head"><td width="32"><img alt="[Tip]" src="admon/tip.png"></td><th align="left">Software Development Packages</th></tr><tr><td colspan="2" align="left" valign="top"><p>
For a number of packages, the components needed for software development
(libraries, headers, include files, etc.) have been put into separate
packages. These development packages are only needed if you want to
compile software yourself (for example, the most recent GNOME packages).
They can be identified by the name extension <code class="literal">-devel</code>,
such as the packages
<code class="systemitem">alsa-devel</code>,
<code class="systemitem">gimp-devel</code>, and
<code class="systemitem">libkde4-devel</code>.
</p></td></tr></table></div><div class="sect2" title="7.2.1. Verifying Package Authenticity"><div class="titlepage"><div><div><h3 class="title"><a name="sec.rpm.package_auth"></a>7.2.1. Verifying Package Authenticity<span class="permalink"><a alt="Permalink" title="Copy Permalink" href="#sec.rpm.package_auth">¶</a></span></h3></div></div></div><a class="indexterm" name="id444455"></a><a class="indexterm" name="id444462"></a><p>
RPM packages have a GnuPG signature. To verify the signature of an RPM
package, use the command <span class="command"><strong>rpm
--checksig <em class="replaceable"><code>package</code></em>-1.2.3.rpm</strong></span> to
determine whether the package originates from Novell/SUSE or from
another trustworthy facility. This is especially recommended for update
packages from the Internet.
</p></div><div class="sect2" title="7.2.2. Managing Packages: Install, Update, and Uninstall"><div class="titlepage"><div><div><h3 class="title"><a name="sec.rpm.packages_manage"></a>7.2.2. Managing Packages: Install, Update, and Uninstall<span class="permalink"><a alt="Permalink" title="Copy Permalink" href="#sec.rpm.packages_manage">¶</a></span></h3></div></div></div><a class="indexterm" name="id444490"></a><a class="indexterm" name="id444498"></a><a class="indexterm" name="id444505"></a><a class="indexterm" name="id444513"></a><a class="indexterm" name="id444520"></a><a class="indexterm" name="id444528"></a><p>
Normally, the installation of an RPM archive is quite simple:
<span class="command"><strong>rpm -i <em class="replaceable"><code>package</code></em>.rpm</strong></span>. With
this command the package is installed, but only if its dependencies are
fulfilled and if there are no conflicts with other packages. With an
error message, <span class="command"><strong>rpm</strong></span> requests those packages that need
to be installed to meet dependency requirements. In the background, the
RPM database ensures that no conflicts arise—a specific file can
only belong to one package. By choosing different options, you can force
<span class="command"><strong>rpm</strong></span> to ignore these defaults, but this is only for
experts. Otherwise, you risk compromising the integrity of the system and
possibly jeopardize the ability to update the system.
</p><a class="indexterm" name="id444557"></a><p>
The options <code class="option">-U</code> or <code class="option">--upgrade</code> and
<code class="option">-F</code> or <code class="option">--freshen</code> can be used to update a
package (for example, <span class="command"><strong>rpm -F
<em class="replaceable"><code>package</code></em>.rpm</strong></span>). This command removes
the files of the old version and immediately installs the new files. The
difference between the two versions is that <code class="option">-U</code> installs
packages that previously did not exist in the system, but
<code class="option">-F</code> merely updates previously installed packages. When
updating, <span class="command"><strong>rpm</strong></span> updates configuration files carefully
using the following strategy:
</p><a class="indexterm" name="id444599"></a><div class="itemizedlist"><ul class="itemizedlist" type="bullet"><li class="listitem" style="list-style-type: disc"><p>
If a configuration file was not changed by the system administrator,
<span class="command"><strong>rpm</strong></span> installs the new version of the appropriate
file. No action by the system administrator is required.
</p></li><li class="listitem" style="list-style-type: disc"><p>
If a configuration file was changed by the system administrator before
the update, <span class="command"><strong>rpm</strong></span> saves the changed file with the
extension <code class="filename">.rpmorig</code> or
<code class="filename">.rpmsave</code> (backup file) and installs the version
from the new package (but only if the originally installed file and the
newer version are different). If this is the case, compare the backup
file (<code class="filename">.rpmorig</code> or <code class="filename">.rpmsave</code>)
with the newly installed file and make your changes again in the new
file. Afterwards, be sure to delete all <code class="filename">.rpmorig</code>
and <code class="filename">.rpmsave</code> files to avoid problems with future
updates.
</p></li><li class="listitem" style="list-style-type: disc"><p>
<code class="filename">.rpmnew</code> files appear if the configuration file
already exists <span class="emphasis"><em>and</em></span> if the
<code class="option">noreplace</code> label was specified in the
<code class="filename">.spec</code> file.
</p></li></ul></div><p>
Following an update, <code class="filename">.rpmsave</code> and
<code class="filename">.rpmnew</code> files should be removed after comparing
them, so they do not obstruct future updates. The
<code class="filename">.rpmorig</code> extension is assigned if the file has not
previously been recognized by the RPM database.
</p><p>
Otherwise, <code class="filename">.rpmsave</code> is used. In other words,
<code class="filename">.rpmorig</code> results from updating from a foreign format
to RPM. <code class="filename">.rpmsave</code> results from updating from an older
RPM to a newer RPM. <code class="filename">.rpmnew</code> does not disclose any
information as to whether the system administrator has made any changes
to the configuration file. A list of these files is available in
<code class="filename">/var/adm/rpmconfigcheck</code>. Some configuration files
(like <code class="filename">/etc/httpd/httpd.conf</code>) are not overwritten to
allow continued operation.
</p><p>
The <code class="option">-U</code> switch is <span class="emphasis"><em>not</em></span> just an
equivalent to uninstalling with the <code class="option">-e</code> option and
installing with the <code class="option">-i</code> option. Use <code class="option">-U</code>
whenever possible.
</p><p>
To remove a package, enter <span class="command"><strong>rpm -e
<em class="replaceable"><code>package</code></em></strong></span>. <span class="command"><strong>rpm</strong></span>,
which only deletes the package if there are no unresolved dependencies.
It is theoretically impossible to delete Tcl/Tk, for example, as long as
another application requires it. Even in this case, RPM calls for
assistance from the database. If such a deletion is, for whatever reason,
impossible (even if <span class="emphasis"><em>no</em></span> additional dependencies
exist), it may be helpful to rebuild the RPM database using the option
<code class="option">--rebuilddb</code>.
</p><a class="indexterm" name="id444757"></a><a class="indexterm" name="id444765"></a></div><div class="sect2" title="7.2.3. RPM and Patches"><div class="titlepage"><div><div><h3 class="title"><a name="sec.rpm.patches"></a>7.2.3. RPM and Patches<span class="permalink"><a alt="Permalink" title="Copy Permalink" href="#sec.rpm.patches">¶</a></span></h3></div></div></div><a class="indexterm" name="id444784"></a><p>
To guarantee the operational security of a system, update packages must
be installed in the system from time to time. Previously, a bug in a
package could only be eliminated by replacing the entire package. Large
packages with bugs in small files could easily result in this scenario.
However the SUSE RPM offers a feature enabling the installation of
patches in packages.
</p><p>
The most important considerations are demonstrated using
<span class="command"><strong>pine</strong></span> as an example:
</p><div class="variablelist"><dl><dt><span class="term">Is the patch RPM suitable for my system?</span></dt><dd><p>
To check this, first query the installed version of the package. For
<span class="command"><strong>pine</strong></span>, this can be done with
</p><pre class="screen">rpm -q pine
pine-4.44-188</pre><p>
Then check if the patch RPM is suitable for this version of
<span class="command"><strong>pine</strong></span>:
</p><pre class="screen">rpm -qp --basedon pine-4.44-224.i586.patch.rpm
pine = 4.44-188
pine = 4.44-195
pine = 4.44-207</pre><p>
This patch is suitable for three different versions of pine. The
installed version in the example is also listed, so the patch can be
installed.
</p></dd><dt><span class="term">Which files are replaced by the patch?</span></dt><dd><p>
The files affected by a patch can easily be seen in the patch RPM. The
<span class="command"><strong>rpm</strong></span> parameter <code class="option">-P</code> allows selection
of special patch features. Display the list of files with the
following command:
</p><pre class="screen">rpm -qpPl pine-4.44-224.i586.patch.rpm
/etc/pine.conf
/etc/pine.conf.fixed
/usr/bin/pine</pre><p>
or, if the patch is already installed, with the following command:
</p><pre class="screen">rpm -qPl pine
/etc/pine.conf
/etc/pine.conf.fixed
/usr/bin/pine</pre></dd><dt><span class="term">How can a patch RPM be installed in the system?</span></dt><dd><p>
Patch RPMs are used just like normal RPMs. The only difference is that
a suitable RPM must already be installed.
</p></dd><dt><span class="term">
Which patches are already installed in the system and for which
package versions?
</span></dt><dd><p>
A list of all patches installed in the system can be displayed with
the command <span class="command"><strong>rpm <code class="option">-qPa</code></strong></span>. If only one
patch is installed in a new system (as in this example), the list
appears as follows:
</p><pre class="screen">rpm -qPa
pine-4.44-224</pre><p>
If, at a later date, you want to know which package version was
originally installed, this information is also available in the RPM
database. For <span class="command"><strong>pine</strong></span>, this information can be
displayed with the following command:
</p><pre class="screen">rpm -q --basedon pine
pine = 4.44-188</pre></dd></dl></div><p>
More information, including information about the patch feature of RPM,
is available in the man pages of <span class="command"><strong>rpm</strong></span> and
<span class="command"><strong>rpmbuild</strong></span>.
</p><div class="note"><table border="0" cellpadding="3" cellspacing="0" width="100%" summary="Note: Official Updates for "><tr class="head"><td width="32"><img alt="[Note]" src="admon/note.png"></td><th align="left">Official Updates for openSUSE</th></tr><tr><td colspan="2" align="left" valign="top"><p>
In order to make the download size of updates as small as possible,
official updates for openSUSE are not provided as Patch RPMs, but
as Delta RPM packages. For details, see <a class="xref" href="cha.sw_cl.html#sec.rpm.delta" title="7.2.4. Delta RPM Packages">Section 7.2.4, “Delta RPM Packages”</a>.
</p></td></tr></table></div></div><div class="sect2" title="7.2.4. Delta RPM Packages"><div class="titlepage"><div><div><h3 class="title"><a name="sec.rpm.delta"></a>7.2.4. Delta RPM Packages<span class="permalink"><a alt="Permalink" title="Copy Permalink" href="#sec.rpm.delta">¶</a></span></h3></div></div></div><a class="indexterm" name="id444964"></a><a class="indexterm" name="id444971"></a><p>
Delta RPM packages contain the difference between an old and a new
version of an RPM package. Applying a delta RPM onto an old RPM results
in a completely new RPM. It is not necessary to have a copy of the old
RPM because a delta RPM can also work with an installed RPM. The delta
RPM packages are even smaller in size than patch RPMs, which is an
advantage when transferring update packages over the Internet. The
drawback is that update operations with delta RPMs involved consume
considerably more CPU cycles than plain or patch RPMs.
</p><p>
The <span class="command"><strong>prepdeltarpm</strong></span>, <span class="command"><strong>writedeltarpm</strong></span> and
<span class="command"><strong>applydeltarpm</strong></span> binaries are part of the delta RPM suite
(package <code class="systemitem">deltarpm</code>) and help you create and apply
delta RPM packages. With the following commands, create a delta RPM
called <code class="filename">new.delta.rpm</code>. The following command assumes
that <code class="filename">old.rpm</code> and <code class="filename">new.rpm</code> are
present:
</p><pre class="screen">prepdeltarpm -s seq -i info old.rpm > old.cpio
prepdeltarpm -f new.rpm > new.cpio
xdelta delta -0 old.cpio new.cpio delta
writedeltarpm new.rpm delta info new.delta.rpm
</pre><p>
Finally, remove the temporary working files
<code class="filename">old.cpio</code>, <code class="filename">new.cpio</code>, and
<code class="filename">delta</code>.
</p><p>
Using <span class="command"><strong>applydeltarpm</strong></span>, you can reconstruct the new RPM
from the file system if the old package is already installed:
</p><pre class="screen">applydeltarpm new.delta.rpm new.rpm</pre><p>
To derive it from the old RPM without accessing the file system, use the
<code class="option">-r</code> option:
</p><pre class="screen">applydeltarpm -r old.rpm new.delta.rpm new.rpm</pre><p>
See <code class="filename">/usr/share/doc/packages/deltarpm/README</code> for
technical details.
</p></div><div class="sect2" title="7.2.5. RPM Queries"><div class="titlepage"><div><div><h3 class="title"><a name="sec.rpm.query"></a>7.2.5. RPM Queries<span class="permalink"><a alt="Permalink" title="Copy Permalink" href="#sec.rpm.query">¶</a></span></h3></div></div></div><a class="indexterm" name="id445064"></a><p>
With the <code class="option">-q</code> option <span class="command"><strong>rpm</strong></span> initiates
queries, making it possible to inspect an RPM archive (by adding the
option <code class="option">-p</code>) and also to query the RPM database of
installed packages. Several switches are available to specify the type of
information required. See <a class="xref" href="cha.sw_cl.html#tab.rpm.query" title="Table 7.1. The Most Important RPM Query Options">Table 7.1, “The Most Important RPM Query Options”</a>.
</p><div class="table"><a name="tab.rpm.query"></a><p class="title"><b>Table 7.1. The Most Important RPM Query Options</b><span class="permalink"><a alt="Permalink" title="Copy Permalink" href="#tab.rpm.query">¶</a></span></p><div class="table-contents"><table summary="The Most Important RPM Query Options" border="1"><colgroup><col><col></colgroup><tbody><tr><td>
<p>
<code class="option">-i</code>
</p>
</td><td>
<p>
Package information
</p>
</td></tr><tr><td>
<p>
<code class="option">-l</code>
</p>
</td><td>
<p>
File list
</p>
</td></tr><tr><td>
<p>
<code class="option">-f FILE</code>
</p>
</td><td>
<p>
Query the package that contains the file
<em class="replaceable"><code>FILE</code></em> (the full path must be specified
with <em class="replaceable"><code>FILE</code></em>)
</p>
</td></tr><tr><td>
<p>
<code class="option">-s</code>
</p>
</td><td>
<p>
File list with status information (implies <code class="option">-l</code>)
</p>
</td></tr><tr><td>
<p>
<code class="option">-d</code>
</p>
</td><td>
<p>
List only documentation files (implies <code class="literal">-l</code>)
</p>
</td></tr><tr><td>
<p>
<code class="option">-c</code>
</p>
</td><td>
<p>
List only configuration files (implies <code class="option">-l</code>)
</p>
</td></tr><tr><td>
<p>
<code class="option">--dump</code>
</p>
</td><td>
<p>
File list with complete details (to be used with
<code class="option">-l</code>, <code class="option">-c</code>, or <code class="option">-d</code>)
</p>
</td></tr><tr><td>
<p>
<code class="option">--provides</code>
</p>
</td><td>
<p>
List features of the package that another package can request with
<code class="option">--requires</code>
</p>
</td></tr><tr><td>
<p>
<code class="option">--requires</code>, <code class="option">-R</code>
</p>
</td><td>
<p>
Capabilities the package requires
</p>
</td></tr><tr><td>
<p>
<code class="option">--scripts</code>
</p>
</td><td>
<p>
Installation scripts (preinstall, postinstall, uninstall)
</p>
</td></tr></tbody></table></div></div><br class="table-break"><p>
For example, the command <span class="command"><strong>rpm -q -i wget</strong></span> displays the
information shown in <a class="xref" href="cha.sw_cl.html#aus.update.rpm-i" title="Example 7.2. rpm -q -i wget">Example 7.2, “rpm -q -i wget”</a>.
</p><div class="example"><a name="aus.update.rpm-i"></a><p class="title"><b>Example 7.2. rpm -q -i wget</b><span class="permalink"><a alt="Permalink" title="Copy Permalink" href="#aus.update.rpm-i">¶</a></span></p><div class="example-contents"><pre class="screen">Name : wget Relocations: (not relocatable)
Version : 1.11.4 Vendor: openSUSE
Release : 1.70 Build Date: Sat 01 Aug 2009 09:49:48 CEST
Install Date: Thu 06 Aug 2009 14:53:24 CEST Build Host: build18
Group : Productivity/Networking/Web/Utilities Source RPM: wget-1.11.4-1.70.src.rpm
Size : 1525431 License: GPL v3 or later
Signature : RSA/8, Sat 01 Aug 2009 09:50:04 CEST, Key ID b88b2fd43dbdc284
Packager : http://bugs.opensuse.org
URL : http://www.gnu.org/software/wget/
Summary : A Tool for Mirroring FTP and HTTP Servers
Description :
Wget enables you to retrieve WWW documents or FTP files from a server.
This can be done in script files or via the command line.
[...]</pre></div></div><br class="example-break"><p>
The option <code class="option">-f</code> only works if you specify the complete
filename with its full path. Provide as many filenames as desired. For
example, the following command
</p><pre class="screen">rpm -q -f /bin/rpm /usr/bin/wget</pre><p>
results in:
</p><pre class="screen">rpm-4.8.0-4.3.x86_64
wget-1.11.4-11.18.x86_64</pre><p>
If only part of the filename is known, use a shell script as shown in
<a class="xref" href="cha.sw_cl.html#dat.rpm.search" title="Example 7.3. Script to Search for Packages">Example 7.3, “Script to Search for Packages”</a>. Pass the partial filename to the script
shown as a parameter when running it.
</p><div class="example"><a name="dat.rpm.search"></a><p class="title"><b>Example 7.3. Script to Search for Packages</b><span class="permalink"><a alt="Permalink" title="Copy Permalink" href="#dat.rpm.search">¶</a></span></p><div class="example-contents"><pre class="screen">#! /bin/sh
for i in $(rpm -q -a -l | grep $1); do
echo "\"$i\" is in package:"
rpm -q -f $i
echo ""
done</pre></div></div><br class="example-break"><p>
The command <span class="command"><strong>rpm -q --changelog rpm</strong></span> displays a detailed
list of change information about a specific package (in this case, the
<code class="literal">rpm</code>package), sorted by date.
</p><p>
With the help of the installed RPM database, verification checks can be
made. Initiate these with <code class="option">-V</code>, <code class="option">-y</code> or
<code class="option">--verify</code>. With this option, <span class="command"><strong>rpm</strong></span> shows
all files in a package that have been changed since installation.
<span class="command"><strong>rpm</strong></span> uses eight character symbols to give some hints
about the following changes:
</p><a class="indexterm" name="id445433"></a><div class="table"><a name="tab.rpm.verify"></a><p class="title"><b>Table 7.2. RPM Verify Options</b><span class="permalink"><a alt="Permalink" title="Copy Permalink" href="#tab.rpm.verify">¶</a></span></p><div class="table-contents"><table summary="RPM Verify Options" border="1"><colgroup><col><col></colgroup><tbody><tr><td>
<p>
<code class="option">5</code>
</p>
</td><td>
<p>
MD5 check sum
</p>
</td></tr><tr><td>
<p>
<code class="option">S</code>
</p>
</td><td>
<p>
File size
</p>
</td></tr><tr><td>
<p>
<code class="option">L</code>
</p>
</td><td>
<p>
Symbolic link
</p>
</td></tr><tr><td>
<p>
<code class="option">T</code>
</p>
</td><td>
<p>
Modification time
</p>
</td></tr><tr><td>
<p>
<code class="option">D</code>
</p>
</td><td>
<p>
Major and minor device numbers
</p>
</td></tr><tr><td>
<p>
<code class="option">U</code>
</p>
</td><td>
<p>
Owner
</p>
</td></tr><tr><td>
<p>
<code class="option">G</code>
</p>
</td><td>
<p>
Group
</p>
</td></tr><tr><td>
<p>
<code class="option">M</code>
</p>
</td><td>
<p>
Mode (permissions and file type)
</p>
</td></tr></tbody></table></div></div><br class="table-break"><p>
In the case of configuration files, the letter <code class="option">c</code> is
printed. For example, for changes to <code class="filename">/etc/wgetrc</code>
(<code class="systemitem">wget</code> package):
</p><pre class="screen">rpm -V wget
S.5....T c /etc/wgetrc</pre><p>
The files of the RPM database are placed in
<code class="filename">/var/lib/rpm</code>. If the partition
<code class="filename">/usr</code> has a size of 1 GB, this database can
occupy nearly 30 MB, especially after a complete update. If the
database is much larger than expected, it is useful to rebuild the
database with the option <code class="option">--rebuilddb</code>. Before doing this,
make a backup of the old database. The <span class="command"><strong>cron</strong></span> script
<span class="command"><strong>cron.daily</strong></span> makes daily copies of the database (packed
with gzip) and stores them in <code class="filename">/var/adm/backup/rpmdb</code>.
The number of copies is controlled by the variable
<code class="systemitem">MAX_RPMDB_BACKUPS</code> (default: <code class="option">5</code>)
in <code class="filename">/etc/sysconfig/backup</code>. The size of a single
backup is approximately 1 MB for 1 GB in
<code class="filename">/usr</code>.
</p><a class="indexterm" name="id445668"></a></div><div class="sect2" title="7.2.6. Installing and Compiling Source Packages"><div class="titlepage"><div><div><h3 class="title"><a name="sec.rpm.sources"></a>7.2.6. Installing and Compiling Source Packages<span class="permalink"><a alt="Permalink" title="Copy Permalink" href="#sec.rpm.sources">¶</a></span></h3></div></div></div><a class="indexterm" name="id445687"></a><a class="indexterm" name="id445694"></a><a class="indexterm" name="id445702"></a><a class="indexterm" name="id445709"></a><p>
All source packages carry a <code class="filename">.src.rpm</code> extension
(source RPM).
</p><div class="note"><table border="0" cellpadding="3" cellspacing="0" width="100%" summary="Note: Installed Source Packages"><tr class="head"><td width="32"><img alt="[Note]" src="admon/note.png"></td><th align="left">Installed Source Packages</th></tr><tr><td colspan="2" align="left" valign="top"><p>
Source packages can be copied from the installation medium to the hard
disk and unpacked with YaST. They are not, however, marked as
installed (<code class="literal">[i]</code>) in the package manager. This is
because the source packages are not entered in the RPM database. Only
<span class="emphasis"><em>installed</em></span> operating system software is listed in
the RPM database. When you <span class="quote">“<span class="quote">install</span>”</span> a source package, only
the source code is added to the system.
</p></td></tr></table></div><p>
The following directories must be available for <span class="command"><strong>rpm</strong></span>
and <span class="command"><strong>rpmbuild</strong></span> in <code class="filename">/usr/src/packages</code>
(unless you specified custom settings in a file like
<code class="filename">/etc/rpmrc</code>):
</p><div class="variablelist"><dl><dt><span class="term"><code class="filename">SOURCES</code>
</span></dt><dd><p>
for the original sources (<code class="filename">.tar.bz2</code> or
<code class="filename">.tar.gz</code> files, etc.) and for
distribution-specific adjustments (mostly <code class="filename">.diff</code>
or <code class="filename">.patch</code> files)
</p></dd><dt><span class="term"><code class="filename">SPECS</code>
</span></dt><dd><p>
for the <code class="filename">.spec</code> files, similar to a meta Makefile,
which control the <span class="emphasis"><em>build</em></span> process
</p></dd><dt><span class="term"><code class="filename">BUILD</code>
</span></dt><dd><p>
all the sources are unpacked, patched and compiled in this directory
</p></dd><dt><span class="term"><code class="filename">RPMS</code>
</span></dt><dd><p>
where the completed binary packages are stored
</p></dd><dt><span class="term"><code class="filename">SRPMS</code>
<a class="indexterm" name="id445847"></a></span></dt><dd><p>
here are the source RPMs
</p></dd></dl></div><p>
When you install a source package with YaST, all the necessary
components are installed in <code class="filename">/usr/src/packages</code>: the
sources and the adjustments in <code class="filename">SOURCES</code> and the
relevant <code class="filename">.spec</code> file in <code class="filename">SPECS</code>.
</p><div class="warning"><table border="0" cellpadding="3" cellspacing="0" width="100%" summary="Warning"><tr class="head"><td width="32"><img alt="[Warning]" src="admon/warning.png"></td><th align="left"></th></tr><tr><td colspan="2" align="left" valign="top"><p>
Do not experiment with system components
(<code class="systemitem">glibc</code>,
<code class="systemitem">rpm</code>,
<code class="systemitem">sysvinit</code>, etc.), because this
endangers the stability of your system.
</p></td></tr></table></div><p>
The following example uses the <code class="filename">wget.src.rpm</code> package.
After installing the source package, you should have files similar to
those in the following list:
</p><pre class="screen">/usr/src/packages/SOURCES/wget-1.11.4.tar.bz2
/usr/src/packages/SOURCES/wgetrc.patch
/usr/src/packages/SPECS/wget.spec</pre><p>
<span class="command"><strong>rpmbuild -b<em class="replaceable"><code>X</code></em>
/usr/src/packages/SPECS/wget.spec</strong></span> starts the compilation.
<em class="replaceable"><code>X</code></em> is a wild card for various stages of the
build process (see the output of <code class="option">--help</code> or the RPM
documentation for details). The following is merely a brief explanation:
</p><div class="variablelist"><dl><dt><span class="term"><code class="option">-bp</code>
</span></dt><dd><p>
Prepare sources in <code class="filename">/usr/src/packages/BUILD</code>:
unpack and patch.
</p></dd><dt><span class="term"><code class="option">-bc</code>
</span></dt><dd><p>
Do the same as <code class="option">-bp</code>, but with additional compilation.
</p></dd><dt><span class="term"><code class="option">-bi</code>
</span></dt><dd><p>
Do the same as <code class="option">-bp</code>, but with additional installation
of the built software. Caution: if the package does not support the
BuildRoot feature, you might overwrite configuration files.
</p></dd><dt><span class="term"><code class="option">-bb</code>
</span></dt><dd><p>
Do the same as <code class="option">-bi</code>, but with the additional creation
of the binary package. If the compile was successful, the binary
should be in <code class="filename">/usr/src/packages/RPMS</code>.
</p></dd><dt><span class="term"><code class="option">-ba</code>
</span></dt><dd><p>
Do the same as <code class="option">-bb</code>, but with the additional creation
of the source RPM. If the compilation was successful, the binary
should be in <code class="filename">/usr/src/packages/SRPMS</code>.
</p></dd><dt><span class="term"><code class="option">--short-circuit</code>
</span></dt><dd><p>
Skip some steps.
</p></dd></dl></div><p>
The binary RPM created can now be installed with <span class="command"><strong>rpm
<code class="option">-i</code></strong></span> or, preferably, with <span class="command"><strong>rpm
<code class="option">-U</code></strong></span>. Installation with <span class="command"><strong>rpm</strong></span>
makes it appear in the RPM database.
</p></div><div class="sect2" title="7.2.7. Compiling RPM Packages with build"><div class="titlepage"><div><div><h3 class="title"><a name="sec.rpm.build"></a>7.2.7. Compiling RPM Packages with build<span class="permalink"><a alt="Permalink" title="Copy Permalink" href="#sec.rpm.build">¶</a></span></h3></div></div></div><a class="indexterm" name="id446076"></a><p>
The danger with many packages is that unwanted files are added to the
running system during the build process. To prevent this use
<code class="systemitem">build</code>, which creates a defined environment in
which the package is built. To establish this chroot environment, the
<span class="command"><strong>build</strong></span> script must be provided with a complete package
tree. This tree can be made available on the hard disk, via NFS, or from
DVD. Set the position with <span class="command"><strong>build --rpms
<em class="replaceable"><code>directory</code></em></strong></span>. Unlike
<span class="command"><strong>rpm</strong></span>, the <span class="command"><strong>build</strong></span> command looks for
the <code class="filename">.spec</code> file in the source directory.
To build <code class="filename">wget</code> (like in the above
example) with the DVD mounted in the system under
<code class="filename">/media/dvd</code>, use the following commands as
<code class="systemitem">root</code>:
</p><pre class="screen">cd /usr/src/packages/SOURCES/
mv ../SPECS/wget.spec .
build --rpms /media/dvd/suse/ wget.spec</pre><p>
Subsequently, a minimum environment is established at
<code class="filename">/var/tmp/build-root</code>. The package is built in this
environment. Upon completion, the resulting packages are located in
<code class="filename">/var/tmp/build-root/usr/src/packages/RPMS</code>.
</p><p>
The <span class="command"><strong>build</strong></span> script offers a number of additional
options. For example, cause the script to prefer your own RPMs, omit the
initialization of the build environment or limit the
<span class="command"><strong>rpm</strong></span> command to one of the above-mentioned stages.
Access additional information with <span class="command"><strong>build
<code class="option">--help</code></strong></span> and by reading the
<span class="command"><strong>build</strong></span> man page.
</p></div><div class="sect2" title="7.2.8. Tools for RPM Archives and the RPM Database"><div class="titlepage"><div><div><h3 class="title"><a name="sec.rpm.tools"></a>7.2.8. Tools for RPM Archives and the RPM Database<span class="permalink"><a alt="Permalink" title="Copy Permalink" href="#sec.rpm.tools">¶</a></span></h3></div></div></div><a class="indexterm" name="id446168"></a><p>
Midnight Commander (<span class="command"><strong>mc</strong></span>) can display the contents of
RPM archives and copy parts of them. It represents archives as virtual
file systems, offering all usual menu options of Midnight Commander.
Display the <code class="filename">HEADER</code> with <span class="keycap">F3</span>. View
the archive structure with the cursor keys and <span class="keycap">Enter</span>.
Copy archive components with <span class="keycap">F5</span>.
</p><p>
A full-featured package manager is available as a YaST module. For
details, see <a class="xref" href="cha.y2.sw.html" title="Chapter 3. Installing or Removing Software">Chapter 3, <i>Installing or Removing Software</i></a>.
</p><a class="indexterm" name="id446205"></a></div></div></div><div class="navfooter"><table width="100%" summary="Navigation footer" border="0" class="bctable"><tr><td width="80%"><div class="breadcrumbs"><p><a href="index.html"> Documentation</a><span class="breadcrumbs-sep"> > </span><a href="book.opensuse.reference.html">Reference</a><span class="breadcrumbs-sep"> > </span><a href="part.reference.software.html">Managing and Updating Software</a><span class="breadcrumbs-sep"> > </span><strong><a accesskey="p" title="Chapter 6. Installing Add-On Products" href="cha.add-ons.html"><span>◀</span></a> </strong></p></div></td></tr></table></div></body></html>
ACC SHELL 2018