CentOS6 uses an ISO image as the yum software source
If the server is deployed on the Intranet and cannot be connected to yum to install or update software, it is necessary to create a local yum software source.
There are many ways to create a local yum Source:
1. Local http Source: The Source Based on the HTTP protocol;
2. Local FTP Source: The Source Based on the FTP protocol. The source get software is obtained through FTP;
3. Local DVD disc or system ISO Image Source: the principle of using a system DVD disc or ISO image is the same. First, the DVD disc or ISO image is mounted to a local directory, then configure the yum source.
This tutorial describes how to use an ISO image as a yum software source for RedHat or CentOS 6. X.
1. Upload the RedHat or CentOS dvd iso image to the server:
You can use SFTP or FTP, such as uploading to the/usr/local directory.
Ii. Mount the system ISO Image
# Mkdir-p/mnt/cdrom # mount-o loop/usr/local/rhel-server-6.4-x86_64-dvd.iso/mnt/cdrom # PS: If it is mounted to the DVD drive for software source, run the following command: # mount-t iso9660/dev/cdrom/mnt/cdrom/
Note:
1. I mount the system ISO image to the/mnt/cdrom directory, and you can also mount it to other places;
2. If you need to enable automatic mounting, you can put the second command above in/etc/rc. local.
3. Modify yum Configuration:
# Cd/etc/yum. repos. d/# mkdir-p bak # Next, move the previous yum configuration file to the bak folder created above # mv *. repo bak/# Add a new yum source configuration file # vi/etc/yum. repos. d/redhat. repo # press the "Insert" key to enter the editing mode. Copy the following content to the configuration file [RHEL] name = RHEL6.4baseurl = file: // mnt/cdromgpgcheck = 0 gpgkey = file: /// mnt/cdrom/RPM-GPG-KEY-redhat-releaseenabled = 1
Save the changes and exit.
Iv. yum cleaning:
# yum clean all
5. Update the source and install software:
# Yum update # yum install the name of the software package to be installed
Vi. Other Instructions:
1. This method can also be used to upgrade your operating system. If you are using RedHat/CentOS 6.3, mount the 6.4 ISO image and make the cost source, you can upgrade the system to 6.4 by running the yum update command.
2. The RedHat/CentOS 5.x series uses ISO images for yum software sources in a similar way as the 6.x series, but the configuration files of the yum source are slightly different:
[rhel-debuginfo]name=Red Hat Enterprise Linux $releasever - $basearch - Debugbaseurl=file:///mnt/cdrom/Serverenabled=1gpgcheck=1gpgkey=file:///etc/pki/rpm-gpg/RPM-GPG-KEY-redhat-release[Cluster]name=Red Hat Enterprise Linux $releasever - $basearch - Clusterbaseurl= file:///mnt/cdrom/Clusterenabled=1gpgcheck=1gpgkey=file:///etc/pki/rpm-gpg/RPM-GPG-KEY-redhat-release[ClusterStorage]name=Red Hat Enterprise Linux $releasever - $basearch - ClusterStoragebaseurl= file:///mnt/cdrom/ClusterStorageenabled=1gpgcheck=1gpgkey=file:///etc/pki/rpm-gpg/RPM-GPG-KEY-redhat-release[Server]name=Red Hat Enterprise Linux $releasever - $basearch - Serverbaseurl= file:///mnt/cdrom/Serverenabled=1gpgcheck=1gpgkey=file:///etc/pki/rpm-gpg/RPM-GPG-KEY-redhat-release[VT]name=Red Hat Enterprise Linux $releasever - $basearch - VTbaseurl= file:///mnt/cdrom/VTenabled=1gpgcheck=1gpgkey=file:///etc/pki/rpm-gpg/RPM-GPG-KEY-redhat-release