Zypper Commands In Linux With Examples - Part 1
Various Zypper Commands In Linux With Examples
Zypper and YaST are the Package Manager for SUSE Linux that performs on top of RPM. YaST (Yet another Setup Tool) performs on OpenSUSE and SUSE Enterprise edition to administer, setup and configure SUSE Linux. Zypper is the command line interface of ZYpp package manager for removing, installing and updating SUSE.
Run zypper to list all the global options and commands.
linuxhelp:~ # zypper
Usage:
zypper [--global-options] [--command-options] [arguments]
Global Options:
--help, -h Help.
--version, -V Output the version number.
.
.
.
versioncmp, vcmp Compare two version strings.
targetos, tos Print the target operating system ID string.
licenses Print report about licenses and EULAs of
installed packages.
download Download rpms specified on the commandline to a local directory.
source-download Download source rpms for all installed packages
to a local directory.
Type ' zypper help' to get command-specific help.
In order to get help on a particular command.
linuxhelp:~ # zypper help install
install (in) [options] < capability|rpm_file_uri> ...
Install packages with specified capabilities or RPM files with specified
location. A capability is NAME[.ARCH][OP], where OP is one
of < , < =, =, > =, > .
Command options:
--from < alias|#|URI> Select packages from the specified repository.
-r, --repo < alias|#|URI> Load only the specified repository.
-t, --type Type of package (package, patch, pattern, product, srcpackage).
Default: package.
-n, --name Select packages by plain name, not by capability.
-C, --capability Select packages by capability.
-f, --force Install even if the item is already installed (reinstall),
downgraded or changes vendor or architecture.
--oldpackage Allow to replace a newer item with an older one.
Handy if you are doing a rollback. Unlike --force
it will not enforce a reinstall.
--replacefiles Install the packages even if they replace files from other,
already installed, packages. Default is to treat file conflicts
as an error. --download-as-needed disables the fileconflict check.
-l, --auto-agree-with-licenses
Automatically say ' yes' to third party license
confirmation prompt.
See ' man zypper' for more details.
--debug-solver Create solver test case for debugging.
--no-recommends Do not install recommended packages, only required.
--recommends Install also recommended packages in addition
to the required.
-R, --no-force-resolution Do not force the solver to find solution,
let it ask.
--force-resolution Force the solver to find a solution (even
an aggressive one).
-D, --dry-run Test the installation, do not actually install.
--details Show the detailed installation summary.
--download Set the download-install mode. Available modes:
only, in-advance, in-heaps, as-needed
-d, --download-only Only download the packages, do not install.
Before installing, use the below command to search for a package.
linuxhelp:~ # zypper se firefox
Retrieving repository ' openSUSE-13.2-Update' metadata ...........................[done]
Building repository ' openSUSE-13.2-Update' cache ................................[done]
Retrieving repository ' openSUSE-13.2-Update-Non-Oss' metadata ...................[done]
Building repository ' openSUSE-13.2-Update-Non-Oss' cache ........................[done]
Loading repository data...
Reading installed packages...
S | Name | Summary | Type
--+------------------------------------+----------------------------------+------------
i | Firefox | Web Browser | application
i | MozillaFirefox | Mozilla Firefox Web Browser | package
| MozillaFirefox | Mozilla Firefox Web Browser | srcpackage
i | MozillaFirefox-branding-openSUSE | openSUSE branding of MozillaFi-> | package
| MozillaFirefox-branding-openSUSE | openSUSE branding of MozillaFi-> | srcpackage
| MozillaFirefox-branding-upstream | Upstream branding for Firefox | package
| MozillaFirefox-buildsymbols | Breakpad buildsymbols for Fire-> | package
| MozillaFirefox-devel | Devel package for Firefox | package
| MozillaFirefox-translations-common | Common translations for Firefox | package
| MozillaFirefox-translations-other | Extra translations for Firefox | package
| mhtml-firefox | Provides Firefox with MHTML we-> | package
To get information on a pattern package, run the following command.
linuxhelp:~ # zypper info -t pattern file_server
Loading repository data...
Reading installed packages...
Information for pattern file_server:
------------------------------------
Repository: openSUSE-13.2-Update
Name: file_server
Version: 20141007-5.1
Arch: x86_64
Vendor: openSUSE
Installed: No
Visible to User: Yes
Summary: File Server
Description:
File services to host files so that they may be accessed or retrieved by other
computers on the same network. This includes the FTP, SMB, and NFS protocols.
Contents:
S | Name | Type | Dependency
--+-------------------------------+---------+-----------
| nfs-kernel-server | package |
i | nfsidmap | package |
i | patterns-openSUSE-base | package |
| patterns-openSUSE-file_server | package |
i | samba | package |
i | samba-client | package |
| samba-winbind | package |
| tftp | package |
| vsftpd | package |
| yast2-ftp-server | package |
| yast2-nfs-server | package |
i | yast2-samba-server | package |
| yast2-tftp-server | package |
To open zypper shell session, run the following command.
linuxhelp:~ # zypper shell
zypper>
zypper> repos
# | Alias | Name | Enabled | Refresh
--+---------------------------+------------------------------------+---------+--------
1 | openSUSE-13.2-0 | openSUSE-13.2-0 | Yes | No
2 | repo-debug | openSUSE-13.2-Debug | No | Yes
3 | repo-debug-update | openSUSE-13.2-Update-Debug | No | Yes
4 | repo-debug-update-non-oss | openSUSE-13.2-Update-Debug-Non-Oss | No | Yes
5 | repo-non-oss | openSUSE-13.2-Non-Oss | Yes | Yes
6 | repo-oss | openSUSE-13.2-Oss | Yes | Yes
7 | repo-source | openSUSE-13.2-Source | No | Yes
8 | repo-update | openSUSE-13.2-Update | Yes | Yes
9 | repo-update-non-oss | openSUSE-13.2-Update-Non-Oss | Yes | Yes
Use zypper lr or zypper repos command to list all the defined repositories.
linuxhelp:~ # zypper lr
# | Alias | Name | Enabled | Refresh
--+---------------------------+------------------------------------+---------+--------
1 | openSUSE-13.2-0 | openSUSE-13.2-0 | Yes | No
2 | repo-debug | openSUSE-13.2-Debug | No | Yes
3 | repo-debug-update | openSUSE-13.2-Update-Debug | No | Yes
4 | repo-debug-update-non-oss | openSUSE-13.2-Update-Debug-Non-Oss | No | Yes
5 | repo-non-oss | openSUSE-13.2-Non-Oss | Yes | Yes
6 | repo-oss | openSUSE-13.2-Oss | Yes | Yes
7 | repo-source | openSUSE-13.2-Source | No | Yes
8 | repo-update | openSUSE-13.2-Update | Yes | Yes
9 | repo-update-non-oss | openSUSE-13.2-Update-Non-Oss | Yes | Yes
To list URL for repositories, execute the following command.
linuxhelp:~ # zypper lr -u
# | Alias | Name | Enabled | Refresh | URI
--+---------------------------+------------------------------------+---------+---------+---------------------------------------------------------------------------------------
1 | openSUSE-13.2-0 | openSUSE-13.2-0 | Yes | No | cd:///?devices=/dev/disk/by-id/ata-VMware_Virtual_IDE_CDROM_Drive_10000000000000000001
2 | repo-debug | openSUSE-13.2-Debug | No | Yes | http://download.opensuse.org/debug/distribution/13.2/repo/oss/
3 | repo-debug-update | openSUSE-13.2-Update-Debug | No | Yes | http://download.opensuse.org/debug/update/13.2/
4 | repo-debug-update-non-oss | openSUSE-13.2-Update-Debug-Non-Oss | No | Yes | http://download.opensuse.org/debug/update/13.2-non-oss/
5 | repo-non-oss | openSUSE-13.2-Non-Oss | Yes | Yes | http://download.opensuse.org/distribution/13.2/repo/non-oss/
6 | repo-oss | openSUSE-13.2-Oss | Yes | Yes | http://download.opensuse.org/distribution/13.2/repo/oss/
7 | repo-source | openSUSE-13.2-Source | No | Yes | http://download.opensuse.org/source/distribution/13.2/repo/oss/
8 | repo-update | openSUSE-13.2-Update | Yes | Yes | http://download.opensuse.org/update/13.2/
9 | repo-update-non-oss | openSUSE-13.2-Update-Non-Oss | Yes | Yes | http://download.opensuse.org/update/13.2-non-oss/
To list repository priority.
linuxhelp:~ # zypper lr -p
# | Alias | Name | Enabled | Refresh | Priority
--+---------------------------+------------------------------------+---------+---------+---------
1 | openSUSE-13.2-0 | openSUSE-13.2-0 | Yes | No | 99
2 | repo-debug | openSUSE-13.2-Debug | No | Yes | 99
3 | repo-debug-update | openSUSE-13.2-Update-Debug | No | Yes | 99
4 | repo-debug-update-non-oss | openSUSE-13.2-Update-Debug-Non-Oss | No | Yes | 99
5 | repo-non-oss | openSUSE-13.2-Non-Oss | Yes | Yes | 99
6 | repo-oss | openSUSE-13.2-Oss | Yes | Yes | 99
7 | repo-source | openSUSE-13.2-Source | No | Yes | 99
8 | repo-update | openSUSE-13.2-Update | Yes | Yes | 99
9 | repo-update-non-oss | openSUSE-13.2-Update-Non-Oss | Yes | Yes | 99
Use zypper refresh or zypper ref to refresh the zypper repositories.
linuxhelp:~ # zypper refresh
Repository ' openSUSE-13.2-0' is up to date.
Repository ' openSUSE-13.2-Non-Oss' is up to date.
Repository ' openSUSE-13.2-Oss' is up to date.
Repository ' openSUSE-13.2-Update' is up to date.
Repository ' openSUSE-13.2-Update-Non-Oss' is up to date.
All repositories have been refreshed.
In order to refresh a specific repository, run the following command.
linuxhelp:~ # zypper refresh repo-oss
Repository ' openSUSE-13.2-Oss' is up to date.
Specified repositories have been refreshed.
Every repository in Zypper has its own unique number, so to disable repository type the following command to know its number.
linuxhelp:~ # zypper lr
# | Alias | Name | Enabled | Refresh
--+---------------------------+------------------------------------+---------+--------
1 | openSUSE-13.2-0 | openSUSE-13.2-0 | Yes | No
2 | repo-debug | openSUSE-13.2-Debug | No | Yes
3 | repo-debug-update | openSUSE-13.2-Update-Debug | No | Yes
4 | repo-debug-update-non-oss | openSUSE-13.2-Update-Debug-Non-Oss | No | Yes
5 | repo-non-oss | openSUSE-13.2-Non-Oss | Yes | Yes
6 | repo-oss | openSUSE-13.2-Oss | Yes | Yes
7 | repo-source | openSUSE-13.2-Source | No | Yes
8 | repo-update | openSUSE-13.2-Update | Yes | Yes
9 | repo-update-non-oss | openSUSE-13.2-Update-Non-Oss | Yes | Yes
The repository ‘ repo-update‘ having number 8, to disable this you need to specify number 8 in ' -d' option.
linuxhelp:~ # zypper mr -d 8
Repository ' repo-update' has been successfully disabled.
To enable again the same repository ‘ repo-update‘ , run the following command.
linuxhelp:~ # zypper mr -e 8
Repository ' repo-update' has been successfully enabled.
To enable auto-refresh and rpm file ‘ caching‘ for a repository called ‘ repo-oss‘ , and setting its priority as 85.
linuxhelp:~ # zypper mr -rk -p 85 repo-oss
RPM files caching has been enabled for repository ' repo-oss' .
Repository ' repo-oss' priority has been set to 85.
For disabling rpm file caching for all the repositories, run the following command.
linuxhelp:~ # zypper mr -ka
RPM files caching has been enabled for repository ' openSUSE-13.2-0' .
RPM files caching has been enabled for repository ' repo-debug' .
RPM files caching has been enabled for repository ' repo-debug-update' .
RPM files caching has been enabled for repository ' repo-debug-update-non-oss' .
RPM files caching has been enabled for repository ' repo-non-oss' .
RPM files caching has been enabled for repository ' repo-oss' .
RPM files caching has been enabled for repository ' repo-source' .
RPM files caching has been enabled for repository ' repo-update' .
RPM files caching has been enabled for repository ' repo-update-non-oss' .
To disable rpm file caching for remote repositories.
linuxhelp:~ # zypper mr -Kt
RPM files caching has been disabled for repository ' repo-debug' .
RPM files caching has been disabled for repository ' repo-debug-update' .
RPM files caching has been disabled for repository ' repo-debug-update-non-oss' .
RPM files caching has been disabled for repository ' repo-non-oss' .
RPM files caching has been disabled for repository ' repo-oss' .
RPM files caching has been disabled for repository ' repo-source' .
RPM files caching has been disabled for repository ' repo-update' .
RPM files caching has been disabled for repository ' repo-update-non-oss' .
To Add New Repository
To add Repository, make use of commands such as ‘ zypper addrepo‘ or ‘ zypper ar‘ and you can also use repo url. Now lets add a repository http://download.opensuse.org/update/12.3/
linuxhelp:~ # zypper ar http://download.opensuse.org/update/12.3/ myrepo
Adding repository ' myrepo' ......................................................[done]
Repository ' myrepo' successfully added
Enabled: Yes
Autorefresh: No
GPG check: Yes
URI: http://download.opensuse.org/update/12.3/
Use the command ‘ zypper namerepo‘ or ‘ zypper nr‘ to rename the repository appearing at number 1 to test.
linuxhelp:~ # zypper nr 1 test
Repository ' myrepo' renamed to ' test' .
Removing Repositories
Use the command ‘ zypper removerepo‘ or ‘ zypper rr‘ to remove a repository.
linuxhelp:~ # zypper rr test
Removing repository ' test' ....................................................[done]
Repository ' test' has been removed.
Comments ( 0 )
No comments available