RedHat7 build yum source server and redhat7 build yum
1. Create a directory
# Mkdir-p/content/rhel7.1/x86_64/{isos, dvd }/
2. Upload the RedHat installation CD image, the uploaded path is/content/rhel7.1/x86_64/isos/rhel-server-7.1-x86_64-dvd.iso
3. Set the disk image to/content/rhel7.1/x86_64/dvd
# Echo "/content/rhel7.1/x86_64/isos/rhel-server-7.1-x86_64-dvd.iso/content/rhel7.1/x86_64/dvd iso9660 loop, ro 0 0">/etc/fstab
# Mount-
4. Set up an http server (nginx) for network access to this yum Source
# Rpm-ivh http://nginx.org/packages/centos/7/noarch/RPMS/nginx-release-centos-7-0.el7.ngx.noarch.rpm
# Yum-y install nginx
5. Create a yum source site (http://content.example.com) Profile
# Vi/etc/nginx/conf. d/content.example.com. conf
server { listen 80; server_name content.example.com; access_log /var/log/nginx/content.example.com.access.log combined; location / { root /content; index index.html index.htm; autoindex on; autoindex_exact_size off; autoindex_localtime on; } #error_page 404 /404.html; # redirect server error pages to the static page /50x.html # error_page 500 502 503 504 /50x.html; location = /50x.html { root /usr/share/nginx/html; }}
6. Add DNS records to the/etc/hosts file
# Echo "192.168.136.254 content.example.com">/etc/hosts
7. Enable Firewall
# Firewall-cmd -- permanent -- add-service http
# Firewall-cmd -- reload
8. Modify the SELinux type of the website directory
# Chcon-t public_content_t-R/content/
9. Set the nginx service to start automatically and start the nginx service.
# Systemctl enable nginx
# Systemctl start nginx
10. Create a repo File
# Vi/etc/yum. repos. d/rhel-dvd.repo
[rhel-dvd]name=remote ipa copy of dvdbaseurl=http://content.example.com/rhel7.1/x86_64/dvdgpgcheck=0enabled=1
11.Generate a repo cacheTest whether the new yum source takes effect
# Yum makecache