How do we copy ‘Yum Repositories Configs’ from one server to another

Imagine, you have java package not available in your SERVER#1 and you know it is available with SERVER#2.
Then you can copy the require yum repositories configs from SERVER#2 to SERVER#1 as below and do a yum install.

1) Check whether the required package is available with SERVER#2 by doing ‘yum install <package_name>’ (OR) ‘yum list <package_name>’
2) Compare the repository configs list on both the servers with command “yum repolist”
3) Check the repository configuration folder in the /etc/yum.conf, usually it’s /etc/yum.repos.d/
4) Scp the required repository configs to SERVER#1, do not overwrite with existing ones.
5) Refresh & check the repository config list on the SERVER#1 with ‘yum repolist’ command.
6) Remove any un-resolved repositories. You should able to ping the repository config host ip.
7) Now, try install with “yum install <package_name>”

Find following illustration for more understanding on how to do it, please share your suggestions/alternatives for it.

At SERVER#2 :-
————–

[root@SERVER2 hpadmin]# yum install java
NOT-CERTIFIED | 1.1 kB 00:00
NOT-CERTIFIED/primary | 2.0 MB 00:00
NOT-CERTIFIED 4141/4141
soe6local | 951 B 00:00
soe6products | 951 B 00:00
soe6products/primary | 348 kB 00:00
soe6products 974/974
soe6products-engineering | 951 B 00:00
soe6u4 | 951 B 00:00
soe6u4/primary | 1.5 MB 00:00
soe6u4 791/791
soe6u4-engineering | 951 B 00:00
soe6u4-testing | 951 B 00:00
Setting up Install Process
Resolving Dependencies
–> Running transaction check
—> Package java-1.5.0-gcj.x86_64 0:1.5.0.0-29.1.el6 will be installed
NOT-CERTIFIED/filelists | 3.7 MB 00:00
soe6products/filelists | 371 kB 00:00
soe6u4/filelists | 481 kB 00:00
–> Finished Dependency Resolution

Dependencies Resolved

============================================================================================================================================================================================================================================
Package Arch Version Repository Size
============================================================================================================================================================================================================================================
Installing:
java-1.5.0-gcj x86_64 1.5.0.0-29.1.el6 NOT-CERTIFIED 146 k
Installing for dependencies:
alsa-lib x86_64 1.0.22-3.el6 NOT-CERTIFIED 370 k
atk x86_64 1.30.0-1.el6 NOT-CERTIFIED 196 k
avahi-libs x86_64 0.6.25-12.el6_5.1 NOT-CERTIFIED 54 k
cairo x86_64 1.8.8-3.1.el6 NOT-CERTIFIED 309 k
cups-libs x86_64 1:1.4.2-50.el6_4.5 NOT-CERTIFIED 317 k
gtk2 x86_64 2.20.1-4.el6 NOT-CERTIFIED 3.3 M
hicolor-icon-theme noarch 0.11-1.1.el6 NOT-CERTIFIED 40 k
jasper-libs x86_64 1.900.1-15.el6_1.1 NOT-CERTIFIED 136 k
java_cup x86_64 1:0.10k-5.el6 NOT-CERTIFIED 197 k
jpackage-utils noarch 1.7.5-3.12.el6 NOT-CERTIFIED 59 k
libXcomposite x86_64 0.4.3-4.el6 NOT-CERTIFIED 20 k
libXcursor x86_64 1.1.13-6.20130524git8f677eaea.el6 NOT-CERTIFIED 28 k
libXdamage x86_64 1.1.3-4.el6 NOT-CERTIFIED 18 k
libXfixes x86_64 5.0-3.el6 NOT-CERTIFIED 23 k
libXi x86_64 1.6.1-3.el6 NOT-CERTIFIED 35 k
libXinerama x86_64 1.1.2-2.el6 NOT-CERTIFIED 20 k
libXrandr x86_64 1.4.0-1.el6 NOT-CERTIFIED 36 k
libXtst x86_64 1.2.1-2.el6 NOT-CERTIFIED 29 k
libart_lgpl x86_64 2.3.20-5.1.el6 NOT-CERTIFIED 65 k
libgcj x86_64 4.4.7-4.el6 NOT-CERTIFIED 19 M
libthai x86_64 0.1.12-3.el6 NOT-CERTIFIED 183 k
libtiff x86_64 3.9.4-10.el6_5 NOT-CERTIFIED 343 k
pango x86_64 1.28.1-7.el6_3 NOT-CERTIFIED 350 k
pixman x86_64 0.26.2-5.1.el6_5 NOT-CERTIFIED 201 k
shared-mime-info x86_64 0.70-4.el6 NOT-CERTIFIED 209 k
sinjdoc x86_64 0.5-9.1.el6 NOT-CERTIFIED 705 k
Updating for dependencies:
glib2 x86_64 2.26.1-7.el6_5 NOT-CERTIFIED 1.6 M

