1柒竞、配置網(wǎng)絡(luò)源(此處使用阿里源為例)
#備份原有yum配置文件
cp /etc/yum.repo.d
mkdir back
cp CentOS* pe* back
#下載阿里云的鏡像到/etc/yum.repos.d/
wget -O /etc/yum.repos.d/CentOS-Base.repo http://mirrors.aliyun.com/repo/Centos-7.repo
2、創(chuàng)建文件夾播聪,掛載本地光盤朽基,拷貝rpm包到/mnt/yum
mkdir /mnt/cdrom
mount /dev/cdrom /mnt/cdrom
cp /mnt/cdrom/Packages/* /mnt/yum
3、創(chuàng)建yum倉(cāng)庫(kù)
createrepo -v /mnt/yum
4离陶、編輯/etc/yum.repo.d/CentOS-Base.repo文件設(shè)置本地源
#在網(wǎng)絡(luò)源前面添加
[base-local]
name=Centos
baseurl=file:///mnt/yum
enable=1
gpgckeck=0
5稼虎、使用yum repolist 查看倉(cāng)庫(kù)
yum repolist
已加載插件:fastestmirror, langpacks
Repository base is listed more than once in the configuration
Loading mirror speeds from cached hostfile
* base: mirrors.aliyun.com
* extras: mirrors.aliyun.com
* updates: mirrors.aliyun.com
源標(biāo)識(shí) 源名稱 狀態(tài)
base/7/x86_64 CentOS-7 - Base - mirrors.aliyun.com 10,097
base-local Centos 4,021
extras/7/x86_64 CentOS-7 - Extras - mirrors.aliyun.com 307
updates/7/x86_64 CentOS-7 - Updates - mirrors.aliyun.com 1,010
repolist: 15,435