最近在rhel4上面安装oracle 9i的时候,发现gcc没有安装,于是手动rpm去安装,报多个包的依赖,无赖啊。安装rhel5的方式,配置了yum资源库,不能使用,才发现rhel4下面没有repodata相关的文件,在rhel5后面,光盘中自带有这些目录与文件,所以我们需要手动去创建相关的文件。
repodate目录下面有以下文件:
- [root@i repodata]# ls -lrt
- total 9564
- -rw-r--r-- 1 root root 951 Dec 22 04:18 repomd.xml
- -rw-r--r-- 1 root root 578572 Dec 22 04:18 primary.xml.gz
- -rw-r--r-- 1 root root 7023387 Dec 22 04:18 other.xml.gz
- -rw-r--r-- 1 root root 2161684 Dec 22 04:18 filelists.xml.gz
手动创建repodate目录,需要用到createrepo这个命令,在rhel4光盘中默认是没有这个包,我们需要手动去下载,这个包我随后会上传上来。
下面是创建的过程。
1,安装createrepo包
- [root@i soft]# ls
- createrepo-0.4.6-1.el4.rf.noarch.rpm
- [root@i soft]# rpm -ivh *.rpm
- warning: createrepo-0.4.6-1.el4.rf.noarch.rpm: V3 DSA signature: NOKEY, key ID 1aa78495
- Preparing... ########################################### [100%]
- 1:createrepo ########################################### [100%]
2,手动mount光盘到目录
- [root@i ~]# mkdir /media/rhel4
- [root@i ~]# mount /dev/cdrom /media/rhel4
- mount: block device /dev/cdrom is write-protected, mounting read-only
3,创建repodate
- [root@i ~]# cd /media
- [root@i media]# createrepo ./
- 1871/1871 - rhel4/SRPMS/comps-4AS-0.20090520.src.rpm .x86_64.rpm6_64.rpmm
- Saving Primary metadata
- Saving file lists metadata
- Saving other metadata
4,配置本地repo文件
- [root@i repodata]# cd /etc/yum.repos.d/
- [root@i yum.repos.d]# ls
- [root@i yum.repos.d]# vi local.repo
- [rhel4.8]
- name=rhel4.9
- baseurl=file:///media/
- enabled=1
- gpgcheck=0
- [root@i yum.repos.d]# yum list
- Setting up repositories
- rhel4.8 100% |=========================| 951 B 00:00
- Reading repository metadata in from local files
- primary.xml.gz 100% |=========================| 565 kB 00:00
- rhel4.8 : ################################################## 1871/1871
- Added 1871 new packages, deleted 0 old in 5.44 seconds
- Installed Packages
- 4Suite.x86_64 1.0-3 installed
- Canna-libs.i386 3.7p3-9.el4 installed
- FreeWnn-libs.i386 1:1.10pl020-6.el4 installed
- GConf2.i386 2.8.1-2.el4 installed
- GConf2.x86_64 2.8.1-2.el4 installed
5,yum的命令
- [root@i yum.repos.d]# yum -help
- usage: yum [options] < update | install | info | remove | list |
- clean | provides | search | check-update | groupinstall |
- groupupdate | grouplist | groupinfo | groupremove |
- makecache | localinstall | erase | upgrade | whatprovides |
- localupdate | resolvedep | shell | deplist >
- options:
- -h, --help show this help message and exit
- -t, --tolerant be tolerant of errors
- -C run entirely from cache, don't update cache
- -c [config file] config file location
- -R [minutes] maximum command wait time
- -d [debug level] debugging output level
- -e [error level] error output level
- -y answer yes for all questions
- --version show Yum version and exit
- --installroot=[path] set install root
- --enablerepo=[repo] enable one or more repositories (wildcards allowed)
- --disablerepo=[repo] disable one or more repositories (wildcards allowed)
- --exclude=[package] exclude package(s) by name or glob
- --obsoletes enable obsoletes processing during updates
- --noplugins disable Yum plugins
yum命令的使用,见man yum
本文转自7343696 51CTO博客,原文链接:http://blog.51cto.com/luoping/1096764,如需转载请自行联系原作者