本地 yum:
[[email protected] ~]# umount /media/
umount: /media/: 未挂载
[[email protected] ~]# mount /dev/sr0 /media/
mount: /dev/sr0 写保护, 将以只读方式挂载
- [[email protected] ~]# df
- /dev/sr0 4480476 4480476 0 100% /media
- [[email protected] ~]# cd /etc/yum.repos.d/
- [[email protected] yum.repos.d]# mkdir /cdrom
- [[email protected] yum.repos.d]# mv C*/cdrom/
- [[email protected] yum.repos.d]# VIM local.repo
- [kgc]
- name=kgc
- baseurl=file:///media
- enabled=1
- gpgcheck=0
- [[email protected] yum.repos.d]# yum -y clean all // 清除 yum 仓库
已加载插件: fastestmirror, langpacks
正在清理软件源: kgc
- Cleaning up list of fastest mirrors
- Other repos take up 450 M of disk space (use --verbose for details)
- [[email protected] yum.repos.d]# yum makecache // 重建元数据缓存
已加载插件: fastestmirror, langpacks
- Determining fastest mirrors
- kgc | 3.6 kB 00:00:00
- (1/4): kgc/group_gz | 166 kB 00:00:00
- (2/4): kgc/filelists_db | 3.2 MB 00:00:00
- (3/4): kgc/primary_db | 3.1 MB 00:00:00
- (4/4): kgc/other_db | 1.3 MB 00:00:00
元数据缓存已建立
在线 yum:(在阿里镜像引导下载, 配置 epel yum 源)
- [[email protected] ~]# VIM 163.repo
- [163]
- name=163
- baseurl=http://mirrors.163.com/centos/7.6.1810/os/x86_64/
- gpgcheck=0
- enabled=1
- [[email protected] ~]# cd /etc/yum.repos.d/
- [[email protected] yum.repos.d]# wget http://mirrors.aliyun.com/repo/Centos-7.repo //wget 是一个下载文件的工具
- --2019-09-09 09:46:47-- http://mirrors.aliyun.com/repo/Centos-7.repo
正在解析主机 mirrors.aliyun.com (mirrors.aliyun.com)... 219.238.20.83, 219.238.20.85, 219.238.20.101, ...
正在连接 mirrors.aliyun.com (mirrors.aliyun.com)|219.238.20.83|:80... 失败: 拒绝连接.
正在连接 mirrors.aliyun.com (mirrors.aliyun.com)|219.238.20.85|:80... 已连接.
已发出 HTTP 请求, 正在等待回应... 200 OK
长度: 2523 (2.5K) [application/octet-stream]
正在保存至: "Centos-7.repo"
100%[===============================================================================>] 2,523 11.2KB/s 用时 0.2s
2019-09-09 09:47:09 (11.2 KB/s) - 已保存 "Centos-7.repo" [2523/2523])
[[email protected] yum.repos.d]#
来源: http://www.bubuko.com/infodetail-3189462.html