// Translator's note: The original Article translated by the Red Hat Knowledge Base // (https://access.RedHat.com/knowledge/solutions/7227) provided. // The content after this symbol (//) is added by the translator. // the original text has been changed. How can I configure the yum local resource library on RHEL through HTTP? A. The operating system environment used in this article: RedHatEnterpriseLinux5RedHatEnter
// Translator's note: The original Article translated by the RedHat Knowledge Base
// (Https://access.RedHat.com/knowledge/solutions/7227) provided.
// The content after this symbol (//) is added by the translator
// The original text has been modified.
How to configure the yum local resource library on RHEL through HTTP?
A. The operating system environment used in this article:
- Red Hat Enterprise Linux 5
- Red Hat Enterprise Linux 6
B. Prerequisites:
You will need to install the following packages on the server to be configured:
* Httpd
* Yum
* Createrepo
// Note: Generally, you only need to install the createrepo package.
// Because yum is usually installed by default when the operating system is installed.
// In RHEL6, httpd has been installed by default, but the service is not started.
In addition to configuring the preceding three software packages on the server, you must configure yum to retrieve updates from the configured repository.
C. The procedure is as follows:
1. Copy the installation image dvd iso of Red Hat Enterprise Linux 5/6 to create a local repository from the Red Hat Network and local repository server.
- #mkdir -p /var/www/html/cdrom/iso
- #mount -o loop /RHEL-DVD.iso /var/www/html/cdrom/iso
- #cd /var/www/html/cdrom
- #createrepo .
- #yum clean all
// The/RHEL-DVD.iso on the second line above indicates the absolute position of the dvd iso file you obtained.
// Note that the fourth line of the code above should be followed by a vertex to indicate the current directory. In fact, it can also be left empty.
2. Create a new repo configuration file ("/etc/yum. repos. d/server. repo"), as shown in the following code:
- #cat /etc/yum.repos.d/server.repo
- [RHEL-Repository]
- name = RHEL repository
- baseurl= file:///var/www/html/cdrom
- enabled = 1
- gpgcheck = 0
// Note: the error in the Code provided by the original Red Hat text (baseurl =
// Title = "Linkification: file: // cdrom"> file: // cdrom) has been corrected in the above Code.
// The following code errors have also been corrected.
3. Make sure that the "/etc/httpd/conf/httpd. conf" file has been correctly configured to ensure that the file can be shared through httpd. Then, perform the following operations:
- # Httpd-t // check whether the http configuration file has syntax errors
- # Service httpd start // start httpd
4. Edit "/etc/yum. repos. d/client. repo" on the client Configuration"
- [RHEL-Local-Server]
- Name=RHELX Server Repository 0
- # Localhost is on the local repository server. It can be changed to the valid host name and domain name of the server, or the IP address.
- Baseurl=Http: // Localhost/cdrom
- Enabled=1
- Gpgcheck=0
5. Verify from the client:
- #yum list
- #yum update
// Translator's note:
// Note the following:
// Sometimes, when the yum makecache command is not online, a prompt is displayed for domain name resolution.
// You cannot obtain a repo configuration file (repo. xml) on the Red Hat Enterprise Linux website ),
// You can manually edit "/etc/yum. repos. d/redhat. repo, and replace all "enable = 1" with "enable = 0 ",
// Run the command again.
// This completes all tasks.
// Finally, I hope you will have a good time using and managing RHEL. A