Posts Tagged ‘repository’

Create your own local repository and solve yum related problems

November 22, 2010 2 comments

In RHEL 5.0 onwards Red hat introduced YUM concept by which it is very easy to install some rpm without being getting worry about the dependency problem.YUM takes care of this dependency problem by selecting all dependent RPM to install from a central repository either from RED HAT or from some third party repository like oracle has or you can create your own repository if you want to use YUM offline

YUM: – Yellowdog Updater, Modified (YUM)

In first section we will discuss how to create your own local repository.

1. To create that inserts your Red hat DVD installer inside DVD ROM.

2. Mount the DVD by

[root@localhost ~]#mounts /dev/cdrom /media

3. Create a folder of your choice. In my case I have created /home/rpms

4. Copy all the RPM from /media/Server/ to /hom/rpms folder

[root@localhost ~]#mkdir /home/rpms
[root@localhost ~]#cp -rv /media/Server/*  /home/rpms

6. Now look for a folder /etc/yum.repos.d. If the directory exists then YUM package is already installed and you can skip this step. So you just need to configure. If it is not there you have to install yum and yum-utils package. Also install one RPM called createrepo.

[root@localhost rpms]# cd /media/Server/
[root@localhost Server]# rpm -ivh yum-3.0.1-5.el5.noarch.rpm
[root@localhost Server]# rpm –ivh yum-utils-1.0.4-3.el5.noarch.rpm
[root@localhost Server]# rpm -ivh createrepo-0.4.4-2.fc6.noarch.rpm

7. Once YUM packages are installed you will get the /etc/yum.repos.d folder. Go inside the folder and open the entire .repo file present inside that folder. In all .repo file search for

enabled = 1

and replace by

enabled = 0

This means you are disabling the default repository locations or else you can delete all repo files.

8. Edit the /etc/yum.conf file,change the following line:

keepcache=0 to keepcache=1

9. Now prepare the directory /rpms to act as a repository. For this we run the command

[root@localhost ~]createrepo -p /rpms 

This command will take some time to finish and once finished you can see a directory called repodata will be created inside the /rpms directory.

11.If some error comes like “Cannot delete .olddata” Then you have to remove it manually by “rm -rf /home/rpms/.olddata”

yum error 39

10. Now create a file myrepo.repo inside /etc/yum.repos.d folder

[root@localhost ~]touch /etc/yum.repos.d/myrepo.repo

11. Put the following contents inside the myrepo.repo file

 name=My Local Repo

Save the file and exit.

Now your repository is ready. Before running any installation first clean the cache by

Yum clean all

Now you can install anything like

[root@localhost ~]yum install httpd

You will get a screen like below where you have to say “y” or “n”

yum installation

N:B-Here I have used file:// protocol as base url.You can use ftp:/// or http:// if you have remote repository location.

Common Errors and their solutions

1)Errno 256:Metadata file does not match checksum


1) Edit /etc/yum.conf and add the following line


2) Run "yum clean metadata"

3) Retry the yum install

2)“TypeError: rpmdb open failed” or “TypeError: rpmdb unable to join the environment”


# yum clean all 
#rm -f /var/lib/rpm/__db* 
#rpm –rebuilddb 
#yum update

3)ValueError: need more than 1 value to unpack


#yum clean all

#yum clean metadata

#yum clean dbcache


and then execute

#yum makecache

4)thread.error: can’t start new thread


#rm /usr/lib/yum-plugins/

#yum update

5)[Errno -3] Error performing checksum


#createrepo -v -s sha1 <repository location>

#yum clean all

6)TypeError: unsubscriptable object


#yum clean metadata

#yum update missing dependency error


#yum clean all

#yum update

7)Yum install GPG error


#rpm --import /etc/pki/rpm-gpg/RPM*

8)Error: Cannot retrieve repository metadata (repomd.xml)


This is a network issue.Please check DNS,Proxy etc. settings for the same.

Categories: Linux Tags: , , , ,