How to add a repository manually in RHEL6

Red Hat Enterprise Linux 6 (RHEL6) repository configurations.

yum looks at /etc/yum.repos.d/*.repo for enabled repository.

Create a file IntraNet.repo:

[IntraNet]
name=Local Network Repository for RHEL6 $releasever – $basearch
baseurl=ftp://x.x.x.x/RHEL6-GA-x86_64/
enabled=1
gpgcheck=0

Save and close the file.

[IntraNet]: Repository name i.e. The [IntraNet] section must exist for yum to do anything.
name=Local Repository for RHEL6 $releasever – $basearch: A human readable string describing the repository name.
baseurl=ftp://x.x.x.x/RHEL6-GA-x86_64/: Must be a URL to the directory where the yum repository’s ‘repodata’ directory lives. x.x.x.x is the ip address.
enabled=1: Enabled or disabled repo. To disable the repository temporarily, set the enabled=0.

############################################################

To setup a repository to use a locally mounted DVD with RHEL6

Create a dvd.repo text file in /etc/yum.repos.d/ with the following content:
[dvd]
mediaid=xxxxxxxxxx.xxxxxx
name=DVD for RHEL6
baseurl=file:///media/RHEL_xxxxxxxxxxxDVD/Server
enabled=1
gpgcheck=0

mediaid: Value comes from the .discinfo file located in the root of the DVD

To add a local repository in your hard drive.

Append the file localRepo:
# cd /etc/yum.repos.d
# vi localRepo.repo

############################################################
[localRepo]
name=localRepo
baseurl=file:///rhel6/RHEL6-GA-x86_64/
enabled=1
gpgcheck=0

# mkdir /rhel6
Moved all RHEL DVD files to this Directory /rhel6
# cd /rhel6

Installed createrepo RPM
# createrepo -v

############################################################

Run:
# yum clean all

To list packages:
# yum list
Or to list packages beginning with fc:
# yum list fc*

To install a package
# yum install rpm
where rpm is the name of the package.

Leave a Comment

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

CAPTCHA * Time limit is exhausted. Please reload the CAPTCHA.

This site uses Akismet to reduce spam. Learn how your comment data is processed.

Scroll to Top