centos7配置本地yum源(ISO镜像版)
背景:
由于本地的centos选择的是最小化安装,很多的包是没有的,比如常用的wget,gcc等等,所以需要使用iso镜像配置下本地yum源。
1、下载centos镜像
注意下镜像不能是mini版的,要用dvd或者everything版的,mini版很多包是缺失的
镜像地址:https://mirrors.aliyun.com/centos/7/isos/x86_64/?spm=a2c6h.25603864.0.0.200e4511qh3X7S
2、虚拟机加载ISO镜像
3、挂载IOS镜像
mkdir /mnt/isomount -o loop /dev/cdrom /mnt/isodf -lh
4、修改yum源
# 备份cd /etc/yum.repos.d/lscp CentOS-Base.repo CentOS-Base.repo.default
vi CentOS-Base.repo
修改后的文件如下:
[base]name=CentOS-$releasever - Base#mirrorlist=http://mirrorlist.centos.org/?release=$releasever&arch=$basearch&repo=os&infra=$infrabaseurl=file:///mnt/iso#baseurl=http://mirror.centos.org/centos/$releasever/os/$basearch/gpgcheck=1gpgkey=file:///etc/pki/rpm-gpg/RPM-GPG-KEY-CentOS-7#released updates[updates]name=CentOS-$releasever - Updates#mirrorlist=http://mirrorlist.centos.org/?release=$releasever&arch=$basearch&repo=updates&infra=$infrabaseurl=file:///mnt/iso#baseurl=http://mirror.centos.org/centos/$releasever/updates/$basearch/gpgcheck=1gpgkey=file:///etc/pki/rpm-gpg/RPM-GPG-KEY-CentOS-7#additional packages that may be useful[extras]name=CentOS-$releasever - Extras#mirrorlist=http://mirrorlist.centos.org/?release=$releasever&arch=$basearch&repo=extras&infra=$infrabaseurl=file:///mnt/iso#baseurl=http://mirror.centos.org/centos/$releasever/extras/$basearch/gpgcheck=1gpgkey=file:///etc/pki/rpm-gpg/RPM-GPG-KEY-CentOS-7#additional packages that extend functionality of existing packages[centosplus]name=CentOS-$releasever - Plus#mirrorlist=http://mirrorlist.centos.org/?release=$releasever&arch=$basearch&repo=centosplus&infra=$infrabaseurl=file:///mnt/iso#baseurl=http://mirror.centos.org/centos/$releasever/centosplus/$basearch/gpgcheck=1enabled=0gpgkey=file:///etc/pki/rpm-gpg/RPM-GPG-KEY-CentOS-7
5、更新yum源配置
yum clean allyum makecache
6、测试本地yum源
# 安装wgetyum install -y wget
来源地址:https://blog.csdn.net/2301_78148444/article/details/130669923