環境: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!
安裝成功!