[{"createTime":1735734952000,"id":1,"img":"hwy_ms_500_252.jpeg","link":"https://activity.huaweicloud.com/cps.html?fromacct=261f35b6-af54-4511-a2ca-910fa15905d1&utm_source=V1g3MDY4NTY=&utm_medium=cps&utm_campaign=201905","name":"华为云秒杀","status":9,"txt":"华为云38元秒杀","type":1,"updateTime":1735747411000,"userId":3},{"createTime":1736173885000,"id":2,"img":"txy_480_300.png","link":"https://cloud.tencent.com/act/cps/redirect?redirect=1077&cps_key=edb15096bfff75effaaa8c8bb66138bd&from=console","name":"腾讯云秒杀","status":9,"txt":"腾讯云限量秒杀","type":1,"updateTime":1736173885000,"userId":3},{"createTime":1736177492000,"id":3,"img":"aly_251_140.png","link":"https://www.aliyun.com/minisite/goods?userCode=pwp8kmv3","memo":"","name":"阿里云","status":9,"txt":"阿里云2折起","type":1,"updateTime":1736177492000,"userId":3},{"createTime":1735660800000,"id":4,"img":"vultr_560_300.png","link":"https://www.vultr.com/?ref=9603742-8H","name":"Vultr","status":9,"txt":"Vultr送$100","type":1,"updateTime":1735660800000,"userId":3},{"createTime":1735660800000,"id":5,"img":"jdy_663_320.jpg","link":"https://3.cn/2ay1-e5t","name":"京东云","status":9,"txt":"京东云特惠专区","type":1,"updateTime":1735660800000,"userId":3},{"createTime":1735660800000,"id":6,"img":"new_ads.png","link":"https://www.iodraw.com/ads","name":"发布广告","status":9,"txt":"发布广告","type":1,"updateTime":1735660800000,"userId":3},{"createTime":1735660800000,"id":7,"img":"yun_910_50.png","link":"https://activity.huaweicloud.com/discount_area_v5/index.html?fromacct=261f35b6-af54-4511-a2ca-910fa15905d1&utm_source=aXhpYW95YW5nOA===&utm_medium=cps&utm_campaign=201905","name":"底部","status":9,"txt":"高性能云服务器2折起","type":2,"updateTime":1735660800000,"userId":3}]
1、将U盘作为本地yum源,首先挂载U盘,确保光盘挂载点有文件
[root@xuexi yum.repos.d]# ls /mnt CentOS_BuildTag EULA images LiveOS
repodata RPM-GPG-KEY-CentOS-Testing-7 EFI GPL isolinux Packages
RPM-GPG-KEY-CentOS-7 TRANS.TBL
2、yum的一切配置信息都存储在一个叫yum.repos.d目录下的配置文件中。所以跳转到/etc/yum.repo.d目录下
cd /etc/yum.repo.d
3、创建一个新的yum源配置文件,yum源配置文件的结尾必须是.repo
vim CentOS7.repo
内容如下:
[CentOS7] //yum的ID,本地唯一,用于区分不同yum源
name=CentOS-server //描述信息
baseurl=file:///mnt //前面的file://是协议,后面的/mnt是光盘挂载点
enabled=1 //1启用yum源,0禁用yum源 gpgcheck=0
//1使用公钥验证rpm包的正确性,0不验证
保存退出后就可以开始验证了。
如果启用公钥验证,需要配置公钥gpgkey=file:///etc/pki/rpm-gpg/RPM-GPG-KEY-CentOS-7
4、接着清空yum已存在的源信息(缓存)
1
2
3
4
5
6
[root@xuexi yum.repos.d]# yum clean all
已加载插件:fastestmirror, langpacks
正在清理软件源: CentOS7 base extras updates
Cleaning up everything
Maybe you want: rm -rf /var/cache/yum, to also free up space taken by orphaned
data from disabled or removed repos
Cleaning up list of fastest mirrors
查看本地源的所有软件,由于不太好展示,我只能大概说一下。使用命令” yum list |
more”(注意使用more限制一下输出),列表会有三列输出,在最后一列显示的是yum的ID(这里就是上面的[CentOS7]),有你设置的yum的ID就是成功了。
5、最后yum makecache