环境:Red Hat Enterprise Linux 5(rhel5.2_server-i386-dvd.iso)
虚拟机:Vmware7
YUM已安装
目标:安装gcc
配置:
1、挂载光盘(这里面已经自动挂载了)
/dev/hdc on media/Rhel_5.2 i386 DVD/Server
2、创建链接
[root@localhost]#ln -s /dev/media/Rhel_5.2 i386 DVD/Server /Server
ln这是linux中一个非常重要命令。它的功能是为某一个文件在另外一个位置建立一个同不的链接,这个命令最常用的参数是-s,具体用法是:ln -s 源文件 目标文件。用ls -l命令察看,就可以看到显示的link的路径了
3、修改
yum.repos.d目录下
配置文件
[root@localhost ]# vi /etc/yum.repos.d/rhel-debuginfo.repo
[base]
name=Server
baseurl=file:///Server
enabled=1
gpgcheck=0
测试:
[root@localhost]#yum clean all
// 清除 yum 缓存
[root@localhost]#yum list
// 显示所有可用的 rpm 包
[root@localhost]#yum grouplist
// 显示所有 yum 服务器定义的组
Loading "rhnplugin" plugin
Loading "security" plugin
This system is not registered with RHN.
RHN support will be disabled.
Setting up Group Process
comps-rhel5-server-core.x 100% |=========================| 985 kB 00:00
Installed Groups:
Office/Productivity
System Tools
GNOME Desktop Environment
Network Servers
X Window System
Printing Support
..........
.........
开始安装gcc:
[root@localhost]#yum install gcc
Loading "rhnplugin" plugin
Loading "security" plugin
This system is not registered with RHN.
RHN support will be disabled.
Setting up Install Process
Parsing package install arguments
Resolving Dependencies
--> Running transaction check
......
.....
....
---> Package kernel-headers.i386 0:2.6.18-92.el5 set to be updated
--> Finished Dependency Resolution
Dependencies Resolved
=============================================================================
Package Arch Version Repository Size
=============================================================================
Installing:
gcc i386 4.1.2-42.el5 base 5.2 M
Installing for dependencies:
glibc-devel i386 2.5-24 base 2.0 M
glibc-headers i386 2.5-24 base 610 k
kernel-headers i386 2.6.18-92.el5 base 843 k
libgomp i386 4.1.2-42.el5 base 82 k
Transaction Summary
=============================================================================
Install 5 Package(s)
Update 0 Package(s)
Remove 0 Package(s)
Total download size: 8.7 M
Is this ok [y/N]: y
Downloading Packages:
Running rpm_check_debug
Running Transaction Test
Finished Transaction Test
Transaction Test Succeeded
Running Transaction
Installing: libgomp ######################### [1/5]
Installing: kernel-headers ######################### [2/5]
Installing: glibc-headers ######################### [3/5]
Installing: glibc-devel ######################### [4/5]
Installing: gcc ######################### [5/5]
Installed: gcc.i386 0:4.1.2-42.el5
Dependency Installed: glibc-devel.i386 0:2.5-24 glibc-headers.i386 0:2.5-24 kernel-headers.i386 0:2.6.18-92.el5 libgomp.i386 0:4.1.2-42.el5
Complete!
安装成功!
转载于:https://blog.51cto.com/longsky/685135