CentOS 6.5配置本地DVD yum 源

[root@centos06 yum.repos.d]# cat /etc/redhat-release
CentOS release 6.5 (Final)

[root@centos06 yum.repos.d]# uname -a
Linux centos06 2.6.32-431.el6.x86_64 #1 SMP Fri Nov 22 03:15:09 UTC 2013 x86_64 x86_64 x86_64 GNU/Linux

[root@centos06 yum.repos.d]# pwd
/etc/yum.repos.d

[root@centos06 yum.repos.d]# df -h
Filesystem Size Used Avail Use% Mounted on
/dev/mapper/vg_centos03-lv_root 18G 1.9G 15G 12% /
tmpfs 116M 0 116M 0% /dev/shm
/dev/sda1 485M 34M 426M 8% /boot
/dev/sr0 4.2G 4.2G 0 100% /mnt

[root@centos06 yum.repos.d]# ls -ltr
total 16
-rw-r--r--. 1 root root 3664 Nov 27 2013 CentOS-Vault.repo
-rw-r--r--. 1 root root 630 Nov 27 2013 CentOS-Media.repo
-rw-r--r--. 1 root root 638 Nov 27 2013 CentOS-Debuginfo.repo
-rw-r--r--. 1 root root 1926 Nov 27 2013 CentOS-Base.repo

[root@centos06 yum.repos.d]# ls -ltr
\total 16
-rw-r--r--. 1 root root 3664 Nov 27 2013 CentOS-Vault.repo
-rw-r--r--. 1 root root 630 Nov 27 2013 CentOS-Media.repo
-rw-r--r--. 1 root root 638 Nov 27 2013 CentOS-Debuginfo.repo
-rw-r--r--. 1 root root 1926 Nov 27 2013 CentOS-Base.repo

[root@centos06 yum.repos.d]# mkdir /mnt/iso

[root@centos06 yum.repos.d]# mount -t iso9660 -o loop /dev/cdrom /mnt/iso

[root@centos06 yum.repos.d]# df -h
Filesystem Size Used Avail Use% Mounted on
/dev/mapper/vg_centos03-lv_root 18G 1.9G 15G 12% /
tmpfs 116M 0 116M 0% /dev/shm
/dev/sda1 485M 34M 426M 8% /boot
/dev/sr0 4.2G 4.2G 0 100% /mnt/iso

[root@centos06 yum.repos.d]# ls -ltr /mnt/iso/
total 682
-r--r--r--. 2 root root 1734 Nov 28 2013 RPM-GPG-KEY-CentOS-Testing-6
-r--r--r--. 2 root root 1730 Nov 28 2013 RPM-GPG-KEY-CentOS-Security-6
-r--r--r--. 2 root root 1730 Nov 28 2013 RPM-GPG-KEY-CentOS-Debug-6
-r--r--r--. 2 root root 1706 Nov 28 2013 RPM-GPG-KEY-CentOS-6
-r--r--r--. 2 root root 18009 Nov 28 2013 GPL
-r--r--r--. 2 root root 212 Nov 28 2013 EULA
-r--r--r--. 2 root root 1354 Nov 28 2013 RELEASE-NOTES-en-US.html
-r--r--r--. 2 root root 14 Nov 29 2013 CentOS_BuildTag
dr-xr-xr-x. 2 root root 2048 Nov 29 2013 isolinux
dr-xr-xr-x. 3 root root 2048 Nov 29 2013 EFI
dr-xr-xr-x. 2 root root 655360 Nov 29 2013 Packages
dr-xr-xr-x. 2 root root 4096 Nov 29 2013 repodata
-r--r--r--. 1 root root 3380 Nov 29 2013 TRANS.TBL
dr-xr-xr-x. 3 root root 2048 Nov 29 2013 images

[root@centos06 yum.repos.d]# ls -ltr /mnt/iso/Packages | head
total 4084837
-r--r--r--. 2 root root 169428 Jul 3 2011 abyssinica-fonts-1.0-5.1.el6.noarch.rpm
-r--r--r--. 3 root root 22944 Jul 3 2011 aic94xx-firmware-30-2.el6.noarch.rpm
-r--r--r--. 2 root root 556228 Jul 3 2011 akonadi-1.2.1-2.el6.i686.rpm
-r--r--r--. 2 root root 127636 Jul 3 2011 alacarte-0.12.4-1.el6.noarch.rpm
-r--r--r--. 2 root root 35156 Jul 3 2011 alsa-plugins-pulseaudio-1.0.21-3.el6.i686.rpm
-r--r--r--. 2 root root 6287552 Jul 3 2011 anthy-9100h-10.1.el6.i686.rpm
-r--r--r--. 2 root root 1855532 Jul 3 2011 apache-jasper-5.5.28-3.el6.noarch.rpm
-r--r--r--. 2 root root 167500 Jul 3 2011 apache-tomcat-apis-0.1-1.el6.noarch.rpm
-r--r--r--. 2 root root 933716 Jul 3 2011 arts-1.5.10-10.el6.i686.rpm

