Linux學習-通過光碟配置本地yum源

丟爸發表於2020-12-31

本例通過虛擬機器Centos6系統完成

  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) <centos-6-key@centos.org>"
 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源配置成功

相關文章