Transaction Summary
============================================================================================================================================================================================================================================
Install 27 Package(s)
Upgrade 1 Package(s)

Total download size: 27 M
Is this ok [y/N]: n
Exiting on user Command
[root@SERVER2 hpadmin]#
[root@SERVER2 hpadmin]#
[root@SERVER2 hpadmin]# java -version
java version “1.8.0_05”
Java(TM) SE Runtime Environment (build 1.8.0_05-b13)
Java HotSpot(TM) 64-Bit Server VM (build 25.5-b02, mixed mode)
[root@SERVER2 hpadmin]#

[root@SERVER2 hpadmin]# yum repolist
repo id repo name status
NOT-CERTIFIED NOT-CERTIFIED 4,141
soe6local SOE Linux 6 local pacakges 0
soe6products SOE Linux 6 products including VTMs 974
soe6products-engineering SOE Linux 6 products including VTMs – Engineering 0
soe6u4 SOE Linux 6 Update 4 791
soe6u4-engineering SOE Linux 6 Update 4 – Engineering 0
soe6u4-testing SOE Linux 6 Update 4 – Testing 0
repolist: 5,906
[root@SERVER2 hpadmin]#

[root@SERVER2 etc]# cat yum.conf
[main]
cachedir=/var/cache/yum/$basearch/$releasever
keepcache=0
debuglevel=2
logfile=/var/log/yum.log
exactarch=1
obsoletes=1
gpgcheck=1
plugins=1
installonly_limit=3

# This is the default, if you make this bigger yum won’t see if the metadata
# is newer on the remote and so you’ll “gain” the bandwidth of not having to
# download the new metadata and “pay” for it by yum not having correct
# information.
# It is esp. important, to have correct metadata, for distributions like
# Fedora which don’t keep old packages around. If you don’t like this checking
# interupting your command line usage, it’s much better to have something
# manually check the metadata once an hour (yum-updatesd will do this).
# metadata_expire=90m

# PUT YOUR REPOS HERE OR IN separate files named file.repo
# in /etc/yum.repos.d
[root@SERVER2 etc]#

[root@SERVER2 etc]# cd /etc/yum.repos.d/
[root@SERVER2 yum.repos.d]# ll -lhtr
total 20K
-rw-r–r– 1 root root 529 Jan 29 2013 rhel-source.repo
-rw-r–r– 1 root root 438 Mar 26 13:24 soe-prod.repo
-rw-r–r– 1 root root 539 Jun 4 15:24 soe-engineering.repo
-rw-r–r– 1 root root 498 Jun 4 16:46 soe-testing.repo
-rw-r–r– 1 root root 121 Jun 4 17:11 nc.repo
[root@SERVER2 yum.repos.d]#
[root@SERVER2 yum.repos.d]#
[root@SERVER2 yum.repos.d]# scp * oracle@SERVER1:/tmp