[root@centos06 yum.repos.d]# ls -ltr
total 16
-rw-r--r--. 1 root root 3664 Nov 27 2013 CentOS-Vault.repo
-rw-r--r--. 1 root root 630 Nov 27 2013 CentOS-Media.repo
-rw-r--r--. 1 root root 638 Nov 27 2013 CentOS-Debuginfo.repo
-rw-r--r--. 1 root root 1926 Nov 27 2013 CentOS-Base.repo

[root@centos06 yum.repos.d]# mv CentOS-Base.repo CentOS-Base.repo.bk.20180124

[root@centos06 yum.repos.d]# cp -p CentOS-Media.repo CentOS-Media.repo.bk.20180124

[root@centos06 yum.repos.d]# vi CentOS-Media.repo

[root@centos06 yum.repos.d]# diff CentOS-Media.repo CentOS-Media.repo.bk.20180124

16c16
< baseurl=file:///mnt/iso/


baseurl=file:///media/CentOS/

20c20
< enabled=1


enabled=0
[root@centos06 yum.repos.d]#

[root@centos06 yum.repos.d]# yum clean all
Loaded plugins: fastestmirror, security
Cleaning repos: c6-media
Cleaning up Everything

[root@centos06 yum.repos.d]# yum makecache
Loaded plugins: fastestmirror, security
Determining fastest mirrors

  • c6-media:
    file:///media/cdrecorder/repodata/repomd.xml: [Errno 14] Could not open/read file:///media/cdrecorder/repodata/repomd.xml
    Trying other mirror.
    file:///media/cdrom/repodata/repomd.xml: [Errno 14] Could not open/read file:///media/cdrom/repodata/repomd.xml
    Trying other mirror.
    c6-media | 4.0 kB 00:00 ...
    c6-media/group_gz | 220 kB 00:00 ...
    c6-media/filelists_db | 5.8 MB 00:00 ...
    c6-media/primary_db | 4.4 MB 00:00 ...
    c6-media/other_db | 2.7 MB 00:00 ...
    Metadata Cache Created

[root@centos06 yum.repos.d]# rpm -qa | grep telnet

[root@centos06 yum.repos.d]# rpm -qa | grep nmap

[root@centos06 yum.repos.d]# yum install telnet
Loaded plugins: fastestmirror, security
Loading mirror speeds from cached hostfile

  • c6-media:
    Setting up Install Process
    Resolving Dependencies
    --> Running transaction check
    ---> Package telnet.x86_64 1:0.17-47.el6_3.1 will be installed
    --> Finished Dependency Resolution

Dependencies Resolved

=============================================================================
Package Arch Version Repository Size

=============================================================================

Installing:
telnet x86_64 1:0.17-47.el6_3.1 c6-media 58 k

Transaction Summary

=============================================================================
Install 1 Package(s)

Total download size: 58 k
Installed size: 109 k
Is this ok [y/N]: y
Downloading Packages:
warning: rpmts_HdrFromFdno: Header V3 RSA/SHA1 Signature, key ID c105b9de: NOKEY
Retrieving key from file:///etc/pki/rpm-gpg/RPM-GPG-KEY-CentOS-6
Importing GPG key 0xC105B9DE:
Userid : CentOS-6 Key (CentOS 6 Official Signing Key) <[email protected]>
Package: centos-release-6-5.el6.centos.11.1.x86_64 (@anaconda-CentOS-201311272149.x86_64/6.5)
From : /etc/pki/rpm-gpg/RPM-GPG-KEY-CentOS-6
Is this ok [y/N]: y
Running rpm_check_debug
Running Transaction Test
Transaction Test Succeeded
Running Transaction
Installing : 1:telnet-0.17-47.el6_3.1.x86_64 1/1
Verifying : 1:telnet-0.17-47.el6_3.1.x86_64 1/1

Installed:
telnet.x86_64 1:0.17-47.el6_3.1

Complete!
[root@centos06 yum.repos.d]# yum install nmap -y
Loaded plugins: fastestmirror, security
Loading mirror speeds from cached hostfile

  • c6-media:
    Setting up Install Process
    Resolving Dependencies
    --> Running transaction check
    ---> Package nmap.x86_64 2:5.51-3.el6 will be installed
    --> Finished Dependency Resolution

Dependencies Resolved

=============================================================================
Package Arch Version Repository Size

=============================================================================
Installing:
nmap x86_64 2:5.51-3.el6 c6-media 2.7 M

Transaction Summary

=============================================================================
Install 1 Package(s)

Total download size: 2.7 M
Installed size: 9.7 M
Downloading Packages:
Running rpm_check_debug
Running Transaction Test
Transaction Test Succeeded
Running Transaction
Installing : 2:nmap-5.51-3.el6.x86_64 1/1
Verifying : 2:nmap-5.51-3.el6.x86_64 1/1

Installed:
nmap.x86_64 2:5.51-3.el6

Complete!
[root@centos06 yum.repos.d]# rpm -qa | grep telnet
telnet-0.17-47.el6_3.1.x86_64
[root@centos06 yum.repos.d]# rpm -qa | grep nmap
nmap-5.51-3.el6.x86_64

發表評論
所有評論
還沒有人評論,想成為第一個評論的人麼? 請在上方評論欄輸入並且點擊發布.
相關文章