Knowledge Base/Linux

How to add a repository manually in RHEL6

Woos™ 2011. 9. 20. 11:56



http://www.confignotes.com/2011/01/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 mylocalnet.repo:
[mylocalnet]
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.

[mylocalnet]: Repository name i.e. The [mylocalne] 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/
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 blahblahblah
where blahblahblah is the name of the package.