温馨提示×

温馨提示×

您好,登录后才能下订单哦!

密码登录×
登录注册×
其他方式登录
点击 登录注册 即表示同意《亿速云用户服务条款》

Redhat linux如何配置本地yum源

发布时间:2021-10-15 09:36:16 来源:亿速云 阅读:145 作者:小新 栏目:系统运维

这篇文章给大家分享的是有关Redhat linux如何配置本地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源”这篇文章就分享到这里了,希望以上内容可以对大家有一定的帮助,让大家可以学到更多知识,如果觉得文章不错,可以把它分享出去让更多的人看到吧!

向AI问一下细节

免责声明:本站发布的内容(图片、视频和文字)以原创、转载和分享为主,文章观点不代表本网站立场,如果涉及侵权请联系站长邮箱:is@yisu.com进行举报,并提供相关证据,一经查实,将立刻删除涉嫌侵权内容。

AI