为本机提供软件仓库
1)挂载
创建临时挂载点: /mnt/dvd
挂载CentOS7光盘:mount /dev/cdrom /mnt/dvd/
2)创建仓库
创建仓库目录:mkdir -p /repo/cos7dvd
拷贝文件: cp -rf /mnt/dvd/* /repo/cos7dvd
设置开机自动挂载:vim /etc/fstab
/dev/cdrom /repo/cos7dvd iso9660 defaults 0 0
---------------------------------------------------------------------
使用本机目录作为软件源
1)清理旧的配置,不可用的配置:
mkdir /etc/yum.repos.d/oldrepo
mv /etc/yum.repos.d/*.repo /etc/yum.repos.d/oldrepo
2)添加新的软件源,指向前一步准备的本地软件仓库
添加软件源:yum-config-manager --add-repo file:///repo/cos7dvd
查看添加的配置文件:ls /etc/yum.repo.d/
禁止检查软件签名:vim mnt_dvd_.repo
[mnt_dvd_] name=added from: file:///mnt/dvd/
baseurl=file:///mnt/dvd/
enabled=1 gpgcheck=0 #在末尾增加这一行
3)清理yum缓存数据:yum clean all
4)列出软件仓库列表,确认结果: yum repolist
5)查询vim命令 在哪个软件包里: yum provides */vim
-----------------------------------------------------------------------