local rpm repostry, that contains all packages installed on system

Solution 1:

There are 2 options

Either use rpm (Red Hat Package Manager) or yum (Yellowdog Updater/Modifier)

1) RPM

rpm -qa > to_be_installed; while read -r package; do yum -y install "$package"; done < to_be_installed

2) YUM

yum list installed | awk 'NR>1{print $1}' > to_be_installed; while read -r line; do yum -y install "$line"; done < to_be_installed

Hope this gives you some ideas how to do it.

Solution 2:

You can get a list of installed packages with yum list installed, you may want to clean it up a bit with

yum list installed | awk 'NR >2 {print $1}' >installed.pkg

Once you have the list you can use the yumdownloader utility to download the packages

for file in $(cat installed.pkg)
do
    yumdownloader "$file"
done

this will download all of the rpms to the current directory.