Clone packages from one system to another (broken dnf and sys python fix)

From vpsget wiki
Revision as of 20:26, 1 December 2020 by Ndi (talk | contribs) (Created page with "Here we will show how to download installed packages from one Centos/RHE to another Centos\RHE where both server OS version is equal. On a current example we also show how...")
(diff) ← Older revision | Latest revision (diff) | Newer revision → (diff)
Jump to: navigation, search

Here we will show how to download installed packages from one Centos/RHE to another Centos\RHE where both server OS version is equal.

On a current example we also show how to fix the broken DNF / yum ... this may happens when you accidentaly installed python from a sources into the system python folder.

Se we have SRV1 - where everything working fine and SRV2 where problem occur and we need to clone the packages from one system to another. Also keep in mind that on SRV2 dnf and yum not working so ou able to use rpm or build from a sources (if you have previously installed Dev Tools with cmake/make)

on SRV1:

Check python packages installed:

rpm -qa | grep python 
rpm -qa | grep dnf

Create dir for rpms:

mkdir /opt/myrpms

Download all installed packages into folder:

cd /opt/myrpms 
rpm -qa | grep python | while read line; do echo $line && yumdownloader --resolve $line; done
rpm -qa | grep dnf | while read line; do echo $line && yumdownloader --resolve $line; done

!Keep an eye to output: if you will note that some packages were not downloaded /missed. SO better to run yum update first!

Copy folder with downloaded rpms to your SRV2

scp -r /opt/myrpms  213.108.199.135:/opt/