PAM Authentication
Password:
nc.repo | 121B | 11.3kiB/s | TOC: 00:00:00 | 100%
rhel-source.repo | 529B | 65.6kiB/s | TOC: 00:00:00 | 100%
soe-engineering.repo | 539B | 60.4kiB/s | TOC: 00:00:00 | 100%
soe-prod.repo | 438B | 48.4kiB/s | TOC: 00:00:00 | 100%
soe-testing.repo | 498B | 61.4kiB/s | TOC: 00:00:00 | 100%
[root@SERVER2 yum.repos.d]#

[root@SERVER2 yum.repos.d]# nslookup gdsks1
Server: 192.193.215.65
Address: 192.193.215.65#53

Non-authoritative answer:
Name: gdsks1.nam.nsroot.net
Address: 150.110.234.138

[root@SERVER2 yum.repos.d]#

At SERVER#1 :-
————–

[Lab root @ SERVER1 ] # yum install java
http://gdsks1/SOELinux/repos/prod/soe6local-x86_64/repodata/repomd.xml: [Errno 14] PYCURL ERROR 6 – “Couldn’t resolve host ‘gdsks1′”
Trying other mirror.
http://gdsks1/SOELinux/repos/prod/soe6products-x86_64/repodata/repomd.xml: [Errno 14] PYCURL ERROR 6 – “Couldn’t resolve host ‘gdsks1′”
Trying other mirror.
http://gdsks1/SOELinux/repos/prod/soe6u4-x86_64/repodata/repomd.xml: [Errno 14] PYCURL ERROR 6 – “Couldn’t resolve host ‘gdsks1′”
Trying other mirror.
Setting up Install Process
No package java available.
Error: Nothing to do
[Lab root @ SERVER1 ] #

[Lab root @ iSERVER1 /tmp] # cp *.repo /etc/yum.repos.d/
cp: overwrite `/etc/yum.repos.d/rhel-source.repo’? n
cp: overwrite `/etc/yum.repos.d/soe-engineering.repo’? n
cp: overwrite `/etc/yum.repos.d/soe-prod.repo’? n
cp: overwrite `/etc/yum.repos.d/soe-testing.repo’? n
[Lab root @ SERVER1 /tmp]

[Lab root @ SERVER1 /etc/yum.repos.d] # ll -lhtr
total 20K
-rw-r–r– 1 root root 529 Jan 29 2013 rhel-source.repo
-rw-r–r– 1 root root 426 Oct 24 2013 soe-prod.repo
-rw-r–r– 1 root root 486 Oct 24 2013 soe-testing.repo
-rw-r–r– 1 root root 140 Nov 18 2013 soe6gdeproducts.repo
-rw-r–r– 1 root root 121 Jun 26 03:37 nc.repo
[Lab root @ SERVER1 /etc/yum.repos.d]
[Lab root @ SERVER1 /etc/yum.repos.d]
[Lab root @ SERVER1 /etc/yum.repos.d]
[Lab root @ SERVER1 /etc/yum.repos.d]# yum repolist
repo id repo name status
NOT-CERTIFIED NOT-CERTIFIED 4,141
soe6gdeproducts soe6gdeproducts 94
repolist: 4,235
[Lab root @ SERVER1 /etc/yum.repos.d]
#
[Lab root @ SERVER1 /etc/yum.repos.d]
#
[Lab root @ SERVER1 /etc/yum.repos.d] # yum install java
Setting up Install Process
Resolving Dependencies
–> Running transaction check
—> Package java-1.5.0-gcj.x86_64 0:1.5.0.0-29.1.el6 will be installed
–> Processing Dependency: jpackage-utils >= 1.7.3 for package: java-1.5.0-gcj-1.5.0.0-29.1.el6.x86_64
–> Processing Dependency: libgcj >= 4.1.2-5 for package: java-1.5.0-gcj-1.5.0.0-29.1.el6.x86_64
–> Processing Dependency: sinjdoc for package: java-1.5.0-gcj-1.5.0.0-29.1.el6.x86_64
–> Processing Dependency: /usr/bin/gij for package: java-1.5.0-gcj-1.5.0.0-29.1.el6.x86_64
–> Processing Dependency: /usr/bin/gcj-dbtool for package: java-1.5.0-gcj-1.5.0.0-29.1.el6.x86_64
–> Processing Dependency: /usr/lib64/security/classpath.security for package: java-1.5.0-gcj-1.5.0.0-29.1.el6.x86_64

