搭建本地yum源,使用安装光盘的rpm作为yum源的文件

yum源的安装:使用安装光盘作为本地的yum源
1、
挂载所需要的安装光盘
虚拟机挂载光盘:
设置->光盘->路径(在“连接”处打勾)
[root@oracle ~]# mount /dev/cdrom -o loop /mnt
--将光盘挂载到/mnt 目录下

2、
切换至yum.repo.d 目录下,备份所有.repo结尾的文件,只留或新创建一个任意文件名后缀为.repo 的文件,并编辑
[root@oracle ~]# cd /etc/yum.repos.d/
[root@oracle ~]# vi server.repo
[server]
name=OEL54 
baseurl=file:///mnt/Server
enabled=1 
gpgcheck=0 
--name名称可以任意取
--baseurl为光盘挂载到本地的rpm包对应的目录

3、
执行yum list all 验证yum 仓库是否配置好。
若开始配置错了,用yum clean all 清理后,再次执行yum list all。


以上/mnt/Server就是光盘挂载后出现的目录,安装光盘的目录结构参考如下顺序
[root@ocptest media]# df -h
Filesystem            Size  Used Avail Use% Mounted on
/dev/sda1              28G  6.0G   20G  23% /
tmpfs                 1.8G     0  1.8G   0% /dev/shm
/dev/hdc              2.8G  2.8G     0 100% /media/Enterprise Linux dvd 20090908
/dev/hdc              2.8G  2.8G     0 100% /mnt

[root@ocptest media]# ll /dev/cdrom
lrwxrwxrwx 1 root root 3 Mar  9 00:55 /dev/cdrom -> hdc

[root@ocptest mnt]# ll /mnt
total 518
-rw-r--r--  2 root root   5165 Sep  9  2009 blafdoc.css
drwxr-xr-x  3 root root   2048 Sep  9  2009 Cluster
drwxr-xr-x  3 root root   4096 Sep  9  2009 ClusterStorage
-rw-r--r-- 11 root root   7037 Sep  9  2009 EULA
-rw-r--r--  2 root root   7037 Sep  9  2009 eula.en_US
-rw-r--r--  2 root root   3334 Sep  9  2009 eula.py
-rw-r--r-- 11 root root  18390 Sep  9  2009 GPL
drwxr-xr-x  4 root root   2048 Sep  9  2009 images
drwxr-xr-x  2 root root   2048 Sep  9  2009 isolinux
-rw-r--r--  2 root root   3957 Sep  9  2009 README-en
-rw-r--r--  2 root root   8394 Sep  9  2009 README-en.html
-rw-r--r--  2 root root  14639 Sep  9  2009 RELEASE-NOTES-en
-rw-r--r--  2 root root  36477 Sep  9  2009 RELEASE-NOTES-en.html
-rw-r--r-- 11 root root   1397 Sep  9  2009 RPM-GPG-KEY
-rw-r--r--  2 root root   1397 Sep  9  2009 RPM-GPG-KEY-oracle
drwxr-xr-x  4 root root 401408 Sep  9  2009 Server
-rw-r--r--  2 root root    105 Sep  9  2009 supportinfo
-r--r--r--  1 root root   4436 Sep  9  2009 TRANS.TBL
drwxr-xr-x  3 root root   4096 Sep  9  2009 VT

[root@ocptest media]# ll /mnt/Server/
total 2551136
-rw-r--r-- 2 root root  1205237 Jan 22  2009 a2ps-4.13b-57.2.el5.i386. rpm
-rw-r--r-- 2 root root    68916 Jan 22  2009 acl-2.2.39-3.el5.i386.rpm
-rw-r--r-- 2 root root    23972 Jul 11  2009 acpid-1.0.4-9.el5.i386.rpm
-rw-r--r-- 2 root root   651232 Jan 22  2009 adaptx-0.9.13-3jpp.1.i386.rpm
...










公司可以自建一个yum的仓库,比如把http://192.168.1.2/centos6当成一个yum仓库

[root@oatest ~]# cat /etc/yum.repos.d/one.repo

[localyum]

name=centos6

baseurl=http://192.168.1.2/centos6

enable=1

gpgcheck=0



两个ISO文件安装的OS的情况下,配置如下

[root@oatest ~]# cat /etc/yum.repos.d/one.repo

[myself]

name=myself

baseurl=file:///co6.8_media01

              file:///co6.8_media02

enabled=1

gpgcheck=0


[root@oatest ~]# ll /co6.8_media01

total 558

-r--r--r--. 2 root root     14 May 22  2016 CentOS_BuildTag

dr-xr-xr-x. 3 root root   2048 May 22  2016 EFI

-r--r--r--. 2 root root    212 Nov 27  2013 EULA

-r--r--r--. 2 root root  18009 Nov 27  2013 GPL

dr-xr-xr-x. 3 root root   2048 May 23  2016 images

dr-xr-xr-x. 2 root root   2048 May 22  2016 isolinux

dr-xr-xr-x. 2 root root 528384 May 23  2016 Packages

-r--r--r--. 2 root root   1359 May 22  2016 RELEASE-NOTES-en-US.html

dr-xr-xr-x. 2 root root   4096 May 23  2016 repodata

-r--r--r--. 2 root root   1706 Nov 27  2013 RPM-GPG-KEY-CentOS-6

-r--r--r--. 2 root root   1730 Nov 27  2013 RPM-GPG-KEY-CentOS-Debug-6

-r--r--r--. 2 root root   1730 Nov 27  2013 RPM-GPG-KEY-CentOS-Security-6

-r--r--r--. 2 root root   1734 Nov 27  2013 RPM-GPG-KEY-CentOS-Testing-6

-r--r--r--. 1 root root   3380 May 23  2016 TRANS.TBL


来自 “ ITPUB博客 ” ,链接:http://blog.itpub.net/30126024/viewspace-2151664/,如需转载,请注明出处,否则将追究法律责任。

转载于:http://blog.itpub.net/30126024/viewspace-2151664/

  • 0
    点赞
  • 0
    收藏
    觉得还不错? 一键收藏
  • 0
    评论

“相关推荐”对你有帮助么?

  • 非常没帮助
  • 没帮助
  • 一般
  • 有帮助
  • 非常有帮助
提交
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

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

抵扣说明:

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

余额充值