1、加载iso(准备报iso文件,此处iso文件目录是 /home/soft/):
mkdir /mnt/iso
mount /home/soft/rhel-server-6.5-x86_64-dvd.iso /mnt/iso -o loop
2、rpm -q createrepo --发现没装过
3、安装 createrepo
cd /mnt/iso/Packages (这是iso镜像的目录,如果是挂载dvd在RHEL_5.9x86_64DVD\Server)
rpm --import /etc/pki/rpm-gpg/RPM*
rpm -ivh createrepo-0.9.9-18.el6.noarch.rpm --force --nodeps
4、配置yum源
cd /etc/yum.repos.d
cp rhel-source.repo rhel-source.repo.bak
vim rhel-source.repo (以下每个的目录下都有 listing repodata TRANS.TBL )
[RHEL6-Server-HighAvailability]
name=RHEL6-Server-HighAvailability
baseurl=file:///mnt/iso/HighAvailability
enabled=1
gpgcheck=0
gpgkey=file:///mnt/iso/RPM-GPG-KEY-redhat-release
[RHEL6-Server-LoadBalancer]
name=RHEL6-Server-LoadBalancer
baseurl=file:///mnt/iso/LoadBalancer
enabled=1
gpgcheck=0
gpgkey=file:///mnt/iso/RPM-GPG-KEY-redhat-release
[RHEL6-Server-ResilientStorage]
name=RHEL6-Server-ResilientStorage
baseurl=file:///mnt/iso/ResilientStorage
enabled=1
gpgcheck=0
gpgkey=file:///mnt/iso/RPM-GPG-KEY-redhat-release
[RHEL6-Server-ScalableFileSystem]
name=RHEL6-Server-ScalableFileSystem
baseurl=file:///mnt/iso/ScalableFileSystem
enabled=1
gpgcheck=0
gpgkey=file:///mnt/iso/RPM-GPG-KEY-redhat-release
[RHEL6-Server-Server]
name=RHEL6-Server-Server
baseurl=file:///mnt/iso/Server
enabled=1
gpgcheck=0
gpgkey=file:///mnt/iso/RPM-GPG-KEY-redhat-release
5、
createrepo -g /mnt/iso/Server/repodata/*comps-rhel6-Server.xml -o /mnt/iso/Server -i /mnt/iso/Server/listing /mnt/iso/Packages/
6、
yum -y install gcc-4.4.7-4.el6.x86_64.rpm