一、创建本地yum仓库
1.cd /etc/yum.repos.d/
2.创建配置文件:[root@li yum.repos.d]# vim local.repo
3.写入配置信息并保存
[li]
name=li1
enabled=1
gpgcheck=0(开机不自检)
baseurl=file:///mnt(这里写的路径是repodata所在的路径)
4.挂载光盘
[root@li yum.repos.d]# mount /dev/cdrom /mnt
mount: /dev/sr0 写保护,将以只读方式挂载
5.查看包
[root@li yum.repos.d]# yum clean all
已加载插件:fastestmirror, langpacks
正在清理软件源: li net
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
[root@li yum.repos.d]# yum repolist
已加载插件:fastestmirror, langpacks
li | 3.6 kB 00:00:00
net | 4.7 kB 00:00:00
(1/5): li/group_gz | 156 kB 00:00:00
(2/5): li/primary_db | 3.1 MB 00:00:00
(3/5): net/group_gz | 88 kB 00:00:00
(4/5): net/updateinfo | 1.0 MB 00:00:02
(5/5): net/primary_db | 6.7 MB 00:00:47
Determining fastest mirrors
源标识 源名称 状态
li li1 3,894
repolist: 3894
二、网络yum源–配置epel源
1.创建本地yum文件:vim net.repo
2.编辑配置文件:
[net]
name=aliyun
enabled=1
gpgcheck=0
baseurl=https://mirrors.aliyun.com/epel/7/x86_64/(此网址为包含repodata选项页面的网址)
3.清空缓存:[root@li yum.repos.d]# yum clean all
4.查看包:
[root@li yum.repos.d]# yum repolist
已加载插件:fastestmirror, langpacks
Loading mirror speeds from cached hostfile
源标识 源名称 状态
li li1 3,894
net aliyun 13,190
repolist: 17,084