本地ISO文件作为YUM源

1、上传ISO文件:
ssh登录系统后台,alt+p打开sftp

sftp> put F:/CentOS-7-x86_64-Everything-2009.iso
Uploading CentOS-7-x86_64-Everything-2009.iso to /root/CentOS-7-x86_64-Everything-2009.iso
  100% 9961472KB  26353KB/s 00:06:18     
F:\CentOS-7-x86_64-Everything-2009.iso: 10200547328 bytes transferred in 378 seconds (26353 KB/s)
sftp>

[root@k8s.xqs.master ~]#mv CentOS-7-x86_64-Everything-2009.iso /opt/

2、创建挂载目录

[root@k8s.xqs.master ~]#mkdir /mnt/centos7

3、修改fstab文件

[root@k8s.xqs.master ~]#cat /etc/fstab
#
# /etc/fstab
# Created by anaconda on Mon Nov  1 00:49:15 2021
#
# Accessible filesystems, by reference, are maintained under '/dev/disk'
# See man pages fstab(5), findfs(8), mount(8) and/or blkid(8) for more info
#
/dev/mapper/centos-root /                       xfs     defaults        0 0
UUID=29f469aa-9966-4bc5-9e26-bf2184f6b68c /boot                   xfs     defaults        0 0
#/dev/mapper/centos-swap swap                    swap    defaults        0 0
/dev/sr0 /media iso9660 defaults 0 0
/opt/CentOS-7-x86_64-Everything-2009.iso /mnt/centos7/ defaults,ro,-o loop 0 0

[root@k8s.xqs.master ~]#mount -a
mount: /dev/loop0 is write-protected, mounting read-only
[root@k8s.xqs.master ~]#cd /mnt/centos7/
[root@k8s.xqs.master /mnt/centos7]#ll
total 1668
-rw-r--r--  1 root root      14 Oct 30  2020 CentOS_BuildTag
drwxr-xr-x  3 root root    2048 Oct 27  2020 EFI
-rw-rw-r-- 17 root root     227 Aug 30  2017 EULA
-rw-rw-r-- 17 root root   18009 Dec 10  2015 GPL
drwxr-xr-x  3 root root    2048 Oct 27  2020 images
drwxr-xr-x  2 root root    2048 Oct 27  2020 isolinux
drwxr-xr-x  2 root root    2048 Oct 27  2020 LiveOS
drwxr-xr-x  2 root root 1669120 Oct 29  2020 Packages
drwxr-xr-x  2 root root    4096 Oct 30  2020 repodata
-rw-rw-r-- 17 root root    1690 Dec 10  2015 RPM-GPG-KEY-CentOS-7
-rw-rw-r-- 15 root root    1690 Dec 10  2015 RPM-GPG-KEY-CentOS-Testing-7
-r--r--r--  1 root root    2883 Nov  2  2020 TRANS.TBL

4、编辑repo文件

[root@k8s.xqs.master ~]#cat /etc/yum.repos.d/centos.repo
[centos7]
name=centos7
baseurl=file:///mnt/centos7/
enable=1
gpgcheck=0

5、验证安装包

[root@k8s.xqs.master ~]#yum repolist
Loaded plugins: fastestmirror
Loading mirror speeds from cached hostfile
* base: mirrors.aliyun.com
* extras: mirrors.aliyun.com
* updates: mirrors.aliyun.com
base                                                                                                                                              | 3.6 kB  00:00:00     
base-centos7.9                                                                                                                                    | 3.6 kB  00:00:00     
centos7                                                                                                                                           | 3.6 kB  00:00:00     
docker-ce-stable                                                                                                                                  | 3.5 kB  00:00:00     
epel                                                                                                                                              | 4.7 kB  00:00:00     
extras                                                                                                                                            | 2.9 kB  00:00:00     
kubernetes/signature                                                                                                                              |  844 B  00:00:00     
kubernetes/signature                                                                                                                              | 1.4 kB  00:00:00 !!!
updates                                                                                                                                           | 2.9 kB  00:00:00     
(1/7): centos7/group_gz                                                                                                                           | 153 kB  00:00:00     
(2/7): centos7/primary_db                                                                                                                         | 6.1 MB  00:00:00     
(3/7): docker-ce-stable/7/x86_64/primary_db                                                                                                       |  70 kB  00:00:00     
(4/7): epel/x86_64/updateinfo                                                                                                                     | 1.0 MB  00:00:00     
(5/7): epel/x86_64/primary_db                                                                                                                     | 7.0 MB  00:00:02     
(6/7): updates/7/x86_64/primary_db                                                                                                                |  13 MB  00:00:04     
(7/7): kubernetes/primary                                                                                                                         | 102 kB  00:00:28     
kubernetes                                                                                                                                                       751/751
repo id                                                                repo name                                                                                   status
base/7/x86_64                                                          CentOS-7 - Base - mirrors.aliyun.com                                                        10,072
base-centos7.9                                                         base-centos7.9                                                                              10,072
centos7                                                                centos7                                                                                     10,072
docker-ce-stable/7/x86_64                                              Docker CE Stable - x86_64                                                                      139
epel/x86_64                                                            Extra Packages for Enterprise Linux 7 - x86_64                                              13,709
extras/7/x86_64                                                        CentOS-7 - Extras - mirrors.aliyun.com                                                         500
kubernetes                                                             Kubernetes                                                                                     751
updates/7/x86_64                                                       CentOS-7 - Updates - mirrors.aliyun.com                                                      3,252
repolist: 48,567
[root@k8s.xqs.master ~]#
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值