当前位置: 移动技术网 > 科技>操作系统>Linux > Redhat linux本地yum源的配置教程

Redhat linux本地yum源的配置教程

2019年03月19日  | 移动技术网科技  | 我要评论

相信对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 源的配置了,不用再为文件之间的依赖关系而烦神了......哈哈。

如对本文有疑问, 点击进行留言回复!!

相关文章:

验证码:
移动技术网