為本機提供軟件倉庫
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
-----------------------------------------------------------------------