Configure Linux yum Server Step by Step Guide on 6uX

This post will describe how to configure YUM Repository in OEL/RHEL, there are many post on this and this one is just an another blog to define it works perfectly if we configure it correctly.

Let me start:

1. We need to create a directory that will solve our purpose to have all RPM placed.

In our case we created a new directory – repository under root directory.1

2. Now mount the iso file in VMWare and go to Server Directory under RHEL iso file image.2

3. Check whether ISO file has been mounted and go to Server Directory:7

4. Now for verification check how many packages are there to be copied and copy all rpm in /root/repository folder like below.

3

5. Now verify that if we are able to use yum before we start configuring yum repository.4

6. Now install yum packages to use it for repository.5

7. We also need need to install “createrepo” package to create repository for this Linux Box.6

8. So now we have installed required packages, now we need to create a repository. Now go to /root directory where we created “repository” directory. Run the command – createrepo -v repository (-v is not mandatory)

[root@oragyan1 ~]# createrepo -v repository
/usr/share/createrepo/dumpMetadata.py:24: DeprecationWarning: the md5 module is deprecated; use hashlib instead
import md5
/usr/share/createrepo/dumpMetadata.py:25: DeprecationWarning: the sha module is deprecated; use the hashlib module instead
import sha
/usr/share/createrepo/dumpMetadata.py:47: DeprecationWarning: use the name attribute
fname = self.filename[:-3]
1/3040 – libbdevid-python-5.1.19.6-54.x86_64.rpm
2/3040 – blas-3.0-37.el5.x86_64.rpm
3/3040 – bogl-devel-0.1.18-11.2.1.el5.1.x86_64.rpm
4/3040 – fonts-gujarati-2.3.1-1.el5.noarch.rpm
5/3040 – man-pages-de-0.4-11.noarch.rpm

*

* <== Output Trimmed

*

3036/3040 – gnome-python2-libegg-2.14.2-6.el5.x86_64.rpm
3037/3040 – openobex-devel-1.3-3.1.i386.rpm
3038/3040 – kdelibs-3.5.4-22.el5_3.x86_64.rpm
3039/3040 – xsri-2.1.0-10.fc6.x86_64.rpm
3040/3040 – parted-1.8.1-23.el5.i386.rpm

Saving Primary metadata
Saving file lists metadata
Saving other metadata
[root@oragyan1 ~]#

9. Now check hostname and change directory to /etc/yum.repos.d. copy sample repository file to the file with any name you want with .repo extension and open it, normally we usually name it with our directory name to remember e.g (repository.repo):

[root@oragyan1 yum.repos.d]# hostname
oragyan1.localdomain.com
[root@oragyan1 yum.repos.d]#
[root@oragyan1 yum.repos.d]# pwd
/etc/yum.repos.d
[root@oragyan1 yum.repos.d]# ls
public-yum-ol6.repo
[root@oragyan1 yum.repos.d]#
[root@oragyan1 yum.repos.d]# cp public-yum-ol6.repo repository.repo
[root@oragyan1 yum.repos.d]#
[root@oragyan1 yum.repos.d]# vi repository.repo
[root@oragyan1 yum.repos.d]#
[root@oragyan1 yum.repos.d]# cat repository.repo
[ol6_latest]
name=Oracle Linux $releasever Latest ($basearch)
baseurl=http://public-yum.oracle.com/repo/OracleLinux/OL6/latest/$basearch/
gpgkey=http://public-yum.oracle.com/RPM-GPG-KEY-oracle-ol6
gpgcheck=1
enabled=1
[root@oragyan1 yum.repos.d]#

Edit the file with vi editor:

[root@oragyan1 yum.repos.d]# vi repository.repo
[root@oragyan1 yum.repos.d]#

10. Finally repository.repo should contain the content like below.

[root@oragyan1 yum.repos.d]# cat repository.repo
[repository]
name=oragyan1.localdomain.com
baseurl=file:///root/repository
gpgcheck=0
enabled=1
[root@oragyan1 yum.repos.d]#

Value of Enabled should be 1.

11. Make Sure your /etc/yum.repos.d directory should not contain any other repo file, else YUM may fail to get the required result, create an old directory and copy all other file except the current one in use.

It should be like below, i faced problem due to this i will share that problem in my next post-:

[root@oragyan1 yum.repos.d]# ls -lrt
total 8
-rw-r–r–. 1 root root 96 Aug 12 14:43 repository.repo
drwxr-xr-x. 2 root root 4096 Aug 12 22:08 old
[root@oragyan1 yum.repos.d]#

12. Now run the below commands:

