mirror of
https://gitea.com/mcereda/oam.git
synced 2026-02-09 05:44:23 +00:00
chore(zypper): reviewed article, added snippets
This commit is contained in:
1
.vscode/settings.json
vendored
1
.vscode/settings.json
vendored
@@ -253,6 +253,7 @@
|
|||||||
"rego",
|
"rego",
|
||||||
"replicatedctl",
|
"replicatedctl",
|
||||||
"resolv",
|
"resolv",
|
||||||
|
"resolvables",
|
||||||
"rfkill",
|
"rfkill",
|
||||||
"ripsecrets",
|
"ripsecrets",
|
||||||
"rmmod",
|
"rmmod",
|
||||||
|
|||||||
@@ -1,8 +1,7 @@
|
|||||||
# The Zypper package manager
|
# The Zypper package manager
|
||||||
|
|
||||||
SUSE and openSUSE GNU/Linux's package management utility and command-line interface to the ZYpp system management library (`libzypp`).
|
SUSE and openSUSE GNU/Linux's package management utility and command-line interface to the ZYpp system management
|
||||||
|
library (`libzypp`).
|
||||||
## Table of contents <!-- omit in toc -->
|
|
||||||
|
|
||||||
1. [TL;DR](#tldr)
|
1. [TL;DR](#tldr)
|
||||||
1. [Concepts](#concepts)
|
1. [Concepts](#concepts)
|
||||||
@@ -10,7 +9,7 @@ SUSE and openSUSE GNU/Linux's package management utility and command-line interf
|
|||||||
1. [Configuration](#configuration)
|
1. [Configuration](#configuration)
|
||||||
1. [Gotchas](#gotchas)
|
1. [Gotchas](#gotchas)
|
||||||
1. [Further readings](#further-readings)
|
1. [Further readings](#further-readings)
|
||||||
1. [Sources](#sources)
|
1. [Sources](#sources)
|
||||||
|
|
||||||
## TL;DR
|
## TL;DR
|
||||||
|
|
||||||
@@ -35,10 +34,16 @@ Default files:
|
|||||||
Command examples:
|
Command examples:
|
||||||
|
|
||||||
```sh
|
```sh
|
||||||
# Update the package cache.
|
# Update caches.
|
||||||
zypper refresh
|
zypper refresh
|
||||||
zypper ref 'updates'
|
zypper ref 'updates'
|
||||||
|
|
||||||
|
# Clean caches.
|
||||||
|
zypper clean --metadata
|
||||||
|
zypper clean --all 'packman'
|
||||||
|
|
||||||
|
# ---
|
||||||
|
|
||||||
# Search for resolvables.
|
# Search for resolvables.
|
||||||
zypper search 'nmap'
|
zypper search 'nmap'
|
||||||
zypper se -r 'repository' 'mariadb'
|
zypper se -r 'repository' 'mariadb'
|
||||||
@@ -63,7 +68,7 @@ zypper in --no-recommends 'gv' 'virtualbox-ose=2.0.6' '/root/ansible.rpm'
|
|||||||
|
|
||||||
# Install from specific repositories.
|
# Install from specific repositories.
|
||||||
# Requires the repo to be already added.
|
# Requires the repo to be already added.
|
||||||
zypper in -r 'packman' 'libavdevice60'
|
zypper in -r 'packman' --download-in-heaps 'libavdevice60'
|
||||||
zypper in -r 'https://repo.vivaldi.com/archive/vivaldi-suse.repo' 'vivaldi'
|
zypper in -r 'https://repo.vivaldi.com/archive/vivaldi-suse.repo' 'vivaldi'
|
||||||
|
|
||||||
# Reinstall resolvables.
|
# Reinstall resolvables.
|
||||||
@@ -74,7 +79,7 @@ zypper in -f 'amdgpu-dkms'
|
|||||||
zypper source-install -d 'dbus-1'
|
zypper source-install -d 'dbus-1'
|
||||||
zypper si 'dolphin-plugins'
|
zypper si 'dolphin-plugins'
|
||||||
|
|
||||||
# Check the dependencies of *installed* packages are satisfied.
|
# Check the dependencies of *installed* resolvables are satisfied.
|
||||||
zypper verify 'git-lfs'
|
zypper verify 'git-lfs'
|
||||||
zypper ve 'virtualbox'
|
zypper ve 'virtualbox'
|
||||||
|
|
||||||
@@ -88,9 +93,9 @@ zypper in '!Firefox' '-htop'
|
|||||||
zypper list-updates
|
zypper list-updates
|
||||||
zypper lu --all
|
zypper lu --all
|
||||||
|
|
||||||
# Update installed packages.
|
# Update installed resolvables.
|
||||||
zypper update
|
zypper update
|
||||||
zypper up 'vivaldi-stable'
|
zypper up --download-in-heaps 'vivaldi-stable'
|
||||||
|
|
||||||
# List available patches.
|
# List available patches.
|
||||||
# By default, it shows only *applicable* ones.
|
# By default, it shows only *applicable* ones.
|
||||||
@@ -104,23 +109,23 @@ zypper pchk --with-optional
|
|||||||
# Apply patches.
|
# Apply patches.
|
||||||
zypper patch
|
zypper patch
|
||||||
|
|
||||||
# Perform a distribution upgrade.
|
# Perform distribution upgrades.
|
||||||
zypper dist-upgrade
|
zypper dist-upgrade
|
||||||
zypper dup --details --from 'factory' --from 'packman'
|
zypper dup --details --from 'factory' --from 'packman' --download-in-heaps
|
||||||
|
|
||||||
# List unneded packages.
|
# List unneded packages.
|
||||||
# E.g. older dependencies not used anymore.
|
# E.g. older dependencies not used anymore.
|
||||||
zypper packages --unneeded
|
zypper packages --unneeded
|
||||||
zypper pa --unneeded
|
zypper pa --unneeded
|
||||||
|
|
||||||
|
# ---
|
||||||
|
|
||||||
# List currently defined repositories.
|
# List repositories.
|
||||||
zypper repos
|
zypper repos
|
||||||
zypper rl -d --sort-by-priority
|
zypper lr -d --sort-by-priority
|
||||||
|
|
||||||
# Add repositories.
|
# Add repositories.
|
||||||
zypper addrepo --check --refresh --priority '90' \
|
zypper addrepo --check --refresh --priority '90' 'https://repo.vivaldi.com/archive/vivaldi-suse.repo' 'vivaldi'
|
||||||
'https://repo.vivaldi.com/archive/vivaldi-suse.repo' 'vivaldi'
|
|
||||||
zypper ar -cfp '89' …
|
zypper ar -cfp '89' …
|
||||||
|
|
||||||
# Remove repositories.
|
# Remove repositories.
|
||||||
@@ -136,10 +141,7 @@ zypper nr '5' 'packman'
|
|||||||
zypper modifyrepo -er 'updates'
|
zypper modifyrepo -er 'updates'
|
||||||
zypper mr -da
|
zypper mr -da
|
||||||
|
|
||||||
|
# ---
|
||||||
# Clean caches.
|
|
||||||
zypper clean --metadata
|
|
||||||
zypper clean --all 'packman'
|
|
||||||
|
|
||||||
# Execute without user confirmation (non-interactively).
|
# Execute without user confirmation (non-interactively).
|
||||||
zypper --non-interactive …
|
zypper --non-interactive …
|
||||||
@@ -150,8 +152,16 @@ zypper purge-kernels --dry-run
|
|||||||
# Clean up unneded packages.
|
# Clean up unneded packages.
|
||||||
# Always check what is being done.
|
# Always check what is being done.
|
||||||
zypper packages --unneeded \
|
zypper packages --unneeded \
|
||||||
| awk -F'|' 'NR>4{gsub(" ", "", $0);print $3"="$4}' \
|
| awk -F'|' 'NR>4{gsub(" ", "", $0);print $3"="$4}' | sort -u \
|
||||||
| sort -u | sudo xargs zypper rm -u
|
| sudo xargs zypper rm -u
|
||||||
|
|
||||||
|
# Upgrade distribution's releases.
|
||||||
|
sudo zypper refresh \
|
||||||
|
&& sudo zypper update \
|
||||||
|
&& sed -i 's|/15.5/|/${releasever}/|g' '/etc/zypp/repos.d/'*'.repo' \
|
||||||
|
&& sudo zypper --releasever '15.6' refresh \
|
||||||
|
&& sudo zypper --releasever '15.6' dist-upgrade \
|
||||||
|
&& sudo reboot
|
||||||
```
|
```
|
||||||
|
|
||||||
## Concepts
|
## Concepts
|
||||||
@@ -161,13 +171,17 @@ In contrast to normal repositories, @System provides packages that can only be d
|
|||||||
|
|
||||||
Installed packages which do not belong to any available repository are denoted as _unwanted_, _orphaned_ or _dropped_.
|
Installed packages which do not belong to any available repository are denoted as _unwanted_, _orphaned_ or _dropped_.
|
||||||
|
|
||||||
One can specify the location of packages or repositories using any type of URI supported by `libzypp` (e.g. local paths, ftp/https/other URI).<br/>
|
One can specify the location of packages or repositories using any type of URI supported by `libzypp` (e.g. local paths,
|
||||||
In addition, Zypper accepts openSUSE Build Service repositories in the `addrepo` command in the form of `obs://project/platform` URI.
|
ftp/https/other URI).<br/>
|
||||||
|
In addition, Zypper accepts openSUSE Build Service repositories in the `addrepo` command in the form of
|
||||||
|
`obs://project/platform` URI.
|
||||||
|
|
||||||
Resource objects are called _resolvables_.<br/>
|
Resource objects are called _resolvables_.<br/>
|
||||||
They might be **packages**, **patches**, **patterns**, **products**, or basically any kind of object with dependencies to other objects managed by `libzypp`.
|
They might be **packages**, **patches**, **patterns**, **products**, or basically any kind of object with dependencies
|
||||||
|
to other objects managed by `libzypp`.
|
||||||
|
|
||||||
If one does not request specific versions of resolvables during an action, Zypper's dependency solver will pick a _reasonable_ one automatically.
|
If one does not request specific versions of resolvables during an action, Zypper's dependency solver will pick a
|
||||||
|
_reasonable_ one automatically.
|
||||||
|
|
||||||
## Repositories
|
## Repositories
|
||||||
|
|
||||||
@@ -209,30 +223,28 @@ sudo rpm --query --list 'parallel'
|
|||||||
- [Managing software with command line tools]
|
- [Managing software with command line tools]
|
||||||
- [Zypp configuration options]
|
- [Zypp configuration options]
|
||||||
|
|
||||||
## Sources
|
### Sources
|
||||||
|
|
||||||
All the references in the [further readings] section, plus the following:
|
|
||||||
|
|
||||||
- [Package repositories]
|
- [Package repositories]
|
||||||
- [Additional package repositories]
|
- [Additional package repositories]
|
||||||
- [Command to clean out all unneeded autoinstalled dependencies]
|
- [Command to clean out all unneeded autoinstalled dependencies]
|
||||||
|
- [System upgrade]
|
||||||
|
|
||||||
<!--
|
<!--
|
||||||
References
|
Reference
|
||||||
|
═╬═Time══
|
||||||
-->
|
-->
|
||||||
|
|
||||||
|
<!-- Knowledge base -->
|
||||||
|
[rpm]: rpm.md
|
||||||
|
|
||||||
<!-- Upstream -->
|
<!-- Upstream -->
|
||||||
[additional package repositories]: https://en.opensuse.org/Additional_package_repositories
|
[additional package repositories]: https://en.opensuse.org/Additional_package_repositories
|
||||||
[command to clean out all unneeded autoinstalled dependencies]: https://github.com/openSUSE/zypper/issues/116
|
[command to clean out all unneeded autoinstalled dependencies]: https://github.com/openSUSE/zypper/issues/116
|
||||||
[managing software with command line tools]: https://documentation.suse.com/sles/15-SP5/html/SLES-all/cha-sw-cl.html
|
[managing software with command line tools]: https://documentation.suse.com/sles/15-SP5/html/SLES-all/cha-sw-cl.html
|
||||||
[package repositories]: https://en.opensuse.org/Package_repositories
|
[package repositories]: https://en.opensuse.org/Package_repositories
|
||||||
|
[system upgrade]: https://en.opensuse.org/SDB:System_upgrade
|
||||||
[zypp configuration options]: https://doc.opensuse.org/projects/libzypp/HEAD/group__ZyppConfig.html
|
[zypp configuration options]: https://doc.opensuse.org/projects/libzypp/HEAD/group__ZyppConfig.html
|
||||||
|
|
||||||
<!-- In-article sections -->
|
|
||||||
[further readings]: #further-readings
|
|
||||||
|
|
||||||
<!-- Knowledge base -->
|
|
||||||
[rpm]: rpm.md
|
|
||||||
|
|
||||||
<!-- Others -->
|
<!-- Others -->
|
||||||
[how can i list all files which have been installed by an zypp/zypper package?]: https://unix.stackexchange.com/questions/162092/how-can-i-list-all-files-which-have-been-installed-by-an-zypp-zypper-package#239944
|
[how can i list all files which have been installed by an zypp/zypper package?]: https://unix.stackexchange.com/questions/162092/how-can-i-list-all-files-which-have-been-installed-by-an-zypp-zypper-package#239944
|
||||||
|
|||||||
79
snippets/zypper.sh
Normal file
79
snippets/zypper.sh
Normal file
@@ -0,0 +1,79 @@
|
|||||||
|
#!/usr/bin/env sh
|
||||||
|
|
||||||
|
# Update the cache
|
||||||
|
sudo zypper refresh
|
||||||
|
sudo zypper ref 'updates'
|
||||||
|
sudo zypper ref --releasever '15.6'
|
||||||
|
|
||||||
|
# Search for resolvables
|
||||||
|
zypper search 'nmap'
|
||||||
|
zypper se -r 'mariadb-repo' 'mariadb'
|
||||||
|
zypper se -s 'kernel-default'
|
||||||
|
zypper se --details 'boinc-client'
|
||||||
|
|
||||||
|
# Display resolvables' detailed information
|
||||||
|
zypper info 'workrave'
|
||||||
|
zypper if -t 'patch' 'libzypp'
|
||||||
|
zypper if -t 'pattern' 'lamp_server'
|
||||||
|
|
||||||
|
# Install resolvables
|
||||||
|
sudo zypper install 'parallel'
|
||||||
|
sudo zypper in --no-confirm --download-in-heaps 'https://prerelease.keybase.io/keybase_amd64.rpm'
|
||||||
|
sudo zypper in --no-recommends 'gv' 'virtualbox-ose=2.0.6' '/root/ansible.rpm'
|
||||||
|
sudo zypper in -r 'https://repo.vivaldi.com/archive/vivaldi-suse.repo' 'vivaldi'
|
||||||
|
sudo zypper in -f 'amdgpu-dkms'
|
||||||
|
|
||||||
|
# Check the dependencies of *installed* resolvables are satisfied
|
||||||
|
zypper verify 'git-lfs'
|
||||||
|
zypper ve 'virtualbox'
|
||||||
|
|
||||||
|
# Remove resolvables
|
||||||
|
sudo zypper remove --clean-deps 'code'
|
||||||
|
sudo zypper rm -u 'zfs'
|
||||||
|
sudo zypper in '!Firefox' '-htop'
|
||||||
|
|
||||||
|
# Clean caches
|
||||||
|
sudo zypper clean --metadata
|
||||||
|
sudo zypper clean --all 'packman'
|
||||||
|
|
||||||
|
# List available udates
|
||||||
|
# By default, it shows only *installable* ones
|
||||||
|
zypper list-updates
|
||||||
|
zypper lu --all --releasever '15.6'
|
||||||
|
|
||||||
|
# Update installed resolvables.
|
||||||
|
sudo zypper update
|
||||||
|
sudo zypper up 'vivaldi-stable'
|
||||||
|
|
||||||
|
# Perform distribution upgrades.
|
||||||
|
sudo zypper dist-upgrade
|
||||||
|
sudo zypper dup --details --from 'factory' --from 'packman'
|
||||||
|
sudo zypper --releasever '15.6' --download-in-heaps dup
|
||||||
|
|
||||||
|
# List repositories
|
||||||
|
zypper repos
|
||||||
|
zypper lr -d --sort-by-priority
|
||||||
|
|
||||||
|
# Add repositories
|
||||||
|
sudo zypper addrepo --check --refresh --priority '90' 'https://repo.vivaldi.com/archive/vivaldi-suse.repo' 'vivaldi'
|
||||||
|
|
||||||
|
# Remove repositories
|
||||||
|
sudo zypper removerepo 'mozilla'
|
||||||
|
sudo zypper rr '3'
|
||||||
|
|
||||||
|
# Clean up installed kernel packages
|
||||||
|
zypper purge-kernels --dry-run
|
||||||
|
|
||||||
|
# Clean up unneded packages
|
||||||
|
# Always check what is being done
|
||||||
|
zypper packages --unneeded \
|
||||||
|
| awk -F'|' 'NR>4{gsub(" ", "", $0);print $3"="$4}' | sort -u \
|
||||||
|
| sudo xargs -p zypper rm -u
|
||||||
|
|
||||||
|
# Upgrade distribution's releases
|
||||||
|
sudo zypper refresh
|
||||||
|
sudo zypper update
|
||||||
|
sed -i 's|/15.5/|/${releasever}/|g' '/etc/zypp/repos.d/'*'.repo'
|
||||||
|
sudo zypper --releasever '15.6' refresh
|
||||||
|
sudo zypper --releasever '15.6' dist-upgrade
|
||||||
|
sudo reboot
|
||||||
Reference in New Issue
Block a user