Learn and Discover Open Source with Daily Genuine Experience. From Coding, Design, Package Management Tweak to Desktop Customization.
 
   

Table of Content

This is a four-parts article. There are few sections here.

Part One
  • Preface: Test Bed
  • Getting Started With Docker
  • Issues on Minimal Install: No Reset, No Manual
  • Package Management: ZYpp Frontend, Get Help, Zypper Shell
  • Updating System: OS Release, List Updates, Update, Upgrades, Patch Check, Process Being Used
  • Package IRSIF: Install, Download Only, Removal, Dependency Removal, Query Search, Show Info, File List
  • What's Next
Part Two
  • Dependency: Help, Dependency, Reverse Dependency, Test, Verify
  • Group: Pattern
  • System Wide: List Packages
  • History: The Log File
  • Clean Up
  • What's Next
Part Three
  • Repositories: List, Add/Remove, Modify, Service List, Additional, Mirror
  • What's Next
Part Four
  • Build from Source: General Requirement, Download and Extract, Build Dependencies, Source Path, Build, Install RPM
  • Inspect Package: rpmlint, rpm -Qpl, rpmls, rpm2cpio
  • Hold Package: Case Example, Add Lock, Test Example, Remove Lock
  • Interesting Issue: systemd Dependencies
  • Conclusion

Repository

Zypper has amazing repository commands.

List Repository

Like usual, zypper manual is more than enough. I mean, always check the fine manual first.

$ zypper help repos
repos (lr) [options] [repo] ...

List all defined repositories.

  Command options:
-e, --export <FILE.repo>  Export all defined repositories as a single local .repo file.
-a, --alias               Show also repository alias.
-n, --name                Show also repository name.
-u, --uri                 Show also base URI of repositories.
-p, --priority            Show also repository priority.
-r, --refresh             Show also the autorefresh flag.
-d, --details             Show more information like URI, priority, type.
-s, --service             Show also alias of parent service.
-E, --show-enabled-only   Show enabled repos only.
-U, --sort-by-uri         Sort the list by URI.
-P, --sort-by-priority    Sort the list by repository priority.
-A, --sort-by-alias       Sort the list by alias.
-N, --sort-by-name        Sort the list by name.

Docker Zypper: Help Repository

Consider getting started with this simple command.

$ zypper lr

or a more complex one.

$ zypper repos -p -E -N
# | Alias   | Name    | Enabled | GPG Check | Refresh | Priority
--+---------+---------+---------+-----------+---------+---------
1 | non-oss | NON-OSS | Yes     | (r ) Yes  | Yes     |   99    
2 | oss     | OSS     | Yes     | (r ) Yes  | Yes     |   99    

Docker Zypper: Repository -p -E -N

openSUSE put it in /etc/zypp/repos.d/. Like most configuration in unix world, you can edit manualy.

$ ls /etc/zypp/repos.d/
non-oss.repo  oss.repo

Docker Zypp: /etc/zypp/repos.d/

And here is what each repository configuration.

$ cat /etc/zypp/repos.d/oss.repo 
[oss]
name=OSS
enabled=1
autorefresh=1
baseurl=http://download.opensuse.org/tumbleweed/repo/oss/
path=/
type=yast2
keeppackages=0

Docker Zypp: /etc/zypp/repos.d/oss.repo

There is also zypper refresh command.

$ zypper ref    
Repository 'NON-OSS' is up to date.                                 
Repository 'OSS' is up to date.                                     
All repositories have been refreshed.

Docker Zypper: Refresh

zypper refresh support process for specific repository.

$ zypper ref -f oss
Forcing raw metadata refresh
Retrieving repository 'OSS' metadata .........................[done]
Forcing building of repository cache
Building repository 'OSS' cache ..............................[done]
Specified repositories have been refreshed.

Docker Zypper: Refresh Specific

Add/ Remove

It has been a riddle for a SUSE’s beginner like me, thinking about how openSUSE handle my weird favorites package, such as herbstluftwm. In openSUSE we have to add X11:windowmanagers first, using zypper addrepo command.

$ zypper ar http://download.opensuse.org/repositories/X11:windowmanagers/openSUSE_Tumbleweed/X11:windowmanagers.repo
Adding repository 'Various window managers (openSUSE_Tumbleweed)' ................................[done]
Repository 'Various window managers (openSUSE_Tumbleweed)' successfully added

URI         : http://download.opensuse.org/repositories/X11:/windowmanagers/openSUSE_Tumbleweed/
Enabled     : Yes                                                                               
GPG Check   : Yes                                                                               
Autorefresh : No                                                                                
Priority    : 99 (default priority)                                                             

Repository priorities are without effect. All enabled repositories share the same priority.

Docker Zypper: Add Repository

And refresh.

$ zypper ref
Retrieving repository 'Various window managers (openSUSE_Tumbleweed)' metadata ...................[done]
Building repository 'Various window managers (openSUSE_Tumbleweed)' cache ........................[done]
Repository 'NON-OSS' is up to date.                                                                     
Repository 'OSS' is up to date.                                                                         
All repositories have been refreshed.

Docker Zypper: Refresh Newly Added

So that we can install herbstluftwm.

$ zypper install herbstluftwm
Loading repository data...
Reading installed packages...
Resolving package dependencies...

The following 5 NEW packages are going to be installed:
  herbstluftwm libX11-6 libX11-data libXau6 libxcb1

5 new packages to install.
Overall download size: 866.3 KiB. Already cached: 0 B. After the
operation, additional 2.9 MiB will be used.
Continue? [y/n/...? shows all options] (y): y

Docker Zypper: Install Herbstluftwm

If you want, you can remove the newly add repository.

