SUSE (Software and System Entwicklung (Germany) meaning Software and System Development, in English) Linux lies on top of Linux Kernel brought by Novell. SUSE comes in two pack. One of them is called OpenSUSE, which is freely available (free as in speech as well as free as in wine). It is a community driven project packed with latest application support, the latest stable release of OpenSUSE Linux is 13.2.
The other is SUSE Linux Enterprise which is a commercial Linux Distribution designed specially for enterprise and production. SUSE Linux Enterprise edition comes with a variety of Enterprise Applications and features suited for production environment, the latest stable release of SUSE Linux Enterprise Edition is 12.
You may like to check the detailed installation instruction of SUSE Linux Enterprise Server at:
- [Installation of SUSE Linux Enterprise Server 12][1]
Zypper and YaST are the Package Manager for SUSE Linux, which works on top of RPM.
YaST which stands for Yet another Setup Tool is a tool that works on OpenSUSE and SUSE Enterprise edition to administer, setup and configure SUSE Linux.
Zypper is the command line interface of ZYpp package manager for installing, removing and updating SUSE. ZYpp is the package management engine that powers both Zypper and YaST.
Here in this article we will see Zypper in action, which will be installing, updating, removing and doing every other thing a package manager can do. Here we go…
**Important** : Remember all these command are meant for system wide changes hence must be run as root, else the command will fail.
### Getting Basic Help with Zypper ###
1. Run zypper without any option, will give you a list of all global options and commands.
# zypper
Usage:
zypper [--global-options]
2. To get help on a specific command say ‘in’ (install), run the below commands.
| gnome-desktop2-lang | Languages for package gnome-desktop2 | package
| gnome-desktop2 | The GNOME Desktop API Library | package
| libgnome-desktop-2-17 | The GNOME Desktop API Library | package
| libgnome-desktop-3-10 | The GNOME Desktop API Library | package
| libgnome-desktop-3-devel | The GNOME Desktop API Library -- Development Files | package
| libgnome-desktop-3_0-common | The GNOME Desktop API Library -- Common data files | package
| gnome-desktop-debugsource | Debug sources for package gnome-desktop | package
| gnome-desktop-sharp2-debugsource | Debug sources for package gnome-desktop-sharp2 | package
| gnome-desktop2-debugsource | Debug sources for package gnome-desktop2 | package
| libgnome-desktop-2-17-debuginfo | Debug information for package libgnome-desktop-2-17 | package
| libgnome-desktop-3-10-debuginfo | Debug information for package libgnome-desktop-3-10 | package
| libgnome-desktop-3_0-common-debuginfo | Debug information for package libgnome-desktop-3_0-common | package
| libgnome-desktop-2-17-debuginfo-32bit | Debug information for package libgnome-desktop-2-17 | package
| libgnome-desktop-3-10-debuginfo-32bit | Debug information for package libgnome-desktop-3-10 | package
| gnome-desktop-sharp2 | Mono bindings for libgnome-desktop | package
| libgnome-desktop-2-devel | The GNOME Desktop API Library -- Development Files | package
| gnome-desktop-lang | Languages for package gnome-desktop | package
| libgnome-desktop-2-17-32bit | The GNOME Desktop API Library | package
| libgnome-desktop-3-10-32bit | The GNOME Desktop API Library | package
| gnome-desktop | The GNOME Desktop API Library | srcpackage
4. Get information on a pattern package (say lamp_server) using following command.
# zypper info -t pattern lamp_server
Loading repository data...
Reading installed packages...
Information for pattern lamp_server:
------------------------------------
Repository: openSUSE-13.2-Update
Name: lamp_server
Version: 20141007-5.1
Arch: x86_64
Vendor: openSUSE
Installed: No
Visible to User: Yes
Summary: Web and LAMP Server
Description:
Software to set up a Web server that is able to serve static, dynamic, and interactive content (like a Web shop). This includes Apache HTTP Server, the database management system MySQL,
and scripting languages such as PHP, Python, Ruby on Rails, or Perl.
Building repository 'openSUSE-13.2-Non-Oss' cache ............................................................[done]
Specified repositories have been refreshed.
#### Modifying Repositories ####
Here, we use ‘zypper modifyrepo‘ or ‘zypper mr‘ commands to disable, enable zypper repositories.
12. Before disabling repository, you must know that in Zypper, every repository has its own unique number, that is used to disable or enable a repository.
Let’s say you want to disable repository ‘repo-oss‘, to disable first you need to its number by typing following command.
Do you see in the above output, that the repository ‘repo-oss‘ having number 6, to disable this you need to specify number 6 along with following command.
# zypper mr -d 6
Repository 'repo-oss' has been successfully disabled.
13. To enable again same repository ‘repo-oss‘, which appears at number 6 (as shown in above example).
# zypper mr -e 6
Repository 'repo-oss' has been successfully enabled.
14. Enable auto-refresh and rpm file ‘caching‘ for a repo say ‘repo-non-oss‘ and set its priority to say 85.
# zypper mr -rk -p 85 repo-non-oss
Repository 'repo-non-oss' priority has been left unchanged (85)
Nothing to change for repository 'repo-non-oss'.
15. Disable rpm file caching for all the repositories.
# zypper mr -Ka
RPM files caching has been disabled for repository 'openSUSE-13.2-0'.
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'.
16. Enable rpm file caching for all the repositories.
# 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'.
17. Disable rpm file caching for remote repositories.
# 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'.
18. Enable rpm file caching for remote repositories.
# zypper mr -kt
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'.
#### Adding Repositories ####
You may make use of any of the two commands –‘zypper addrepo‘ or ‘zypper ar‘. You may use repo url or alias to add Repository.
19. Add a repository say “http://download.opensuse.org/update/12.3/”.
# zypper ar http://download.opensuse.org/update/11.1/ update
20. Rename a repository. It will change the alias only. You may use command ‘zypper namerepo‘ or ‘zypper nr‘. To rename aka change alias of a repo that appears at number 10 (zypper lr) to upd8, run the below command.
# zypper nr 10 upd8
Repository 'update' renamed to 'upd8'.
#### Removing Repositories ####
21. Remove a repository. It will remove the repository from the system. You may use the command ‘zypper removerepo‘ or ‘zypper rr‘. To remove a repo say ‘upd8‘, run the below command.
The following NEW package is going to be installed:
mariadb
1 new package to install.
Overall download size: 0 B. Already cached: 7.8 MiB After the operation, additional 71.8 MiB will be used.
Continue? [y/n/? shows all options] (y):
...
43. Generate quiet output at UN-installation.
# zypper --quiet rm mariadb
44. Auto agree to Licenses/Agreements.
# zypper patch --auto-agree-with-licenses
Loading repository data...
Reading installed packages...
Resolving package dependencies...
Nothing to do.
#### Clean Zypper Cache and View History ####
45. If you want to clean zypper cache only, you can use following command.
# zypper clean
All repositories have been cleaned up.
If you want to clean metadata and package cache at once you may like to pass –all/-a with zypper as.
# zypper clean -a
All repositories have been cleaned up.
46. To view logs of any installed, updated or removed packages through zypper, are logged in /var/log/zypp/history. You may cat it to view or may use filter to get a custom output.
47. You can use ‘dist-upgrade‘ option with zypper command to upgrade your current Suse Linux to most recent version.
# zypper dist-upgrade
You are about to do a distribution upgrade with all enabled repositories. Make sure these repositories are compatible before you continue. See 'man zypper' for more information about this command.
Building repository 'openSUSE-13.2-0' cache .....................................................................[done]
Building repository 'openSUSE-13.2-Non-Oss' cache ...............................................................[done]
That’s all for now. Hope this article would help you in managing you SUSE System and Server specially for newbies. If you feel that I left certain commands (Human are erroneous) you may provide us with the feedback in the comments so that we can update the article. Keep Connected, Keep Commenting, Stay tuned. Kudos!