redhat5设置本地yum源

  1. 配置本地yum源的方法  
  2.   
  3. 1.利用光驱挂载镜像配置  
  4.   
  5. 1.1首先把光盘放在光驱中,若此时光驱已经挂载请用umount命令先把光驱umount掉  
  6.   
  7. 1.2建立相关目录,创建local.repo 文件  
  8. [root@tip01 ~]# mkdir /yum/Server/  
  9. [root@tip01 ~]# mount  /dev/hdc  /yum/  
  10. [root@tip01 ~]# vi /etc/yum.repos.d/local.repo   
  11.  
  12. #添加以下内容  
  13.   
  14. [base]  
  15. name=local  
  16. baseurl=file:///yum/Server  
  17. gpgcheck=0  
  18. enabled=1  
  19.   
  20. 1.3 查看配置的yum源  
  21. [root@tip01 ~]# yum  list  
  22. Loaded plugins: rhnplugin, security  
  23. This system is not registered with RHN.  
  24. RHN support will be disabled.  
  25. base                                                                       | 1.3 kB     00:00       
  26. base/primary            ####################################                                               
  27.   
  28.   
  29. 这样 yum仓库就建好了  
  30.   
  31.   
  32.   
  33. 2.利用本地文件目录建立yum 仓库  
  34.   
  35. 2.1把光盘放入光驱  
  36. mount  /dev/hdc  /mnt  
  37. [root@tip01 ~]# mount /dev/hdc  /mnt/  
  38. mount: block device /dev/hdc is write-protected, mounting read-only  
  39.   
  40. 注意:存放YUM源的目录必须有可写权限,不然在createrepo时会报错。  
  41.   
  42. 2.2将光盘文件复制到YUM目录  
  43. [root@tip01 ~]# umount /dev/hdc  
  44. [root@tip01 ~]# mount /dev/hdc  /mnt/  
  45. mount: block device /dev/hdc is write-protected, mounting read-only  
  46.  
  47. [root@tip01 ~]# cd /mnt/  
  48. [root@tip01 mnt]# ls -ld Server/  
  49. dr-xr-xr-x 3 root root 217088 05-19 05:11 Server/  
  50.   
  51. 2.2 拷贝Server目录  
  52. [root@tip01 mnt]# cp -r Server/ /yum/  
  53.   
  54. 2.3安装createrepo  
  55. [root@tip01 ~]# cd /yum/Server/  
  56. [root@tip01 Server]# rpm  -ivh createrepo-0.4.11-3.el5.noarch.rpm   
  57. warning: createrepo-0.4.11-3.el5.noarch.rpm: Header V3 DSA signature: NOKEY, key ID 37017186  
  58. Preparing...                ########################################### [100%]  
  59.         package createrepo-0.4.11-3.el5.noarch is  installed  
  60.   
  61. 2.4创建本地源  
  62. # createrepo  -g  /yum/Server/repodata/comps-rhel5-server-core.xml  /yum/Server  
  63.   
  64. [root@tip01 ~]# vi /etc/yum.repos.d/local.repo   
  65.   
  66. [base]  
  67. name=local  
  68. baseurl=file:///yum/Server  
  69. gpgcheck=0  
  70. enabled=1  
  71.   
  72.   
  73. [root@tip01 ~]# yum  list  
  74. Loaded plugins: rhnplugin, security  
  75. This system is not registered with RHN.  
  76. RHN support will be disabled.  
  77. base                                                                       | 1.3 kB     00:00       
  78. base/primary            ####################################                         
  79.   
  80. 以同样的方式建立VT,CLUSTER,CLUSTERSTORAGE的yum源  
  81. 要注意baseurl后为file:/// “三个斜杠”  
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值