Removing a repository that is no longer trusted, no longer needed, or no longer part of the patching plan keeps package resolution predictable on openSUSE and SLES. This is useful after retiring a test feed, replacing a vendor source, or cleaning up a system that has accumulated one-off repositories over time.
On SUSE systems, Zypper keeps each repository as a named definition with an alias, a display name, and a base URI. Listing repositories first makes it easy to match the source that needs to be removed, and zypper removerepo then deletes that repository definition from the local package-manager configuration.
Repository numbers can change whenever the repository list is modified, so the alias is the safer identifier for removal commands. Removing a repository does not uninstall packages that were already installed from it, and software that only came from that source can later show up as orphaned and may need review with
zypper packages --orphaned
.
$ sudo zypper repos --uri Repository priorities are without effect. All enabled repositories share the same priority. # | Alias | Name | Enabled | GPG Check | Refresh | URI ---+-----------------------+-----------------------------------------+---------+-----------+---------+-------------------------------------------------------------- 1 | localrepo-test | localrepo-test | Yes | ( p) Yes | No | dir:/tmp/localrepo 2 | repo-backports-update | Update repository of openSUSE Backports | Yes | ( p) Yes | Yes | http://download.opensuse.org/update/leap/15.6/backports/ 3 | repo-oss | Main Repository | Yes | ( p) Yes | Yes | http://download.opensuse.org/distribution/leap/15.6/repo/oss/ ##### snipped #####
Use the repository alias from the Alias column for the removal command. The numeric repository number can change after repositories are added, removed, or reordered.
$ sudo zypper removerepo localrepo-test Removing repository 'localrepo-test' [...........done] Repository 'localrepo-test' has been removed.
The same command also accepts a repository name, number, or URI, but the alias is the safest long-term identifier.
$ sudo zypper repos --uri Repository priorities are without effect. All enabled repositories share the same priority. # | Alias | Name | Enabled | GPG Check | Refresh | URI ---+-----------------------+-----------------------------------------+---------+-----------+---------+-------------------------------------------------------------- 1 | repo-backports-update | Update repository of openSUSE Backports | Yes | ( p) Yes | Yes | http://download.opensuse.org/update/leap/15.6/backports/ 2 | repo-oss | Main Repository | Yes | ( p) Yes | Yes | http://download.opensuse.org/distribution/leap/15.6/repo/oss/ 3 | repo-update | Main Update Repository | Yes | ( p) Yes | Yes | http://download.opensuse.org/update/leap/15.6/oss/ ##### snipped #####
The removal is complete when the deleted alias is absent from the list.