使用系统iso镜像配置yum源

环境使用的是redhat6.1 64bit

1.设置虚拟机的硬件,在光驱处选择系统的安装镜像,这一步在开机关机的时候都可以。


2.在开机的情况下,右击vmware下面的光驱,选择连接。


3.接下来需要配置一下系统/etc/yum.repos.d/rhel-source.repo配置文件,另外,我是把光盘挂载到了/mnt/iso下面,具体过程如下:

[plain]  view plain copy
  1. [root@localhost ~]# df -h   #选择光驱连接后,镜像默认被挂载在/media下面,但是我打算把他挂载到/mnt/iso下面  
  2. 文件系统          容量  已用  可用 已用%% 挂载点  
  3. /dev/sda2             9.9G  3.2G  6.2G  35% /  
  4. tmpfs                 497M  420K  497M   1% /dev/shm  
  5. /dev/sda1             194M   27M  158M  15% /boot  
  6. /dev/sda6              54M   25M   26M  50% /quota  
  7. /dev/sr0              3.4G  3.4G     0 100% /media/RHEL_6.1 x86_64 Disc 1  
  8. [root@localhost ~]# mkdir /mnt/iso  #先创建挂载点  
  9. [root@localhost ~]# ls /mnt/iso  
  10. [root@localhost ~]# mount /dev/sr0 /mnt/iso/        #挂载  
  11. mount: block device /dev/sr0 is write-protected, mounting read-only  
  12. [root@localhost ~]# df -hT  #查看一下挂载情况  
  13. 文件系统    类型      容量  已用  可用 已用%% 挂载点  
  14. /dev/sda2     ext4    9.9G  3.2G  6.2G  35% /  
  15. tmpfs        tmpfs    497M  420K  497M   1% /dev/shm  
  16. /dev/sda1     ext4    194M   27M  158M  15% /boot  
  17. /dev/sda6     ext4     54M   25M   26M  50% /quota  
  18. /dev/sr0   iso9660    3.4G  3.4G     0 100% /media/RHEL_6.1 x86_64 Disc 1  
  19. /dev/sr0   iso9660    3.4G  3.4G     0 100% /mnt/iso    #已经挂上去了  
  20. [root@localhost ~]# cd /mnt/iso/  
  21. [root@localhost iso]# ls  
  22. EFI                       RELEASE-NOTES-es-ES.html  RELEASE-NOTES-si-LK.html  
  23. EULA                      RELEASE-NOTES-fr-FR.html  RELEASE-NOTES-ta-IN.html  
  24. GPL                       RELEASE-NOTES-gu-IN.html  RELEASE-NOTES-te-IN.html  
  25. HighAvailability          RELEASE-NOTES-hi-IN.html  RELEASE-NOTES-zh-CN.html  
  26. images                    RELEASE-NOTES-it-IT.html  RELEASE-NOTES-zh-TW.html  
  27. isolinux                  RELEASE-NOTES-ja-JP.html  repodata    #可以看到这里有个repodata文件,修改配置文件的时候需要写这个文件的所在目录  
  28. LoadBalancer              RELEASE-NOTES-kn-IN.html  ResilientStorage  
  29. media.repo                RELEASE-NOTES-ko-KR.html  RPM-GPG-KEY-redhat-beta  
  30. Packages                  RELEASE-NOTES-ml-IN.html  RPM-GPG-KEY-redhat-release  
  31. README                    RELEASE-NOTES-mr-IN.html  ScalableFileSystem  
  32. RELEASE-NOTES-as-IN.html  RELEASE-NOTES-or-IN.html  Server  
  33. RELEASE-NOTES-bn-IN.html  RELEASE-NOTES-pa-IN.html  TRANS.TBL  
  34. RELEASE-NOTES-de-DE.html  RELEASE-NOTES-pt-BR.html  
  35. RELEASE-NOTES-en-US.html  RELEASE-NOTES-ru-RU.html       
  36. [root@localhost iso]# vim /etc/yum.repos.d/rhel-source.repo #修改这个配置文件  
  37.   
  38. [rhel-source]  
  39. name=Red Hat Enterprise Linux $releasever - $basearch - Source  
  40. baseurl=file:///mnt/iso     #这里最重要了,需要写repodata所在目录的路径,这里是/mnt/iso  
  41. enabled=1           #使此源生效  
  42. gpgcheck=0            
  43. gpgkey=file:///etc/pki/rpm-gpg/RPM-GPG-KEY-redhat-release  
  44.   
  45. [rhel-source-beta]  
  46. name=Red Hat Enterprise Linux $releasever Beta - $basearch - Source  
  47. baseurl=ftp://ftp.redhat.com/pub/redhat/linux/beta/$releasever/en/os/SRPMS/  
  48. enabled=0  
  49. gpgcheck=1  
  50. gpgkey=file:///etc/pki/rpm-gpg/RPM-GPG-KEY-redhat-beta,file:///etc/pki/rpm-gpg/RPM-GPG-KEY-redhat-release  
  51.   
  52. [root@localhost iso]# yum list|grep ftp     #保存退出后,可以用yum list查看是否有很多安装软件了,这里测试了下ftp,有说明yum源配置成功了,呵呵。  
  53. ftp.x86_64                             0.17-51.1.el6                 @rhel-source  
  54. gvfs-obexftp.x86_64                    1.4.3-12.el6                  @anaconda-RedHatEnterpriseLinux-201105101844.x86_64/6.1  
  55. lftp.x86_64                            4.0.9-1.el6                   @rhel-source  
  56. report-config-ftp.x86_64               0.18-9.el6                    @anaconda-RedHatEnterpriseLinux-201105101844.x86_64/6.1  
  57. report-plugin-ftp.x86_64               0.18-9.el6                    @anaconda-RedHatEnterpriseLinux-201105101844.x86_64/6.1  
  58. vsftpd.x86_64                          2.2.2-6.el6_0.1               @rhel-source  
  59. lftp.i686                              4.0.9-1.el6                   rhel-source  
  60. tftp.x86_64                            0.49-5.1.el6                  rhel-source  
  61. tftp-server.x86_64                     0.49-5.1.el6                  rhel-source  
  62. [root@localhost iso]#   

你可能感兴趣的:(linux操作入门)