制作本地yum源
步骤一:先将你需要的镜像找到上传到服务器里面 步骤二:创建一个目录挂载镜像
[root@k8s-node1 ~]
anaconda-ks.cfg CentOS-7-x86_64-DVD-2009.iso init.sh k8s
[root@k8s-node1 ~]
[root@k8s-node1 ~]
[root@k8s-node1 ~]
[root@k8s-node1 repository]
[root@k8s-node1 repository]
total 4601856
-rw-r--r-- 1 root root 4712300544 Mar 11 04:37 CentOS-7-x86_64-DVD-2009.iso
drwxr-xr-x 2 root root 6 Mar 11 04:35 {centos.temp}
[root@k8s-node1 repository]
挂载镜像到这个目录下面,就会产生很多目录,里面的Packages 目录全是rpm包
[root@k8s-node1 repository]
centos CentOS-7-x86_64-DVD-2009.iso temp
[root@k8s-node1 repository]
mount: /dev/loop0 is write-protected, mounting read-only
[root@k8s-node1 repository]
[root@k8s-node1 temp]
CentOS_BuildTag EULA images LiveOS repodata RPM-GPG-KEY-CentOS-Testing-7
EFI GPL isolinux Packages RPM-GPG-KEY-CentOS-7 TRANS.TBL
把rpm包都拷贝到centos这个目录下面
[root@k8s-node1 repository]
centos CentOS-7-x86_64-DVD-2009.iso temp
[root@k8s-node1 repository]
取消挂载
[root@k8s-node1 repository]
centos CentOS-7-x86_64-DVD-2009.iso temp
[root@k8s-node1 repository]
步骤三:修改yum源的配置文件 重点,先备份原来的yum源配置文件
[root@k8s-master ~]
[root@k8s-node1 yum.repos.d]
CentOS-Base.repo.bak CentOS-Debuginfo.repo CentOS-Media.repo CentOS-Vault.repo kubernetes.repo
CentOS-CR.repo CentOS-fasttrack.repo CentOS-Sources.repo docker-ce.repo
[root@k8s-node1 yum.repos.d]
编写新的配置文件vim Centos7.repo
[centos.repo]
name=Centos7.repo
baseurl=file:///repository/centos
enabled=1
gpgcheck=0
mv yum.repos.d yum.repos.d.bak
[root@k8s-node1 etc]
[root@k8s-node1 etc]
[root@k8s-node1 etc]
[root@k8s-node1 yum.repos.d]
Centos7.repo
[root@k8s-node1 yum.repos.d]
[root@k8s-node1 yum.repos.d]
[root@k8s-node1 yum.repos.d]
|