Linux学习-通过光盘配置本地yum源

本例通过虚拟机Centos6系统完成

  1. 先确认光驱已存在光盘,并且设备的状态是已连接。
    Linux学习-通过光盘配置本地yum源_第1张图片
  2. 挂载光盘到本地目录
#挂载光盘到本地目录
[root@localhost ~]# mount /dev/sr0 /mnt
mount: block device /dev/sr0 is write-protected, mounting read-only
  1. 进入到/etc/yum.repos.d目录,配置repo文件
[root@localhost mnt]# cd /etc/yum.repos.d
[root@localhost yum.repos.d]# 
[root@localhost yum.repos.d]# mkdir bak
[root@localhost yum.repos.d]# mv *.repo bak
[root@localhost yum.repos.d]# vi local.repo
#local.repo文件内容
[CentOS-dvd]
name=Centos $releasever - DVD
baseurl=file:///mnt/
enabled=1
gpgcheck=1
gpgkey=file:///etc/pki/rpm-gpg/REM-GPG-KEY-CentOS-6
#复制REM-GPG-KEY-CentOS-6文件到/etc/pki/rpm-gpg/目录
[root@localhost mnt]# cp RPM-GPG-KEY-CentOS-6 /etc/pki/rpm-gpg/REM-GPG-KEY-CentOS-6
[root@localhost yum.repos.d]# yum makecache
  1. 安装软件测试
[root@localhost mnt]# yum install -y man
Loaded plugins: fastestmirror
Setting up Install Process
Loading mirror speeds from cached hostfile
Resolving Dependencies
--> Running transaction check
---> Package man.x86_64 0:1.6f-39.el6 will be installed
--> Finished Dependency Resolution

Dependencies Resolved

================================================================================
 Package      Arch            Version                 Repository           Size
================================================================================
Installing:
 man          x86_64          1.6f-39.el6             CentOS-dvd          265 k

Transaction Summary
================================================================================
Install       1 Package(s)

Total download size: 265 k
Installed size: 389 k
Downloading Packages:
warning: rpmts_HdrFromFdno: Header V3 RSA/SHA1 Signature, key ID c105b9de: NOKEY
Retrieving key from file:///etc/pki/rpm-gpg/REM-GPG-KEY-CentOS-6
Importing GPG key 0xC105B9DE:
 Userid: "CentOS-6 Key (CentOS 6 Official Signing Key) "
 From  : /etc/pki/rpm-gpg/REM-GPG-KEY-CentOS-6
Running rpm_check_debug
Running Transaction Test
Transaction Test Succeeded
Running Transaction
  Installing : man-1.6f-39.el6.x86_64                                       1/1 
  Verifying  : man-1.6f-39.el6.x86_64                                       1/1 

Installed:
  man.x86_64 0:1.6f-39.el6                                                      

Complete!
  1. 软件安装成功,yum源配置成功

你可能感兴趣的:(Linux,linux)