测试机上面k8s集群报错,折腾好几天没解决,好在是测试机索性重新安装,出问题了一直报Public key for 515b36bce35de42218470b171ae2ba5cd82132e63d98c7bb87e4298d61fde1dc-kubeadm-1.18.2-0.x86_64.rpm is not installed
后来发现Repository是本地的 _local.repo
mv _local.repo local.repo
yum clean al && yum repolist
在安装就可以了。
_local.repo 本地yum库的安装以vmware虚拟机为例:安装完了以后加载了cdrom
ios镜像挂载到/mnt/Centos下面;
[root@localhost /]$mkdir /mnt/Centos
[root@localhost /]$mount /dev/cdrom /mnt/Centos/
mount: /dev/sr0 is write-protected, mounting read-only
[root@localhost /mnt/Centos]$ll
total 698
-rw-rw-r–. 2 root root 14 Oct 30 2020 CentOS_BuildTag
drwxr-xr-x. 3 root root 2048 Jul 26 2022 EFI
-rw-rw-r–. 2 root root 227 Aug 30 2017 EULA
-rw-rw-r–. 2 root root 18009 Dec 10 2015 GPL
drwxr-xr-x. 3 root root 2048 Jul 26 2022 images
drwxr-xr-x. 2 root root 2048 Jul 26 2022 isolinux
drwxr-xr-x. 2 root root 2048 Jul 26 2022 LiveOS
drwxr-xr-x. 2 root root 675840 Jul 26 2022 Packages
drwxr-xr-x. 2 root root 4096 Jul 26 2022 repodata
-rw-rw-r–. 2 root root 1690 Dec 10 2015 RPM-GPG-KEY-CentOS-7
-rw-rw-r–. 2 root root 1690 Dec 10 2015 RPM-GPG-KEY-CentOS-Testing-7
-r–r–r–. 1 root root 2883 Jul 26 2022 TRANS.TBL
umount /mnt/Centos/ #取消挂载
[root@localhost /mnt]$cd Centos/
[root@localhost /mnt/Centos]$ll
total 0
编辑本地repo:
vim /etc/yum.repos.d/_local.repo
格式如下:
[base-local] 本源的名称
name 名称
baseurl 源路径
enabled 是否启用 1-开启 0-不开启
gpgcheck 是否安全检测 1-开启 0-不开启
gpgkey 公钥
[root@localhost /etc/yum.repos.d]$cat _local.repo
[base-local]
name=CentOS7.8
baseurl=file:///mnt/Centos
enabled=1
gpgcheck=1
gpgkey=file:///etc/pki/rpm-gpg/RPM-GPG-KEY-CentOS-7
搭建内网yum源:
测试机已经有了nginx
做个软连接,配置root目录:
ln -s /mnt/Centos yum
lrwxrwxrwx. 1 root root 11 Mar 27 17:06 yum -> /mnt/Centos
server {
listen 8081;
server_name 192.168.2.236;
root /data/yum/;
autoindex on; # 开启目录文件列表
#autoindex_exact_size on; # 显示出文件的确切大小,单位是bytes
#autoindex_localtime on; # 显示的文件时间为文件的服务器时间
#charset utf-8,gbk; # 避免中文乱码
error_log /data/log/nginx/yum_error.log;
access_log /data/log/nginx/yum_access.log;
}
做一个lan.repo
[base-local]
name=CentOS7.8
baseurl=http://192.168.2.236:8081/
enabled=1
gpgcheck=1
gpgkey=file:///etc/pki/rpm-gpg/RPM-GPG-KEY-CentOS-7
yum clean all && yum makecache
测试一下试试,测试完成以后修改
mv _local.repo local.repo
mv lan.repo lan.repo_
yum clean all && yum makecache
切回线上repo。