Dependencies Resolved

============================================================================================================================================================================================================================================
Package Arch Version Repository Size
============================================================================================================================================================================================================================================
Installing:
java-1.5.0-gcj x86_64 1.5.0.0-29.1.el6 NOT-CERTIFIED 146 k
Installing for dependencies:
alsa-lib x86_64 1.0.22-3.el6 NOT-CERTIFIED 370 k
atk x86_64 1.30.0-1.el6 NOT-CERTIFIED 196 k
avahi-libs x86_64 0.6.25-12.el6_5.1 NOT-CERTIFIED 54 k
cairo x86_64 1.8.8-3.1.el6 NOT-CERTIFIED 309 k
cups-libs x86_64 1:1.4.2-50.el6_4.5 NOT-CERTIFIED 317 k
gtk2 x86_64 2.20.1-4.el6 NOT-CERTIFIED 3.3 M
hicolor-icon-theme noarch 0.11-1.1.el6 NOT-CERTIFIED 40 k
jasper-libs x86_64 1.900.1-15.el6_1.1 NOT-CERTIFIED 136 k
java_cup x86_64 1:0.10k-5.el6 NOT-CERTIFIED 197 k
jpackage-utils noarch 1.7.5-3.12.el6 NOT-CERTIFIED 59 k
libXcomposite x86_64 0.4.3-4.el6 NOT-CERTIFIED 20 k
libXcursor x86_64 1.1.13-6.20130524git8f677eaea.el6 NOT-CERTIFIED 28 k
libXdamage x86_64 1.1.3-4.el6 NOT-CERTIFIED 18 k
libXfixes x86_64 5.0-3.el6 NOT-CERTIFIED 23 k
libXrandr x86_64 1.4.0-1.el6 NOT-CERTIFIED 36 k
libart_lgpl x86_64 2.3.20-5.1.el6 NOT-CERTIFIED 65 k
libgcj x86_64 4.4.7-4.el6 NOT-CERTIFIED 19 M
libthai x86_64 0.1.12-3.el6 NOT-CERTIFIED 183 k
libtiff x86_64 3.9.4-10.el6_5 NOT-CERTIFIED 343 k
pango x86_64 1.28.1-7.el6_3 NOT-CERTIFIED 350 k
pixman x86_64 0.26.2-5.1.el6_5 NOT-CERTIFIED 201 k
shared-mime-info x86_64 0.70-4.el6 NOT-CERTIFIED 209 k
sinjdoc x86_64 0.5-9.1.el6 NOT-CERTIFIED 705 k
Updating for dependencies:
glib2 x86_64 2.26.1-7.el6_5 NOT-CERTIFIED 1.6 M

Transaction Summary
============================================================================================================================================================================================================================================
Install 24 Package(s)
Upgrade 1 Package(s)

