將ISO文件配置爲本地yum源

一、首先請確保ISO鏡像文件已正確鏈接,在root下輸入「mkdir /mnt/cdrom」並按回車鍵肯定,在/mnt目錄下新建一個名爲cdrom的文件夾。
[root@mytest /]# mkdir /mnt/cdrom
[root@mytest /]#
[root@mytest /]# cd /mnt/cdrom/
[root@mytest cdrom]# ls
[root@mytest cdrom]#
二、查看/dev目錄下ISO文件是否掛載成功
[root@mytest cdrom]# ls /dev
將ISO文件配置爲本地yum源html

三、把ISO目錄掛載到本地/mnt/cdromgh linux

[root@mytest cdrom]# mount -t iso9660 /dev/cdrom /mnt/cdrom/
mount: block device /dev/sr0 is write-protected, mounting read-only

四、查看是否掛載成功:
1、經過ls命令查看ide

[root@mytest cdrom]# ls /mnt/cdrom/      
CentOS_BuildTag  isolinux                  RPM-GPG-KEY-CentOS-Debug-6
EFI              Packages                  RPM-GPG-KEY-CentOS-Security-6
EULA             RELEASE-NOTES-en-US.html  RPM-GPG-KEY-CentOS-Testing-6
GPL              repodata                  TRANS.TBL
images           RPM-GPG-KEY-CentOS-6

2、經過df命令查看
[root@mytest cdrom]# df 測試

Filesystem     1K-blocks    Used Available Use% Mounted on
/dev/sda3       61522964 1972796  56424972   4% /
tmpfs             540092       0    540092   0% /dev/shm
/dev/sda1         198337   34099    153998  19% /boot
/dev/sr0         4363088 4363088         0 100% /mnt/cdrom

五、修改Yum源信息ui

[root@mytest cdrom]#cd /etc/yum.repos.d/
[root@mytest cdrom]#ls
CentOS-Base.repo CentOS-Debuginfo.repo CentOS-Media.repo CentOS-Vault.repothis

修改Yum源配置信息以前作備份:

[root@mytest yum.repos.d]# mv CentOS-Base.repo CentOS-Base.repo.old
[root@mytest yum.repos.d]# mv CentOS-Debuginfo.repo CentOS-Debuginfo.repo.old
[root@mytest yum.repos.d]# mv CentOS-Vault.repo CentOS-Vault.repo.old
[root@mytest yum.repos.d]# ls
CentOS-Base.repo.old CentOS-Debuginfo.repo.old CentOS-Media.repo CentOS-Vault.repo.oldurl

修改成以下的內容:
[c6-media]
name=CentOS-$releasever - Media
baseurl=file:///mnt/cdrom/
gpgcheck=1
enabled=1
gpgkey=file:///etc/pki/rpm-gpg/RPM-GPG-KEY-CentOS-6

完成上述步驟便可完成對ISO添加爲本地yum源的配置
 六、對以前安裝的程序進行清理

[root@mytest yum.repos.d]# yum clean all
Loaded plugins: fastestmirror, security
Cleaning repos: c6-media
Cleaning up Everything
Cleaning up list of fastest mirrors debug

七、測試安裝vsftpd
 [root@mytest yum.repos.d]yum install vsftpd
Loaded plugins: fastestmirror, security
Loading mirror speeds from cached hostfile
Setting up Install Process
Resolving Dependencies
--> Running transaction check
---> Package vsftpd.x86_64 0:2.2.2-11.el6_4.1 will be installed
--> Finished Dependency Resolution

Dependencies Resolved

===================================================================================================
 Package                    Arch                       Version                                 Repo
===================================================================================================
Installing:
 vsftpd                     x86_64                     2.2.2-11.el6_4.1                        c6-m

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

Total download size: 151 k
Installed size: 331 k
Is this ok [y/N]: y
Downloading Packages:
Running rpm_check_debug
Running Transaction Test
Transaction Test Succeeded
Running Transaction
  Installing : vsftpd-2.2.2-11.el6_4.1.x86_64                                                      
  Verifying  : vsftpd-2.2.2-11.el6_4.1.x86_64                                                      

Installed:
  vsftpd.x86_64 0:2.2.2-11.el6_4.1                                                                 

Complete!
安裝完成
[....] 表明這個庫的名字,必須是惟一的,不能夠重複。而且不能有空格。

name= 是這個庫的說明,沒有太大的實際意義,只是一個字段說明。

baseurl= 說明採起什麼方式傳輸,具體路徑在哪裏,可使用的方式有,file://,ftp://,http://等,關於baseurl中的變量,能夠查看yum.conf 的手冊:man yum.conf ,

enabled=1 說明啓用這個更新庫,0表示不啓用。

gpgcheck=1 表示使用gpg文件來檢查軟件包的簽名
相關文章
相關標籤/搜索