一、互联网yum源(centos7为例):
cd /etc/yum.repos.d/ && rm -f *.repo;wget -O /etc/yum.repos.d/CentOS-Base.repo http://mirrors.aliyun.com/repo/Centos-7.repo && wget -P /etc/yum.repos.d/ http://mirrors.aliyun.com/repo/epel-7.repo;sed -i 's/$releasever/7/g' CentOS-Base.repo;sed -i 's/$basearch/x86_64/g' CentOS-Base.repo;sed -i 's/$basearch/x86_64/g' epel-7.repo;yum clean all && yum makecache fast;
配置完毕
二、无网服务器挂载操作系统镜像,手动制作yum源
mkdir /mnt/cdrom
查看光驱挂载路径 df -h
看到光驱路径为 /dev/sr0
mount /dev/cdrom /mnt/cdrom
挂载成功后,查看/mnt/cdrom中内容
修改dvd.repo文件
vi /etc/yum.repos.d/dvd.repo
输入如下内容
[rhel-6.5]
name=Red Hat Enterprise Linux $releasever - $basearch - Source
baseurl=file:///mnt/cdrom
enabled=1
gpgcheck=0
执行 yum makecache 命令重新创建缓存。 如果该命令正常执行如下