[root@oragyan1 ~]# yum clean all
Plugin “filter-data” can’t be imported
/usr/lib/yum-plugins/kmod.py:25: DeprecationWarning: the sets module is deprecated
from sets import Set, ImmutableSet
Plugin “rhnplugin” can’t be imported
Loaded plugins: aliases, changelog, downloadonly, fastestmirror, keys, kmod, list-data, protect-packages, protectbase, refresh-packagekit, rhnplugin, security, tmprepo,
: verify, versionlock
Cleaning up Everything
[root@oragyan1 ~]#
[root@oragyan1 ~]# yum makecache
Plugin “filter-data” can’t be imported
/usr/lib/yum-plugins/kmod.py:25: DeprecationWarning: the sets module is deprecated
from sets import Set, ImmutableSet
Plugin “rhnplugin” can’t be imported
Loaded plugins: aliases, changelog, downloadonly, fastestmirror, keys, kmod, list-data, protect-packages, protectbase, refresh-packagekit, rhnplugin, security, tmprepo,
: verify, versionlock
This system is not registered with ULN.
ULN Satellite or ULN Classic support will be disabled.
Determining fastest mirrors
repository | 951 B 00:00 …
repository/filelists | 2.9 MB 00:00 …
repository/primary | 1.0 MB 00:00 …
repository/other | 8.8 MB 00:00 …
repository 3040/3040
repository 3040/3040
repository 3040/3040
Metadata Cache Created
[root@oragyan1 ~]#

You can also run –

[root@oragyan1 ~]# yum list all

It will show everything in this repository.

Now finally install the telnet using yum.

[root@oragyan1 ~]#

[root@oragyan1 ~]# yum install telnet
Plugin “filter-data” can’t be imported
/usr/lib/yum-plugins/kmod.py:25: DeprecationWarning: the sets module is deprecated
from sets import Set, ImmutableSet
Plugin “rhnplugin” can’t be imported
Loaded plugins: aliases, changelog, downloadonly, fastestmirror, keys, kmod, list-data, protect-packages, protectbase, refresh-packagekit, rhnplugin, security, tmprepo,
: verify, versionlock
This system is not registered with ULN.
ULN Satellite or ULN Classic support will be disabled.
Loading mirror speeds from cached hostfile
0 packages excluded due to repository protections
Reading version lock configuration
Setting up Install Process
Resolving Dependencies
–> Running transaction check
—> Package telnet.x86_64 1:0.17-39.el5 set to be installed
–> Finished Dependency Resolution

Dependencies Resolved

========================================================================================================================================================================
Package Arch Version Repository Size
========================================================================================================================================================================
Installing:
telnet x86_64 1:0.17-39.el5 repository 60 k

Transaction Summary
========================================================================================================================================================================
Install 1 Package(s)
Update 0 Package(s)
Remove 0 Package(s)

Total download size: 60 k
Is this ok [y/N]: y
Downloading Packages:
Running rpm_check_debug
Running Transaction Test
Finished Transaction Test
Transaction Test Succeeded
Running Transaction
Warning: RPMDB altered outside of yum.
** Found 11 pre-existing rpmdb problem(s), ‘yum check’ output follows:
rhn-client-tools-1.0.0-87.0.2.el6.noarch has installed conflicts yum-rhn-plugin < (‘0’, ‘0.9.1’, ’35.el6′): yum-rhn-plugin-0.5.4-13.el5.noarch
yum-3.2.22-20.el5.noarch has installed conflicts yum-skip-broken: yum-3.2.29-30.0.1.el6.noarch
yum-3.2.22-20.el5.noarch has installed conflicts yum-basearchonly: yum-3.2.29-30.0.1.el6.noarch
yum-3.2.22-20.el5.noarch has missing requires of python(abi) = (‘0’, ‘2.4’, None)
yum-3.2.22-20.el5.noarch has missing requires of python-elementtree
yum-3.2.29-30.0.1.el6.noarch is a duplicate with yum-3.2.22-20.el5.noarch
yum-metadata-parser-1.1.2-3.el5.x86_64 has missing requires of python(abi) = (‘0’, ‘2.4’, None)
yum-metadata-parser-1.1.2-16.el6.x86_64 is a duplicate with yum-metadata-parser-1.1.2-3.el5.x86_64
yum-plugin-security-1.1.30-14.el6.noarch has installed conflicts yum-security < (‘0’, ‘1.1.20’, ‘0’): yum-security-1.1.16-13.el5.noarch
yum-rhn-plugin-0.9.1-40.0.1.el6.noarch is a duplicate with yum-rhn-plugin-0.5.4-13.el5.noarch
yum-utils-1.1.30-14.el6.noarch is a duplicate with yum-utils-1.1.16-13.el5.noarch
Installing : telnet 1/1

Installed:
telnet.x86_64 1:0.17-39.el5

Complete!
[root@oragyan1 ~]#

Thats it!

Hope it helps..

Advertisements

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Google+ photo

You are commenting using your Google+ account. Log Out / Change )

Connecting to %s