centos7配置本地yum源(ISO镜像版)
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/iso
mount -o loop /dev/cdrom /mnt/iso
df -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 all
yum makecache
6、测试本地yum源
# 安装wget
yum install -y wget
版权归原作者 hepijiu321 所有, 如有侵权,请联系我们删除。