linux操作系统光盘,在Linux操作系统上使用光盘搭建yum源

当没有网络或网络连接较慢时,可以通过创建本地YUM源来使用软件包。步骤包括:1) 创建挂载点;2) 自动挂载光盘;3) 创建yum源配置文件;4) 加载yum源。完成这些步骤后,即使在网络不畅的情况下,也能使用yum进行软件安装和更新。
摘要由CSDN通过智能技术生成

疑问:如果没有网络或網絡較慢,如何使用yum源?

答案:使用光盘搭建yum源

本地Iso,ftp,https源,後續補充

1,創建掛載點

~]# mkdir /mnt/cdrom/

2,自動掛載并啟動掛載點

~]# echo "/dev/sr0 /mnt/cdrom iso9660 defaults 0 0" >> /etc/fstab

~]# mount -a

~]# mount | grep iso9660

/dev/sr0 on /mnt/cdrom type iso9660 (ro)

~]#  ll /mnt/cdrom/

总用量 682

-r--r--r-- 2 root root     14 11月 29 2013 CentOS_BuildTag

dr-xr-xr-x 3 root root   2048 11月 29 2013 EFI

-r--r--r-- 2 root root    212 11月 28 2013 EULA

-r--r--r-- 2 root root  18009 11月 28 2013 GPL

dr-xr-xr-x 3 root root   2048 11月 29 2013 images

dr-xr-xr-x 2 root root   2048 11月 29 2013 isolinux

dr-xr-xr-x 2 root root 655360 11月 29 2013 Packages

-r--r--r-- 2 root root   1354 11月 28 2013 RELEASE-NOTES-en-US.html

dr-xr-xr-x 2 root root   4096 11月 29 2013 repodata

-r--r--r-- 2 root root   1706 11月 28 2013 RPM-GPG-KEY-CentOS-6

-r--r--r-- 2 root root   1730 11月 28 2013 RPM-GPG-KEY-CentOS-Debug-6

-r--r--r-- 2 root root   1730 11月 28 2013 RPM-GPG-KEY-CentOS-Security-6

-r--r--r-- 2 root root   1734 11月 28 2013 RPM-GPG-KEY-CentOS-Testing-6

-r--r--r-- 1 root root   3380 11月 29 2013 TRANS.TBL

3,創建yum 源

CentOS-Base.repo改名

yum.repos.d]# mv CentOS-Base.repo CentOS-Base.repo.bak

備份創建光盤repo配置文件,名稱可自取配置文件,名稱可自取

yum.repos.d]# cp CentOS-Media.repo CentOS-Media.repo.bak

修改光盤repo配置文件,名稱可自取

yum.repos.d]# vim CentOS-Media.repo

# CentOS-Media.repo

#

#  This repo can be used with mounted DVD media, verify the mount point for

#  CentOS-6.  You can use this repo and yum to install items directly off the

#  DVD ISO that we release.

#

# To use this repo, put in your DVD and use it with the other repos too:

#  yum --enablerepo=c6-media [command]

#

# or for ONLY the media repo, do this:

#

#  yum --disablerepo=\* --enablerepo=c6-media [command]

[c6-media]

name=CentOS-$releasever - Media

baseurl=file:///mnt/cdrom/

#        file:///media/cdrom/

#       file:///media/cdrecorder/

gpgcheck=1

enabled=1

gpgkey=file:///etc/pki/rpm-gpg/RPM-GPG-KEY-CentOS-6

4,加載yum源

~]# yum clean all

Loaded plugins: fastestmirror, refresh-packagekit, security

Cleaning repos: c6-media

Cleaning up Everything

Cleaning up list of fastest mirrors

~]# yum repolist

Loaded plugins: fastestmirror, refresh-packagekit, security

Determining fastest mirrors

c6-media                                                 | 4.0 kB     00:00 ...

c6-media/primary_db                                      | 4.4 MB     00:00 ...

repo id                          repo name                                status

c6-media                         CentOS-6 - Media                         6,367

repolist: 6,367

评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

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

抵扣说明:

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

余额充值