将ISO文件配置为本地yum源

1、首先请确保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]#
2、查看/dev目录下ISO文件是否挂载成功
[root@mytest cdrom]# ls /dev
将ISO文件配置为本地yum源

3、把ISO目录挂载到本地/mnt/cdromgh

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

4、查看是否挂载成功:
一、通过ls命令查看

[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

二、通过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

5、修改Yum源信息

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

修改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.old

修改为如下的内容:
[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源的配置
 6、对之前安装的程序进行清理

[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


7、测试安装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文件来检查软件包的签名

转载于:https://blog.51cto.com/cainiaibage/2051301

  • 0
    点赞
  • 1
    收藏
    觉得还不错? 一键收藏
  • 0
    评论
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值