相信对RedHat Linux或CentOS比较熟悉的人,应该是比较了解yum源的,它比普通的rpm包安装,要方便的多,为何呢?因为它能顺利的解决rpm包之间的依赖关系。你要是根据rpm包之间的依赖关系,一个一个的安装,我也是很佩服的,我实在难以做到,有时安装安装的软件需要几十个rpm包,实在是太烦了啊.......
而用原来的yum源是需要上网的,而且很浪费流量啊。对于我这个用校园的,而且是按流量计费的,下东西对于我是件奢侈的事啊。
现在个大家介绍一种比较好的方法:用光盘里自带的包,来安装我们需要的软件。也就是将光盘里的包做成yum源来用。
首先给大家介绍常用的yum源命令:
1.使用YUM查找软件包
命令:yum search keyword>
2.列出所有可安装的软件包
命令:yum list
3.列出所有可更新的软件包
命令:yum list updates
4.列出所有已安装的软件包
命令:yum list installed
5.列出所有已安装但不在 Yum Repository 內的软件包
命令:yum list extras
6.列出所指定的软件包
命令:yum list package_name>
7.使用YUM获取软件包信息
命令:yum info package_name>
8.列出所有软件包的信息
命令:yum info
9.列出所有可更新的软件包信息
命令:yum info updates
10.列出所有已安裝的软件包信息
命令:yum info installed
11.列出所有已安裝但不在 Yum Repository 內的软件包信息
命令:yum info extras
12.列出软件包提供哪些文件
命令:yum provides package_name>
下面给大家介绍一下本地yum源的配置方法,非常简单:
拷贝系统安装盘Server/目录下的全部软件到/RPMS
[root@localhost Server]# cp * /RPMS
......等的时间可能比较长。软件数目比较多。
安装createrespo创建软件仓库:
[root@localhost RPMS]# cd /RPMS/
[root@localhost RPMS]# rpm -ivh createrepo-0.4.11-3.el5.noarch.rpm
warning: createrepo-0.4.11-3.el5.noarch.rpm: Header V3 DSA signature: NOKEY, key ID 37017186
Preparing... ########################################### [100%]
1:createrepo ########################################### [100%]
[root@localhost RPMS]# cp /mnt/cdrom /RPMS/
[root@localhost RPMS]# createrepo -p /RPMS/
2292/2292 - libXt-1.0.2-3.1.fc6.i386.rpm
Saving Primary metadata
Saving file lists metadata
Saving other metadata
配置rhel-debuginfo.repo
[root@localhost /]# cd /etc/yum.repos.d/
[root@localhost yum.repos.d]# ls
rhel-debuginfo.repo
[root@localhost yum.repos.d]#
[rhel-debuginfo]
name=Red Hat Enterprise Linux $releasever - $basearch - Debug
baseurl=ftp://ftp.redhat.com/pub/redhat/linux/enterprise/$releasever/en/os/$basearch/Debuginfo/
enabled=0
gpgcheck=1
gpgkey=file:///etc/pki/rpm-gpg/RPM-GPG-KEY-redhat-release
[rhel-debuginfo]
name=Red Hat Enterprise Linux $releasever - $basearch - Debug
baseurl=file:///RPMS/
enabled=1
gpgcheck=1
gpgkey=file:///etc/pki/rpm-gpg/RPM-GPG-KEY-redhat-release
更新软件包
[root@localhost RPMS]# yum update
Loaded plugins: rhnplugin, security
This system is not registered with RHN.
RHN support will be disabled.
rhel-debuginfo | 951 B 00:00
rhel-debuginfo/primary | 829 kB 00:00
rhel-debuginfo 2292/2292
Skipping security plugin, no data
Setting up Update Process
No Packages marked for Update
[root@localhost RPMS]#
这样应该就可以了,你可以检验一下[以gcc为例]:
[root@localhost RPMS]# yum install gcc
Loaded plugins: rhnplugin, security
This system is not registered with RHN.
RHN support will be disabled.
Setting up Install Process
Resolving Dependencies
--> Running transaction check
---> Package gcc.i386 0:4.1.2-46.el5 set to be updated
--> Finished Dependency Resolution
Dependencies Resolved
==============================================================================================
Package Arch Version Repository Size
==============================================================================================
Installing:
gcc i386 4.1.2-46.el5 rhel-debuginfo 5.2 M
Transaction Summary
==============================================================================================
Install 1 Package(s)
Update 0 Package(s)
Remove 0 Package(s)
Total download size: 5.2 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 : gcc 1/1
Installed:
gcc.i386 0:4.1.2-46.el5
Complete!
[root@localhost RPMS]#
这样基本上就解决了,RedHat Linux本地yum 源的配置了,不用再为文件之间的依赖关系而烦神了......哈哈。