Private YUM repository creation

To configure private  yum repository we need the OS dvd and some protocol daemons like ftp, http, .. etc.

Packages need to be installed:

Install the following packages from dvd,

vsftpd-2.2.2-6.el6.x86_64  –  Here I am using ftp protocol (VSFTPD)

createrepo-0.9.8-4.el6.noarch.rpm  –  Used to create repository

 

Mount the dvd

[root@server01 ~]#mount /dev/sr0 /media

[root@server01 Packages]# df -h

Filesystem            Size  Used Avail Use% Mounted on

/dev/sda1              15G   14G     0 100% /

tmpfs                 1.9G  260K  1.9G   1% /dev/shm

/dev/mapper/vg1-lv1    30G  4.7G   24G  17% /var/lib/libvirt/images

/dev/sr0              3.2G  3.2G     0 100% /media/RHEL_6.0 x86_64 Disc 1

 

[root@server01 ~]# cd  /media/

[root@server01 media]# ls

RHEL_6.0 x86_64 Disc 1

[root@server01 media]# cd  RHEL_6.0\ x86_64\ Disc\ 1/

 

Copy the contents of the dvd to ftp directory:

[root@server01 RHEL_6.0 x86_64 Disc 1]# cp -rf * /var/ftp/pub/osrepo/

I have created a directory osrepo in the ftp home directory.

 

Create the repostitory:

[root@server01 ~]# createrepo -v /var/ftp/pub/osrepo/

[root@server01 ~]# cd  /var/ftp/pub/osrepo/repodata

[root@server01 repodata]# cp -rf 1a7fc54d30d0d44222742c63069ab0126afef9f160931cc15e564dbe6414f268-comps-rhel6-Server.xml /root/

[root@server01 repodata]# cd

[root@server01 ~]# createrepo -g /root/1a7fc54d30d0d44222742c63069ab0126afef9f160931cc15e564dbe6414f268-comps-rhel6-Server.xml /var/ftp/pub/osrepo/

This will create some xml files in repodata directory which is used to fetch rpm informations and dependencies whenever a client contacts the server.

 

Start the ftp service:

[root@server01 ~]# /etc/init.d/vsftpd start

Starting vsftpd for vsftpd:                                [  OK  ]

 

Client side configuration:

On the client machine create a repository file to point out the yum repo server,

[root@server01 ~]# vim /etc/yum.repos.d/private.repo

Enter the information like the following syntax

[base]

name=rhel

baseurl=ftp://192.168.1.143/pub/osrepo

enabled=1

gpgcheck=0

Change the IP in the syntax to your yum server’s IP.

Now you can proceed with yum command in your client machines.

Leave a Reply

Your email address will not be published. Required fields are marked *

You may use these HTML tags and attributes: <a href="" title=""> <abbr title=""> <acronym title=""> <b> <blockquote cite=""> <cite> <code> <del datetime=""> <em> <i> <q cite=""> <strike> <strong>