Redhat sets the local ISO as the yum source and redhatisoyum Source
The redhat system needs to be registered when you want to directly pass the yum conditions online. Generally, users are not registered. If you want to install new software through yum, you can set the ISO file of the installation disk image to the yum source. Generally, the following steps are taken:
Step 1: Upload the installation entry file to the server. For example, I upload a rhel-server-6.4-x86_64-dvd.iso to the/home Directory
Step 2: mount the iso file. Mount-o loop-t iso9660/mnt/cdrom/home/rhel-server-6.4-x86_64-dvd.iso to the local directory. The/mnt/cdrom directory must be created in advance.
Step 3: Create a/etc/yum. repos. d/cdrom. repo file. The file content is as follows:
[CDROM]name=isofilebaseurl=file:///mnt/cdromenabled=1gpgcheck=0gpgkey=file:///mnt/cdrom/RPM-GPG-KEY-redhat-release
Where
CDROM is the yum source name.
Set baseurl to the directory where the iso image file is mounted/mnt/cdrom
The value of enable must be 1.
The value of gpgcheck is random.
Set the gpgkey file to RPM-GPG-KEY-redhat-release in the/mnt/cdrom directory.
After saving and exiting, run the following command to verify whether the yum source is set
Yum list gcc
Loaded plugins: product-id, security, subscription-managerThis system is not registered to Red Hat Subscription Management. You can use subscription-manager to register.Available Packagesgcc.x86_64 4.4.7-3.el6 CDROM
As shown above, the system prompts you to find the gcc. x86_64 package in the CDROM yum source. This indicates that the yum source of the local ISO has been set. You can use the yum install command to install some software packages in ISO.
In fact, it is also possible not to create/etc/yum. repos. d/cdrom. repo. You can also directly edit the/etc/yum. repos. d/rhel-source.repo.repo file that comes with the system. Add the content to the end of the file, as shown below.
[rhel-source]name=Red Hat Enterprise Linux $releasever - $basearch - Sourcebaseurl=ftp://ftp.redhat.com/pub/redhat/linux/enterprise/$releasever/en/os/SRPMS/enabled=0gpgcheck=1gpgkey=file:///etc/pki/rpm-gpg/RPM-GPG-KEY-redhat-release[rhel-source-beta]name=Red Hat Enterprise Linux $releasever Beta - $basearch - Sourcebaseurl=ftp://ftp.redhat.com/pub/redhat/linux/beta/$releasever/en/os/SRPMS/enabled=0gpgcheck=1gpgkey=file:///etc/pki/rpm-gpg/RPM-GPG-KEY-redhat-beta,file:///etc/pki/rpm-gpg/RPM-GPG-KEY-redhat-release[CDROM]name=isofilebaseurl=file:///mnt/cdromenabled=1gpgcheck=0gpgkey=file:///mnt/cdrom/RPM-GPG-KEY-redhat-release
The effect is the same.