This article provides a guide for how to copy all packages from one server to another. This could be helpful for many applications, such as running a development server, preparing a server for migration, setting up a cluster, and so forth.
How to Copy All Packages from One Server to Another
This guide assumes you are dealing with servers which are running the same OS and version.
To copy all packages from one server to another, follow the steps below:
- SSH your existing server as root.
- Run the following command:
rpm -qa --qf "%{NAME}\n" > rpmlist.txt
This will save the package list in a file called 'rpmlist.txt'. - Copy this file to your new server.
- From the new server, run the following command, assuming you copied the file to the same location on the new server:
dnf install `cat rpmlist.txt|tr '\n' ' '`
- Confirm the installation task to begin installing the packages.
Conclusion
You now know how to copyall packages form one server to another using command line interface.