Can one reinstall packages from a list?

I’ve been thinking about moving to the upcoming version 12.3, and think I’d like to do a clean install this time, rather than a distribution upgrade.

My question is this: is there a way to make a list of all the packages I’ve got installed on my system, do the clean install, then feed the list back into zypper to reinstall the missing ones? One can do the equivalent with a Debian-based distro, but I don’t know if you can do it with openSUSE or not.

Yes
You can do this in Yast Software Management
I never tried it though. Well, I have save the list. But to me it looks version specific. But on import it may well overlook that.

Remember too, it’s often some time before some packages are available for a new release. I’m talking stuff like in Packman…

True…it will probably be a while before Packman and NVIDIA have “official” 12.3 repos.

OTOH, I’m really liking the look ‘n’ feel of this beta.

Thanks for your answer. I’ll just do a clean install (and use my existing /home partition) when final is released.

you can probably save an existing list by running this and use it for future reference

zypper se -i -s -t package >install.txt

se- search
-i -installed
-s -details
-t type
If you can write and script and separate packages alone and give a single line space between them then you can very well install all of them in a single shot using zypper proded you have configured all the required repos.

zypper in <package1><space><package2><space>....

I’ve played a little around with zypper/rpm/bash and searched the internet. Now I’ve found my personal solution for the topic.

I’ll write it in short form, maybe later a little bit more detailed infos. Code is ugly with many piped grep commands, but it works. Suggestions for smarter code and maybe a shell script are welcome.
All commands can be done as $USER, expect final zypper command of course.

  1. Write all installed rpm packages to RPM-Packagelist.txt
rpm -qa --queryformat '%{name}
' | grep -v gpg-pubkey | tr '
' ' ' > RPM-Packagelist.txt
  1. Search for packages installed manually (by you) with zypper and translate newline characters to whitespace (zypper can not read a list with newlines)
cat /var/log/zypp/history | grep $HOSTNAME | cut -d\| -f3 | tr '
' ' ' > zypperlog.txt
  1. Compare RPM-Packagelist.txt to zypperlog.txt and write it to packages.txt. /var/log/zypp/history does not delete install lines when a package is removed. So we must compare the installed packages with the ones from zypperlog.txt because it will list packages you do not want anymore.
comm -13 RPM-Packagelist.txt zypperlog.txt > packages.txt
  1. Install the packages listed in packages.txt (as root)
zypper in `cat packages.txt`
  1. If you have packages installed from a local repo take care that the RPMs (including possible dependencies) are stored in the local repository (here /root/RPMS).
ls /root/RPMS > local-rpms.txt

Note: It may be possible that some packages are renamed after some time or are removed from a repo. Have a look at zypper output.