เริ่มแรกถ้าใช้งาน RHEL ควรจะทำการอัฟเดท License ของ RH ก่อนนะครับ
#rhn_register --nox
The –nox parameter forces registration to stay at the command line and not go to the GUI.
ต่อจากนั้นทำการลง yum-utils package จาก RHN.
#yum install yum-utils
ทำการ sync package จาก RHN
#reposync -p /updates --repoid=rhel-x86_64-server-5 -l
This will start the sync process. You can choose which repoid you want to sync by issuing the “yum repolist” command and selecting a specific one. This sync will take a bit of time depending on your WAN connection speed. After it finishes, we need to make the downloaded RPM packages into a Yum repository. We use the createrepo command to do this. Depending on your RHEL distribution, this could be a separate package or part of the yum-utils package. Issue this command to create the repository:
createrepo /updates
This will scan all of the RPMs in that directory and create a repository. Also, if you have 3rd party RPMs, you can add them to the /updates subdirectory and they’ll be added to the repository as well.
After all this, you now have a local repository! But, you’ll need to let other machines in your network know how to access it. Here’s a sample entry for your yum.conf file:
[rhel-baserepo]
name=Base Red Hat Enterprise Linux $releasever - $basearch
baseurl=file:///updates/rhel-x86_64-server-5
enabled=1
gpgcheck=0
gpgkey=file:///etc/pki/rpm-gpg/RPM-GPG-KEY-redhat-release
Now type “yum repolist” from the target machine and you should see the new local repository being loaded. You have now successfully setup your own RHN repository.