Machines in the production system environment are not connected to the Internet, so they are all using local sources.
First, you need to mount the CDROM, or ISO file, to a local directory.
1. Mount the optical drive: put the CDROM into the optical drive.
$ mkdir/media/cdrom # Build mount point Directory
$ Mount/dev/cdrom/media/cdrom #挂载光驱, if there are multiple optical drives, there will be multiple CDROM devices in the/dev directory, such as CDROM1, CDROM2
Note: When using a virtual machine, there are often cases where CDROM cannot be ejected. At this point, you can use the Fuser-km/dev/cdrom command to kill the process using CDROM, and then eject the disc.
2. Mount the ISO file: Copy the ISO file to the system
$ mkdir/media/iso # Build mount point Directory
$ mount-o loop/home/user/xxxx.ios/media/iso #执行挂载.
Then, configure the Yum source.
1. Enter the/etc/yum.repo.d/directory with more than one source configuration file in this directory.
In CentOS, for example,
Centos-base.repo This file is a CentOS-configured network source that cannot be used in an intranet environment. Renaming invalidates the file. MV Centos-base.repo Centos-base.repo.bak
Centos-media.repo This file is typically configured with a local source to configure the local source for the template.
[C6-media-cdrom] # source label, Yum is used to mark different sources, so different profiles are set to different marks.
name=centos-$releasever-media # Name
#baseurl =file:///media/centos/
# file:///media/cdrom/
# file:///media/cdrecorder/
baseurl=file:///media/cdrom/#源路径, the source path conforms to the directory rules of the Linux source. In general, there is a./repodata directory under this directory.
Gpgcheck=1 # can be configured to 0, indicating no checksum.
Enabled=1 # is configured to 1 o'clock, the source of this configuration is enabled, configured to 0 o'clock, not enabled.
Gpgkey=file:///etc/pki/rpm-gpg/rpm-gpg-key-centos-6
2, configure the intranet source of HTTP.
Start the httpd service on the source server
$ service httpd Start
Mount the local ISO file to the directory of the HTTPD service/var/www/html/
$ mount-o Loop xxx.iso/var/www/html/iso #挂载 ISO file
$ ln-sf/home/user/source/var/www/html/source # Make a soft connection to the local directory.
At this point, the source data is accessed through Http://host/iso or Http://host/source.
If there is a 403 error accessing the HTTP service, the probable cause
1) The parent directory of the local source does not add execute permission, through chmod +x/home/user
2) need to close iptables firewall, service iptables stop
3) SELinux is not closed. You need to modify the/etc/selinux/config file, modify it to selinux=disabled, and then restart the machine.
Configure the local network source.
Modify the Baseurl=http://host/source in the repo file
After the configuration is complete, you can use the Yum check-update to update the source and check the configuration for errors.
CentOS Mount CDROM, ISO file as source