$ zypper rr X11_windowmanagers
Removing repository 'Various window managers (openSUSE_Tumbleweed)' ..............................[done]
Repository 'Various window managers (openSUSE_Tumbleweed)' has been removed.

Docker Zypper: Remove Repository

Modify

Always check the fine manual, like usual.

$ zypper help modifyrepo
...
  Command options:
-d, --disable             Disable the repository (but don't remove it).
-e, --enable              Enable a disabled repository.
-r, --refresh             Enable auto-refresh of the repository.
-R, --no-refresh          Disable auto-refresh of the repository.
-n, --name <name>         Set a descriptive name for the repository.
-p, --priority <integer>  Set priority of the repository.
-k, --keep-packages       Enable RPM files caching.
-K, --no-keep-packages    Disable RPM files caching.
...
-a, --all                 Apply changes to all repositories.
-l, --local               Apply changes to all local repositories.
-t, --remote              Apply changes to all remote repositories.
-m, --medium-type <type>  Apply changes to repositories of specified type.

I like to change to change the repo directly, especially the long name, so I do not need to have long column in my terminal. And also I disable this newly added repo.

$ cat /etc/zypp/repos.d/X11_windowmanagers.repo 
[X11_windowmanagers]
name=Window Managers
enabled=0
autorefresh=0

Docker Nano: Window Managers

Consider zypper repos again.

$ zypper repos
Repository priorities are without effect. All enabled repositories share the same priority.

# | Alias              | Name            | Enabled | GPG Check | Refresh
--+--------------------+-----------------+---------+-----------+--------
1 | X11_windowmanagers | Window Managers | No      | ----      | ----   
2 | non-oss            | NON-OSS         | Yes     | (r ) Yes  | Yes    
3 | oss                | OSS             | Yes     | (r ) Yes  | Yes  

Docker Zypper: Repos Newly Added

Note that X11_windowmanagers has 1 index. Now we can enable it again using this command

$ zypper mr -e 1
Repository 'X11_windowmanagers' has been successfully enabled.

Or using name, to make a clearer mandate.

$ zypper mr -e X11_windowmanagers
Nothing to change for repository 'X11_windowmanagers'.

Docker Zypper: mr enable

And multiple command at once. Raise priority.

$ zypper mr -r -k -p 70 X11_windowmanagers      
Autorefresh has been enabled for repository 'X11_windowmanagers'.
RPM files caching has been enabled for repository 'X11_windowmanagers'.
Repository 'X11_windowmanagers' priority has been set to 70.

Docker Zypper: mr multiple

Or all remote repository at once.

$ zypper mr -Kt
RPM files caching has been disabled for repository 'X11_windowmanagers'.
Nothing to change for repository 'non-oss'.
Nothing to change for repository 'oss'.

Docker Zypper: mr remotes

Service List

There are other related command as well. I found this, about a month after this article written.

$ zypper service-list
# | Alias              | Name            | Enabled | GPG Check | Refresh | Type  
--+--------------------+-----------------+---------+-----------+---------+-------
1 | X11_windowmanagers | Window Managers | No      | ----      | ----    | rpm-md
2 | non-oss            | non-oss         | Yes     | (r ) Yes  | No      | yast2 
3 | oss                | oss             | Yes     | (r ) Yes  | No      | yast2 
4 | oss-jp             | oss-jp          | No      | ----      | ----    | yast2 

Docker Zypper: service list

Additional

There are also additional repository contain specific package, i.e driver and multimedia codec provided by packman.

Consider enable packman repository.

$ sudo zypper ar -f -n packman http://ftp.gwdg.de/pub/linux/misc/packman/suse/openSUSE_Tumbleweed/ packman
Adding repository 'packman' ..................................[done]
Repository 'packman' successfully added

URI         : http://ftp.gwdg.de/pub/linux/misc/packman/suse/openSUSE_Tumbleweed/
Enabled     : Yes                                                                
GPG Check   : Yes                                                                
Autorefresh : Yes                                                                
Priority    : 99 (default priority)                                              

Repository priorities in effect:    (See 'zypper lr -P' for details)
      70 (raised priority)  :  1 repository  
      99 (default priority) :  3 repositories

Docker Zypper: Additional Packman

Sometimes packman cannot be reach. For this docker, I would rather remove it.

Mirror

Sometimes you need to switch mirror, whether just to find nearest mirror such as your campus, or because the main repository is has been down for a few hours. Unfortunately I can not find good reference on how to switch mirror in openSUSE.

All you need to do is go check the site, and make sure you check the column.

$ zypper ar http://ftp.riken.jp/Linux/opensuse/tumbleweed/repo/oss/ oss-jp
Adding repository 'oss-jp' ...................................[done]
Repository 'oss-jp' successfully added

URI         : http://ftp.riken.jp/Linux/opensuse/tumbleweed/repo/oss/
Enabled     : Yes                                                    
GPG Check   : Yes                                                    
Autorefresh : No                                                     
Priority    : 99 (default priority)                                  

Repository priorities are without effect. All enabled repositories share the same priority.
$ zypper ref oss-jp
Retrieving repository 'oss-jp' metadata ......................[done]
Building repository 'oss-jp' cache ...........................[done]
Specified repositories have been refreshed.

Docker openSUSE: Mirror

After this you may safely disable main repository.

$ zypper mr -d oss   
Repository 'oss' has been successfully disabled.

Switching mirror has never been easier.

$ zypper mr -d oss-jp
Repository 'oss-jp' has been successfully disabled.

$ zypper mr -e oss   
Repository 'oss' has been successfully enabled.

What’s Next

We have not finished yet. There is still Build from Source. Consider finish reading [ Part Four ].

Thank you for reading


Epsi Nurwijayadi bio photo
By Epsi Nurwijayadi