yum执行iso包安装步骤

本文介绍了如何在CentOS的虚拟机中通过yum命令利用ISO文件安装gdb。首先,设置虚拟机的光盘文件位置,接着备份并修改repo文件,然后进行挂载操作,最后卸载以完成安装过程。

摘要生成于 C知道 ,由 DeepSeek-R1 满血版支持, 前往体验 >

由于自动虚拟机安装CentOS,发现gdb没有安装,查找了一些资料,实践了一下通过yum来执行iso包来安装gdb,步骤如下:

  • 通过VM直接设置光盘文件位置
  • 备份修改repo文件

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

[root@localhost yum.repos.d]# more CentOS-Media.repo
# CentOS-Media.repo
#
#  This repo can be used with mounted DVD media, verify the mount point for
#  CentOS-6.  You can use this repo and yum to install items directly off the
#  DVD ISO that we release.
#
# To use this repo, put in your DVD and use it with the other repos too:
#  yum --enablerepo=c6-media [command]
#
# or for ONLY the media repo, do this:
#
#  yum --disablerepo=\* --enablerepo=c6-media [command]

[c6-media]
name=CentOS-$releasever - Media
baseurl=file:///media/CentOS/
        file:///media/cdrom/
        file:///media/cdrecorder/
gpgcheck=1
enabled=0
gpgkey=file:///etc/pki/rpm-gpg/RPM-GPG-KEY-CentOS-6
[root@localhost yum.repos.d]# mkdir bak
[root@localhost yum.repos.d]# ls
bak               CentOS-Debuginfo.repo  CentOS-Vault.repo
CentOS-Base.repo  CentOS-Media.repo
[root@localhost yum.repos.d]# mv *.repo /etc/yum.repos.d/bak/
[root@localhost yum.repos.d]# ls
bak

[root@localhost yum.repos.d]# cp /etc/yum.repos.d/bak/CentOS-Media.repo /etc/yum.repos.d/
[root@localhost yum.repos.d]# ls
bak  CentOS-Media.repo
[root@localhost yum.repos.d]# vi CentOS-Media.repo

  • 修改文件如下

[root@localhost yum.repos.d]# cat CentOS-Media.repo
# CentOS-Media.repo
#
#  This repo can be used with mounted DVD media, verify the mount point for
#  CentOS-6.  You can use this repo and yum to install items directly off the
#  DVD ISO that we release.
#
# To use this repo, put in your DVD and use it with the other repos too:
#  yum --enablerepo=c6-media [command]
#
# or for ONLY the media repo, do this:
#
#  yum --disablerepo=\* --enablerepo=c6-media [command]

[c6-media]
name=CentOS-$releasever - Media
baseurl= file:///mnt/cdrom/
gpgcheck=1
enabled=1
  • 挂载
[root@localhost mnt]# mkdir cdrom
[root@localhost mnt]# ls
cdrom
[root@localhost mnt]# mount -t auto -o ro /dev/cdrom /mnt/cdrom
[root@localhost mnt]# ls -l /mnt/cdrom/
total 538
-r--r--r--. 2 root root     14 Mar  4  2013 CentOS_BuildTag
-r--r--r--. 2 root root    212 Mar  1  2013 EULA
-r--r--r--. 2 root root  18009 Mar  1  2013 GPL
dr-xr-xr-x. 3 root root   2048 Mar  4  2013 images
dr-xr-xr-x. 2 root root   2048 Mar  4  2013 isolinux
dr-xr-xr-x. 2 root root 509952 Mar  5  2013 Packages
-r--r--r--. 2 root root   1354 Mar  1  2013 RELEASE-NOTES-en-US.html
dr-xr-xr-x. 2 root root   4096 Mar  5  2013 repodata
-r--r--r--. 2 root root   1706 Mar  1  2013 RPM-GPG-KEY-CentOS-6
-r--r--r--. 2 root root   1730 Mar  1  2013 RPM-GPG-KEY-CentOS-Debug-6
-r--r--r--. 2 root root   1730 Mar  1  2013 RPM-GPG-KEY-CentOS-Security-6
-r--r--r--. 2 root root   1734 Mar  1  2013 RPM-GPG-KEY-CentOS-Testing-6
-r--r--r--. 1 root root   3165 Mar  5  2013 TRANS.TBL
[root@localhost mnt]# yum clean all
Loaded plugins: fastestmirror, refresh-packagekit, security
Cleaning repos: c6-media
Cleaning up Everything
[root@localhost mnt]# yum install gdb
Loaded plugins: fastestmirror, refresh-packagekit, security
Determining fastest mirrors
c6-media                                                 | 4.0 kB     00:00 ...
c6-media/primary_db                                      | 3.5 MB     00:00 ...
Setting up Install Process
Resolving Dependencies
--> Running transaction check
---> Package gdb.i686 0:7.2-60.el6 will be installed
--> Finished Dependency Resolution

Dependencies Resolved

================================================================================
 Package        Arch            Version               Repository           Size
================================================================================
Installing:
 gdb            i686            7.2-60.el6            c6-media            2.3 M

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

Total download size: 2.3 M
Installed size: 5.1 M
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) <centos-6-key@centos.org>
 Package: centos-release-6-4.el6.centos.10.i686 (@anaconda-CentOS-201303020136.i386/6.4)
 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 : gdb-7.2-60.el6.i686                                          1/1
  Verifying  : gdb-7.2-60.el6.i686                                          1/1

Installed:
  gdb.i686 0:7.2-60.el6

Complete!
[root@localhost mnt]# gdb -v
GNU gdb (GDB) Red Hat Enterprise Linux (7.2-60.el6)
Copyright (C) 2010 Free Software Foundation, Inc.
License GPLv3+: GNU GPL version 3 or later <http://gnu.org/licenses/gpl.html>
This is free software: you are free to change and redistribute it.
There is NO WARRANTY, to the extent permitted by law.  Type "show copying"
and "show warranty" for details.
This GDB was configured as "i686-redhat-linux-gnu".
For bug reporting instructions, please see:
<http://www.gnu.org/software/gdb/bugs/>.
  • 卸载
[root@localhost mnt]# umount -v cdrom/
/dev/sr0 umounted




评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

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

抵扣说明:

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

余额充值