前言

  • 网上找适合CentOS6.5的yum源很困难了
  • 替代方案,将安装光盘作为yum源
  • 我用的是VMware虚拟机。嗯,虚拟机还可以挂光盘,那要是云主机呢?可以考虑将文件拷贝到云主机的某个目录,将该目录作为yum源。
  • CentOS6.5 CD: CentOS-6.5-x86_64-bin-DVD1.iso

基本步骤

  1. VMware虚拟机已经添加好光驱,光驱中放上CentOS6.5安装盘。
  2. mount命令查看是否已经挂接了光驱。如果已挂接,直接看
    未挂接是这样的:
 shell> mount
/dev/mapper/VolGroup-lv_root on / type ext4 (rw)
proc on /proc type proc (rw)
sysfs on /sys type sysfs (rw)
devpts on /dev/pts type devpts (rw,gid=5,mode=620)
tmpfs on /dev/shm type tmpfs (rw,rootcontext="system_u:object_r:tmpfs_t:s0")
/dev/sda1 on /boot type ext4 (rw)
none on /proc/sys/fs/binfmt_misc type binfmt_misc (rw)

已挂接是这样的:

shell> mount
/dev/mapper/VolGroup-lv_root on / type ext4 (rw)
proc on /proc type proc (rw)
sysfs on /sys type sysfs (rw)
devpts on /dev/pts type devpts (rw,gid=5,mode=620)
tmpfs on /dev/shm type tmpfs (rw,rootcontext="system_u:object_r:tmpfs_t:s0")
/dev/sda1 on /boot type ext4 (rw)
none on /proc/sys/fs/binfmt_misc type binfmt_misc (rw)
/dev/sr0 on /mnt/cdrom type iso9660 (ro)
  1. 创建光驱挂载点
shell> mkdir /mnt/cdrom
  1. 挂载光驱
shell> mount  /dev/sr0  /mnt/cdrom
mount: block device /dev/sr0 is write-protected, mounting read-only
shell> mount
/dev/mapper/VolGroup-lv_root on / type ext4 (rw)
proc on /proc type proc (rw)
sysfs on /sys type sysfs (rw)
devpts on /dev/pts type devpts (rw,gid=5,mode=620)
tmpfs on /dev/shm type tmpfs (rw,rootcontext="system_u:object_r:tmpfs_t:s0")
/dev/sda1 on /boot type ext4 (rw)
none on /proc/sys/fs/binfmt_misc type binfmt_misc (rw)
/dev/sr0 on /mnt/cdrom type iso9660 (ro)
  1. 配置yum源
    先备份
shell> cd /etc/yum.repos.d/
shell> mv CentOS-Base.repo CentOS-Base.repo.backup
shell> mv CentOS-Debuginfo.repo CentOS-Debuginfo.repo.backup
shell> mv CentOS-Vault.repo CentOS-Vault.repo.backup
shell> cp CentOS-Media.repo CentOS-Media.repo.backup
shell> ls
CentOS-Base.repo.backup       CentOS-Media.repo         CentOS-Vault.repo.backup
CentOS-Debuginfo.repo.backup  CentOS-Media.repo.backup

再修改

shell> vi /etc/yum.repos.d/CentOS-Media.repo
----------------------------
[c6-media]
name=CentOS-$releasever - Media
# 挂载的光盘路径
baseurl=file:///mnt/cdrom/
gpgcheck=1
# 启用此yum源
enabled=1
gpgkey=file:///etc/pki/rpm-gpg/RPM-GPG-KEY-CentOS-6
  1. 检查yum源
shell> yum repolist
Loaded plugins: fastestmirror
Loading mirror speeds from cached hostfile
repo id                                      repo name                                             status
c6-media                                     CentOS-6 - Media                                      6,364+3
repolist: 6,364
  1. 查看yum源中是否有wget
shell> yum info wget
Loaded plugins: fastestmirror
Loading mirror speeds from cached hostfile
Available Packages
Name        : wget
Arch        : x86_64
Version     : 1.12
Release     : 1.8.el6
Size        : 482 k
Repo        : c6-media
Summary     : A utility for retrieving files using the HTTP or FTP protocols
URL         : http://www.gnu.org/software/wget/
License     : GPLv3+ and GFDL
Description : GNU Wget is a file retrieval utility which can use either the HTTP or: FTP protocols. Wget features include the ability to work in the: background while you are logged out, recursive retrieval of: directories, file name wildcard matching, remote file timestamp: storage and comparison, use of Rest with FTP servers and Range with: HTTP servers to retrieve files over slow or unstable connections,: support for Proxy servers, and configurability.
  1. 安装 wget
shell> yum -y install wget
Loaded plugins: fastestmirror
Loading mirror speeds from cached hostfile
Available Packages
Name        : wget
Arch        : x86_64
Version     : 1.12
Release     : 1.8.el6
Size        : 482 k
Repo        : c6-media
Summary     : A utility for retrieving files using the HTTP or FTP protocols
URL         : http://www.gnu.org/software/wget/
License     : GPLv3+ and GFDL
Description : GNU Wget is a file retrieval utility which can use either the HTTP or: FTP protocols. Wget features include the ability to work in the: background while you are logged out, recursive retrieval of: directories, file name wildcard matching, remote file timestamp: storage and comparison, use of Rest with FTP servers and Range with: HTTP servers to retrieve files over slow or unstable connections,: support for Proxy servers, and configurability.[root@localhost yum.repos.d]# ^C
[root@localhost yum.repos.d]# yum -y install wget
Loaded plugins: fastestmirror
Loading mirror speeds from cached hostfile
Setting up Install Process
Resolving Dependencies
--> Running transaction check
---> Package wget.x86_64 0:1.12-1.8.el6 will be installed
--> Finished Dependency ResolutionDependencies Resolved==========================================================================================================Package              Arch                   Version                       Repository                Size
==========================================================================================================
Installing:wget                 x86_64                 1.12-1.8.el6                  c6-media                 482 kTransaction Summary
==========================================================================================================
Install       1 Package(s)Total download size: 482 k
Installed size: 1.8 M
Downloading Packages:
Running rpm_check_debug
Running Transaction Test
Transaction Test Succeeded
Running TransactionInstalling : wget-1.12-1.8.el6.x86_64                                                               1/1Verifying  : wget-1.12-1.8.el6.x86_64                                                               1/1Installed:wget.x86_64 0:1.12-1.8.el6Complete!

