大网数据广告活动
服务器运维问答

How to install packages from list with zypper?

· 52CE 我爱测

End state. I want to reformat my / partition, reinstall opensuse tumbleweed, and have the same packages installed then as now. Problem. I made what appears to be a poor choice, formatting the root filesystem as btrfs. The 20 GB I…

问题原文

原帖链接 · A. R. Diederich · CC BY-SA 3.0

End state. I want to reformat my / partition, reinstall opensuse tumbleweed, and have the same packages installed then as now.

Problem. I made what appears to be a poor choice, formatting the root filesystem as btrfs. The 20 GB I had for it was plenty previously with, say, ext3, but I can't keep up with the snapshot management with snapper with the large number of updates tumbleweed does.

Partial success. I can export my repository list with sudo zypper lr -u --export repo.list, and add that back to a fresh install with sudo zypper addrepo repo.list. I can export a list of installed pakcages with sudo zypper search --installed-only > installed.packages or rpm -qa | sort.

But I don't know how to install packages from a list, or generate a list of packages that can be used by opensuse at distribution install time.

Edit: autoyast may be the way to go, but is more heavyweight than I was looking for.

已采纳解答

原帖链接 · y5nijpn6qc3 · CC BY-SA 3.0

Use --queryformat to list package names without version

rpm -qa --qf "%{NAME}\n" > installed_pkgs.txt

To install, pipe content of the file to xargs

cat installed_pkgs.txt | xargs sudo zypper install

摘自公开归档,保留原文语言,版式经整理,外部媒体与邮箱地址已移除。

资料来源与适用范围

资料来源
Server Fault
适用范围
以原帖系统、软件版本与发布日期为准(2016-08-27)
内容语言
中文;命令、路径和错误标识保留技术原文
本地收录日期
2026-11-15
授权说明
CC BY-SA 3.0

正文与所需资源由本站本地存储。查看来源及更新记录 ↗

请按适用版本和实际日志确认原因;本站没有对每一种系统或设备逐项执行文中的操作。