CentOS 本地iso挂载并配置iso镜像作为yum源安装软件

来源:互联网 发布:淘宝九牧官方旗舰店 编辑:程序博客网 时间:2024/04/28 02:34
1前提条件
操作系统:CentOS5.5
ISO文件:CentOS5.5的ISO镜像一个


2.使用图形化界面挂载ISO镜像




3.使用命令行挂载ISO镜像

ls -l /dev | grep cdrom  #找到光盘的完整路径


4.使用命令挂载

mount /dev/cdrom /mnt/

5.查看挂载状态 df -h 命令



5.使用本地iso做yum源
cd /etc/yum.repos.d/mv CentOS-Base.repo CentOS-Base.repo.bak #这个文件是配置连网yum源,由于没联网,不用它,改个名字cp CentOS-Media.repo CentOS-Media.repo.bak #这个文件是配置本地yum源,先备份,就算错了,也可以恢复cat  CentOS-Media.repo 

原本内容为



修改文件内容为


# CentOS-Media.repo## This repo is used to mount the default locations for a CDROM / DVD on#  CentOS-5.  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=c5-media [command]#  # or for ONLY the media repo, do this:##  yum --disablerepo=\* --enablerepo=c5-media [command] [c5-media]name=CentOS-$releasever - Mediabaseurl=file:///mnt/ #挂载的位置#baseurl=file:///media/CentOS/#        file:///media/cdrom/#        file:///media/cdrecorder/gpgcheck=1enabled=1 #这里记住一定要改为1gpgkey=file:///etc/pki/rpm-gpg/RPM-GPG-KEY-CentOS-5

四、更新一下,就OK了

yum clean all
测试使用yum list 查看可以安装的软件



0 0
原创粉丝点击