参考

https://jingyan.baidu.com/article/425e69e6e033aebe15fc162b.html

CentOS6.5 将安装光盘作为yum源相关推荐

  1. 配置安装光盘为yum源

    首先用vsphere连接上光盘 创建一个光盘挂载目录 [root@localhost /]# mkdir -p /mnt/cdrom/ 挂载光盘 [root@localhost /]# mount / ...

  2. CentOS 6.x 使用安装光盘作为yum源

    挂载光驱 [root@yanjin ~]#  mount /dev/cdrom /media/ 修改yum配置文件 [root@yanjin ~]#  vim /etc/yum.repos.d/Cen ...

  3. linux 本地yum 恢复,Linux_RHEL系统恢复安装光盘中的yum更新源的方法,安装光盘本地YUM更新源挂载安 - phpStudy...

    RHEL系统恢复安装光盘中的yum更新源的方法 安装光盘本地YUM更新源挂载安装光盘: 复制代码代码如下: mount /dev/cdrom /mnt vi /etc/yum.repos.d/loca ...

  4. Linux使用本地光盘制作yum源

    为什么要使用本地光盘制作yum源? 在系统不能联网的情况下,就需要我们在Linux系统下使用光盘制作yum源. 具体操作步骤如下: 1.挂载光盘. 2.删除/etc/yum.repos.d目录下的所有 ...

  5. CentOS 6.5使用本地光盘做yum源

    很多时候因为服务器不能联网,部分软件使用yum的时候,无法使用.现在我们使用本地光盘作为yum源. 挂载光盘 [root@×××Server ~]# mount /dev/cdrom /media m ...

  6. RedHat Linux 7安装CentOS 7 yum源

    RedHat Linux 7安装CentOS 7 yum源 问题描述 解决步骤 0,进入/opt目录,进入root模式,新建yum目录 1,查看自己redhat版本 2,查看redhat 7.0系统本 ...

  7. CentOS各版本挂载光盘做yum源安装

    mount /dev/cdrom /media ##Centos5## vi /etc/yum.repos.d/CentOS-Base.repo [c5-media] name=CentOS-$rel ...

  8. RHEL8 配置光盘源和yum源

    一.配置光盘源的方式 1.切换至root账户 [zhy@localhost ~]$ su - Password: [root@localhost ~]# 2.创建并挂载RHEL光盘到指定目录 [roo ...

  9. linux用光盘作yum源实验步骤,Linux使用系统光盘作为YUM源

    CentOS 使用方法 挂载光盘 Linux代码 # mkdir /media/cdrom # mount /dev/cdrom /media/cdrom yum源文件说明 在 /etc/yum.re ...

最新文章

  1. linux查看当前的工作目录,Linux-查看当前工作目录(pwd)
  2. python视频教程云盘-Python自动化测试视频教程【百度云盘下载】
  3. Swift - 自定义单元格实现微信聊天界面
  4. c语言 程序延时 校准,c语言实现系统时间校正工具代码分享
  5. [渝粤教育] 广东-国家-开放大学 21秋期末考试招投标与合同管理10217k2 (2)
  6. pandas之时间数据
  7. 01_SpringCoud 整合SpringCoud alibaba Nacos
  8. NullPointerException空指针异常的理解
  9. html在线取色,JS实现的RGB网页颜色在线取色器完整实例
  10. 大学论文的研究框架是什么?
  11. 用友ERP实施流程(不是本人所写,只是个搬运工!)
  12. 楚留香服务器维护时间,《一梦江湖》手游官方网站_《楚留香》现已全面升级重制-3月9日维护更新公告...
  13. win7笔记本外接显示器html,笔记本连显示器的步骤_笔记本如何外接显示器-win7之家...
  14. one 主格 复数 宾格_数字 主格宾格复数所有格
  15. C语言实现简单卡尔曼滤波
  16. 什么是主力的入资异常介入点?如何捕捉主力入资?
  17. html5/css实现字体上划线
  18. 利用相控阵馈源技术提高射电望远镜性能
  19. Oracle 修改表存储空间
  20. 数字音频总线A2B开发详解七(A2B一主两从系统配置详解-D主B1和B2从)

热门文章

  1. 201621123028《Java程序设计》第5周学习总结
  2. int*与(int*)的差别
  3. PHPexcel实列
  4. 实战:将企业域名解析委派给企业DNS服务器
  5. centos 6.3 x86_64安装32位JDK的问题
  6. javascript获取url参数的代码
  7. Delphi连接AutoCAD_计算任意线条的长度宏的嵌套
  8. jquery 里面对数组去重操作-unique
  9. Jquery跳出each循环
  10. 在使用模板时遇到的错误,TypeError at /index/ context must be a dict rather than RequestContext(亲测)