Total download size: 27 M
Is this ok [y/N]: y
Downloading Packages:
(1/25): alsa-lib-1.0.22-3.el6.x86_64.rpm | 370 kB 00:00
(2/25): atk-1.30.0-1.el6.x86_64.rpm | 196 kB 00:00
(3/25): avahi-libs-0.6.25-12.el6_5.1.x86_64.rpm | 54 kB 00:00
(4/25): cairo-1.8.8-3.1.el6.x86_64.rpm | 309 kB 00:00
(5/25): cups-libs-1.4.2-50.el6_4.5.x86_64.rpm | 317 kB 00:00
(6/25): glib2-2.26.1-7.el6_5.x86_64.rpm | 1.6 MB 00:00
(7/25): gtk2-2.20.1-4.el6.x86_64.rpm | 3.3 MB 00:00
(8/25): hicolor-icon-theme-0.11-1.1.el6.noarch.rpm | 40 kB 00:00
(9/25): jasper-libs-1.900.1-15.el6_1.1.x86_64.rpm | 136 kB 00:00
(10/25): java-1.5.0-gcj-1.5.0.0-29.1.el6.x86_64.rpm | 146 kB 00:00
(11/25): java_cup-0.10k-5.el6.x86_64.rpm | 197 kB 00:00
(12/25): jpackage-utils-1.7.5-3.12.el6.noarch.rpm | 59 kB 00:00
(13/25): libXcomposite-0.4.3-4.el6.x86_64.rpm | 20 kB 00:00
(14/25): libXcursor-1.1.13-6.20130524git8f677eaea.el6.x86_64.rpm | 28 kB 00:00
(15/25): libXdamage-1.1.3-4.el6.x86_64.rpm | 18 kB 00:00
(16/25): libXfixes-5.0-3.el6.x86_64.rpm | 23 kB 00:00
(17/25): libXrandr-1.4.0-1.el6.x86_64.rpm | 36 kB 00:00
(18/25): libart_lgpl-2.3.20-5.1.el6.x86_64.rpm | 65 kB 00:00
(19/25): libgcj-4.4.7-4.el6.x86_64.rpm | 19 MB 00:01
(20/25): libthai-0.1.12-3.el6.x86_64.rpm | 183 kB 00:00
(21/25): libtiff-3.9.4-10.el6_5.x86_64.rpm | 343 kB 00:00
(22/25): pango-1.28.1-7.el6_3.x86_64.rpm | 350 kB 00:00
(23/25): pixman-0.26.2-5.1.el6_5.x86_64.rpm | 201 kB 00:00
(24/25): shared-mime-info-0.70-4.el6.x86_64.rpm | 209 kB 00:00
(25/25): sinjdoc-0.5-9.1.el6.x86_64.rpm | 705 kB 00:00
——————————————————————————————————————————————————————————————————————————————–

Installed:
java-1.5.0-gcj.x86_64 0:1.5.0.0-29.1.el6

Dependency Installed:
alsa-lib.x86_64 0:1.0.22-3.el6 atk.x86_64 0:1.30.0-1.el6 avahi-libs.x86_64 0:0.6.25-12.el6_5.1 cairo.x86_64 0:1.8.8-3.1.el6 cups-libs.x86_64 1:1.4.2-50.el6_4.5
gtk2.x86_64 0:2.20.1-4.el6 hicolor-icon-theme.noarch 0:0.11-1.1.el6 jasper-libs.x86_64 0:1.900.1-15.el6_1.1 java_cup.x86_64 1:0.10k-5.el6 jpackage-utils.noarch 0:1.7.5-3.12.el6
libXcomposite.x86_64 0:0.4.3-4.el6 libXcursor.x86_64 0:1.1.13-6.20130524git8f677eaea.el6 libXdamage.x86_64 0:1.1.3-4.el6 libXfixes.x86_64 0:5.0-3.el6 libXrandr.x86_64 0:1.4.0-1.el6
libart_lgpl.x86_64 0:2.3.20-5.1.el6 libgcj.x86_64 0:4.4.7-4.el6 libthai.x86_64 0:0.1.12-3.el6 libtiff.x86_64 0:3.9.4-10.el6_5 pango.x86_64 0:1.28.1-7.el6_3
pixman.x86_64 0:0.26.2-5.1.el6_5 shared-mime-info.x86_64 0:0.70-4.el6 sinjdoc.x86_64 0:0.5-9.1.el6

Dependency Updated:
glib2.x86_64 0:2.26.1-7.el6_5

Complete!
[Lab root @ SERVER1 /etc/yum.repos.d]

  • Ask Question