Chinaunix首页 | 论坛 | 博客
  • 博客访问: 271725
  • 博文数量: 101
  • 博客积分: 4245
  • 博客等级: 上校
  • 技术积分: 1085
  • 用 户 组: 普通用户
  • 注册时间: 2009-04-24 00:28
文章分类

全部博文(101)

文章存档

2012年(1)

2011年(16)

2010年(34)

2009年(50)

我的朋友

分类: LINUX

2010-07-04 20:54:42

问题提出:现有的RHEL5.0系统没有安装gcc,以至于无法进行c程序编程,所以准备安装gcc包
思路:为了避免安装过程中出现软件包的依赖性问题,准备把安装盘当做源,以后随时可以用yum命令进行安装
方法和步骤:
1.把张安装盘的内容copy到本地机器某个目录:
(1)mount /dev/hdc /mnt/cdrom
(2)\cp -prf /mnt/cdrom/Server /mnt/dvd/RPMS

以上重复5次,也就是把所有光盘里面的所有内容copy到 /mnt/dvd/RPMS

2. 删除无用的文件
find /mnt/dvd/RPMS -name TRANS.TBL -exec rm -f {} \;

3. cd /mnt/dvd
准备运行createrepo -d .    结果发现没有createrepo安装,于是安装 

[root@localhost dvd]# createrepo -d .
-bash: createrepo: command not found
[root@localhost dvd]# wget
--03:42:18-- 

[root@localhost dvd]# rpm -ivh createrepo-0.4.10-1.el5.rf.noarch.rpm
warning: createrepo-0.4.10-1.el5.rf.noarch.rpm: Header V3 DSA signature: NOKEY, key ID 6b8d79e6
Preparing...                ########################################### [100%]
   1:createrepo             ########################################### [100%]

[root@localhost dvd]# createrepo -d .
2114/2114 - RPMS/Server/xmlsec1-1.2.9-8.1.i386.rpm                              6.rpmi386.rpm
Saving Primary metadata
Saving file lists metadata
Saving other metadata

[root@localhost dvd]# ll repodata/
total 16804
-rw-r--r-- 1 root root 2181026 Jul  4 03:49 filelists.sqlite.bz2
-rw-r--r-- 1 root root 2280288 Jul  4 03:48 filelists.xml.gz
-rw-r--r-- 1 root root 5361999 Jul  4 03:48 other.sqlite.bz2
-rw-r--r-- 1 root root 5561617 Jul  4 03:48 other.xml.gz
-rw-r--r-- 1 root root  991631 Jul  4 03:49 primary.sqlite.bz2
-rw-r--r-- 1 root root  744473 Jul  4 03:48 primary.xml.gz
-rw-r--r-- 1 root root    1950 Jul  4 03:49 repomd.xml
[root@localhost dvd]#
编辑 yum 源配置文,添加个本地 yum 源。注意应目录,这次 /mnt/dvd,因 repodata 此路径创建。
[root@localhost dvd]# cat > /etc/yum.repos.d/dvd.repo <> [dvd]
> name=install dvd
> baseurl=file:///mnt/dvd
> enable=1
> gpgcheck=0
> END

[root@localhost dvd]# yum install gcc
Loading "rhnplugin" plugin
Loading "installonlyn" plugin
This system is not registered with RHN.
RHN support will be disabled.
Setting up Install Process
Setting up repositories
Reading repository metadata in from local files
Parsing package install arguments
Resolving Dependencies
--> Populating transaction set with selected packages. Please wait.
---> Downloading header for gcc to pack into transaction set.
gcc-4.1.1-52.el5.i386.rpm 100% |=========================|  59 kB    00:00
---> Package gcc.i386 0:4.1.1-52.el5 set to be updated
--> Running transaction check
--> Processing Dependency: libgomp.so.1 for package: gcc
--> Processing Dependency: glibc-devel >= 2.2.90-12 for package: gcc
--> Processing Dependency: libgomp = 4.1.1-52.el5 for package: gcc
--> Restarting Dependency Resolution with new changes.
--> Populating transaction set with selected packages. Please wait.
---> Downloading header for glibc-devel to pack into transaction set.
glibc-devel-2.5-12.i386.r 100% |=========================| 105 kB    00:00
---> Package glibc-devel.i386 0:2.5-12 set to be updated
---> Downloading header for libgomp to pack into transaction set.
libgomp-4.1.1-52.el5.i386 100% |=========================|  49 kB    00:00
---> Package libgomp.i386 0:4.1.1-52.el5 set to be updated
--> Running transaction check
--> Processing Dependency: glibc-headers for package: glibc-devel
--> Processing Dependency: glibc-headers = 2.5-12 for package: glibc-devel
--> Restarting Dependency Resolution with new changes.
--> Populating transaction set with selected packages. Please wait.
---> Downloading header for glibc-headers to pack into transaction set.
glibc-headers-2.5-12.i386 100% |=========================| 138 kB    00:00
---> Package glibc-headers.i386 0:2.5-12 set to be updated
--> Running transaction check

Dependencies Resolved

=============================================================================
 Package                 Arch       Version          Repository        Size
=============================================================================
Installing:
 gcc                     i386       4.1.1-52.el5     dvd               4.9 M
Installing for dependencies:
 glibc-devel             i386       2.5-12           dvd               2.0 M
 glibc-headers           i386       2.5-12           dvd               605 k
 libgomp                 i386       4.1.1-52.el5     dvd                69 k

Transaction Summary
=============================================================================
Install      4 Package(s)
Update       0 Package(s)
Remove       0 Package(s)

Total download size: 7.6 M
Is this ok [y/N]: y
Downloading Packages:
Running Transaction Test
warning: gcc-4.1.1-52.el5: Header V3 DSA signature: NOKEY, key ID 37017186
Finished Transaction Test
Transaction Test Succeeded
Running Transaction
  Installing: libgomp                      ######################### [1/4]
  Installing: glibc-headers                ######################### [2/4]
  Installing: glibc-devel                  ######################### [3/4]
  Installing: gcc                          ######################### [4/4]

Installed: gcc.i386 0:4.1.1-52.el5
Dependency Installed: glibc-devel.i386 0:2.5-12 glibc-headers.i386 0:2.5-12 libgomp.i386 0:4.1.1-52.el5
Complete!
[root@localhost dvd]#





阅读(3328) | 评论(0) | 转发(0) |
给主人留下些什么吧!~~