Results 1 to 5 of 5

Thread: What's the best way to import / export package lists between installations?

  1. #1
    Join Date
    Jan 2009
    Location
    Romania, Bucharest
    Posts
    763

    Default What's the best way to import / export package lists between installations?

    I'm going to do a clean reinstall of openSUSE on an SSD I'm getting next week. The new install will contain the exact same software as my old one, and of course I don't wish to remember and manually reinstall every custom package I'm using. Therefore I'm looking for a safe way to export my current package setup to a text file on my home partition, and once the new installation finishes simply import that in, after I also reconfigure my RPM repositories which I can easily do manually. There are a few ways to achieve this, but not all of them are as obvious as I'd have hoped... it thus felt safest to ask about this in case anyone has any better ideas.

    The only user friendly method seems to be with YaST: When you go into Software Management and click File, you have the options "Import..." and "Export...". Export generates a file called user-packages.xml which Import can then bring back. If nothing goes wrong that's likely the method I'll be using, but I wanted to have a failsafe in case there's any problem with this one.

    The other way I was hoping for was with zypper, however it doesn't seem to have a builtin command for this sort of thing. I did however find a thread explaining how to use a combination of rpm and zypper commands to transfer package lists between machines. I wanted to ask if that approach was tested and is going to actually work. Here is what I'll be using:

    Export:
    Code:
    rpm -qa --queryformat "%{NAME}\n" > /foo/bar.txt
    Import:
    Code:
    zypper install $(cat /foo/bar.txt)
    Note that I'm trying to avoid formats that also include the package version, only its name and arch. It's for the unlikely event that during my installation, openSUSE decides to release a new OS snapshot and update countless packages, in which case the versions would no longer match and the import process may complain it can't find those packages. I only care to have the latest version of everything as installed by 'zypper dup' so this shouldn't be a problem. Which method do you recommend?
    openSUSE Tumbleweed x64, KDE Framework 5

  2. #2
    Join Date
    Jun 2008
    Location
    Groningen, Netherlands
    Posts
    19,854
    Blog Entries
    14

    Default Re: What's the best way to import / export package lists between installations?

    What you describe as your second option is what I did last year when I had to replace my laptop. Mind, I did reuse ( parts of ) /etc and /var
    ° Appreciate my reply? Click the star and let me know why.

    ° Perfection is not gonna happen. No way.

    https://en.opensuse.org/openSUSE:Board#Members
    http://en.opensuse.org/User:Knurpht
    http://nl.opensuse.org/Gebruiker:Knurpht

  3. #3

    Default Re: What's the best way to import / export package lists between installations?

    Hi,

    For that purpose, that Import syntax should work because package names are not allowed to have spaces in them.
    Also only the package name should appear from that output, so you don't have to worry about the version being mixed up.
    I always do almost similar way when installing in a vm and upgrading to a new openSUSE version.
    So I suggest you try it a vm first if that makes you feel more comfortable.
    "Unfortunately time is always against us" -- [Morpheus]

    .:https://github.com/Jetchisel:.

  4. #4
    Join Date
    Nov 2013
    Location
    Kamloops, BC, Canada
    Posts
    3,974

    Default Re: What's the best way to import / export package lists between installations?

    Quote Originally Posted by MirceaKitsune View Post
    The other way I was hoping for was with zypper, however it doesn't seem to have a builtin command for this sort of thing. I did however find a thread explaining how to use a combination of rpm and zypper commands to transfer package lists between machines. I wanted to ask if that approach was tested and is going to actually work. Here is what I'll be using:

    Export:
    Code:
    rpm -qa --queryformat "%{NAME}\n" > /foo/bar.txt
    Import:
    Code:
    zypper install $(cat /foo/bar.txt)
    Note that I'm trying to avoid formats that also include the package version, only its name and arch. It's for the unlikely event that during my installation, openSUSE decides to release a new OS snapshot and update countless packages, in which case the versions would no longer match and the import process may complain it can't find those packages. I only care to have the latest version of everything as installed by 'zypper dup' so this shouldn't be a problem. Which method do you recommend?
    EXPORT LIST OF SOFTWARE PACKAGES to a file:
    Code:
    rpm -qai | grep "^Name        :" | awk '{print $3}' | xargs > rpm_pkgs_list
    IMPORT/INSTALL then exported list of software packages into new system:
    Code:
    zypper in $(cat rpm_pkgs_list)
    -Gerry Makaro
    Fraser-Bell Info Tech
    Solving Tech Mysteries since the Olden Days!
    ~~
    If I helped you, consider clicking the Star at the bottom left of my post.

  5. #5
    Join Date
    Jan 2009
    Location
    Romania, Bucharest
    Posts
    763

    Default Re: What's the best way to import / export package lists between installations?

    Reinstallation finished. The YaST2 - Software Manager xml did the trick perfectly, I didn't even need to try the package list I exported manually. I'll still keep doing backups both ways so that I always have a failsafe in case one option doesn't work for any reason.
    openSUSE Tumbleweed x64, KDE Framework 5

Tags for this Thread

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •