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/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 blahblahblah
where blahblahblah is the name of the package.
[...] http://www.linuxtopia.org/online_boo…ositories.html http://www.confignotes.com/2011/01/h…ally-in-rhel6/ You say you already know how to create repository…so, create one. Put whatever files in it you [...]
@Lapu Lapu,
Your info gave a really good start for setting up my own local RHEL6 repo—as doing so is a little different than for RHEL5. Thank you.
I created my local RHEL6 DVD repo, as follows:
# mkdir /srv/RHEL6_x64_OS
# mount /dev/cdrom /media
# /bin/cp -rpf /media/* /srv/RHEL6_x64_OS
# umount /media
I created “/etc/yum.repos.d/RHEL_6.1_x86_64DVD.repo” with the following contents:
———————————————–
[baseOS]
name=Red Hat Enterprise Linux $releasever – $basearch baseOS
baseurl=file:///srv/RHEL6_x64_OS
enabled=1
gpgcheck=1
[ScalableFileSystem]
name=Red Hat Enterprise Linux $releasever – $basearch ScalableFileSystem
baseurl=file:///srv/RHEL6_x64_OS
enabled=1
gpgcheck=1
[Workstation]
name=Red Hat Enterprise Linux $releasever – $basearch Workstation
baseurl=file:///srv/RHEL6_x64_OS
enabled=1
gpgcheck=1
———————————————–
With those contents in place, there is no longer a requirement to do any ‘createrepo’ commands, as this structure natively leverages the ‘repos’ inherent on the distributed media. Further, at least in my testing, so far, no ‘mediaID’ line was necessary. YMMV
The commands you suggest running at the end now worked completely for me.
Thanks for the post!
In response to Joe_Wulf’s post, adding the following to your repo file in each repo stanza would probably help, since you’ve decided to gpgcheck=1, otherwise, yum installing any package from the media would complain that the GPG key does not exist:
gpgkey=/etc/pki/rpm-gpg/RPM-GPG-KEY-redhat-release
Note that you can either import the GPG keys (with the following command as root: gpg –import /srr/RHEL6_x64_OS/RPM-GPG-KEY-redhat-release) and use the path above in your repo definition or simply just refer to the location of the GPG keys of your RHEL6 that are available on the installation media (e.g., gpgkey=file:///srv/RHEL6_x64_OS).
e.g.,:
[baseOS]
name=Red Hat Enterprise Linux $releasever – $basearch baseOS
baseurl=file:///srv/RHEL6_x64_OS
#gpgkey=file:///srv/RHEL6_x64_OS
gpgkey=file:///etc/pki/rpm-gpg/RPM-GPG-KEY-redhat-release
enabled=1
gpgcheck=1
Better go for Scientific Linux 6.1 rather than Centos…Centos is lagging behind in updates and Scientific Linux is far ahead and is based on RHEL…So if you want a latest Enterprise Quality Linux Server…go for Scientific Linux..
http://scientificlinux.org/
the fact that CERN is behind this distro, is a great news, however, Centos is not lagging behind in updates as you seem to suggest, have a look at the following links, and see for yourself.
http://en.wikipedia.org/wiki/Scientific_Linux
http://en.wikipedia.org/wiki/CentOS
Please note I love all type of distros, and I am not with or against any of them.
Thanks man, It worked perfectly on RHEL6 and Fedora 14.
[...] Not giving you the answer you really want, but i'd really suggest you only expect distros to do what they are designed for. RHEL is an enterprise server, so is not intended to do video playback and the likes, unlike a user focused distro like Ubuntu. As far as the actual issue, you are not registered with RHN, and so can not get the mainline core packages from RedHat. If you are not going to use RHN then there is NO reason you should use RHEL, as even if you do want to use the RHEL environment, you can use a rebrand of it, i.e. CentOS which will give you access to these unavialable packages without needing the licensed functionality of RHEL. The packages should be on the installation media however, so you can install it from there still separately – http://www.confignotes.com/2011/01/h…ally-in-rhel6/ [...]