Configure yum to install dependencies automatically

本文解决在 RHEL 6.4 中使用 yum 命令安装 rpm-build 包遇到的问题。默认情况下,系统未注册到 Red Hat Subscription Management,且两个可用的软件源被禁用。通过挂载红帽 DVD/ISO 文件建立本地仓库,并配置新的 repo 文件,最终成功安装 rpm-build 包。

摘要生成于 C知道 ,由 DeepSeek-R1 满血版支持, 前往体验 >

I just install RHEL version 6.4. trying to use yum command to install rpm-build package, but it showing below error messages:

[root@redhat64 ~]# yum install rpm-build
Loaded plugins: product-id, security, subscription-manager
This system is not registered to Red Hat Subscription Management. You can use subscription-manager to register.
Setting up Install Process
No package rpm-build available.
Error: Nothing to do

By default, if you check with “yum repolist all” command, there are 2 repo source with status disabled:

    [root@redhat64 ~]# yum repolist all
    Loaded plugins: product-id, security, subscription-manager
    This system is not registered to Red Hat Subscription Management. You can use subscription-manager to register.
    repo id                              repo name                                                                   status
    rhel-source                          Red Hat Enterprise Linux 6Server - x86_64 - Source                          disabled
    rhel-source-beta                     Red Hat Enterprise Linux 6Server Beta - x86_64 - Source                     disabled
    repolist: 0
    [root@redhat64 ~]#

Check the Redhat repository configuration file, there are two repo name, both are pointed to redhat website:

    [root@redhat64 ~]# cd /etc/yum.repos.d/
    [root@redhat64 yum.repos.d]# ls
    rhel-source.repo
    [root@redhat64 yum.repos.d]# more rhel-source.repo
    [rhel-source]
    name=Red Hat Enterprise Linux $releasever - $basearch - Source
    baseurl=ftp://ftp.redhat.com/pub/redhat/linux/enterprise/$releasever/en/os/SRPMS/
    enabled=0
    gpgcheck=1
    gpgkey=file:///etc/pki/rpm-gpg/RPM-GPG-KEY-redhat-release

    [rhel-source-beta]
    name=Red Hat Enterprise Linux $releasever Beta - $basearch - Source
    baseurl=ftp://ftp.redhat.com/pub/redhat/linux/beta/$releasever/en/os/SRPMS/
    enabled=0
    gpgcheck=1
    gpgkey=file:///etc/pki/rpm-gpg/RPM-GPG-KEY-redhat-beta,file:///etc/pki/rpm-gpg/RPM-GPG-KEY-redhat-release
    [root@redhat64 yum.repos.d]#

We need to register to RHN in order to use those repo source, even you try to enable the repo, by editing the line “enable=0″ to “enable=1″ but it won’t work. The easy way is build a local repository from your current redhat’s DVD / ISO file:

    # mkdir /media
    # mount /dev/cdrom /media

Rename existing repo file “rhel-source.repo” to “rhel-source.repo.backup” or whatever you want.

Create another repo file name, example “dvd.repo”: 

(Note: keep in mind that never use the default repo name, such as "redhat.repo", otherwise the repo file will be emptied automatically once perform "yum repolist")


    # vi dvd.repo
    [dvd-source]
    name=RHEL 6.4 dvd repo
    baseurl=file:///media/Server
    enabled=1
    gpgcheck=0

Check your repo config, Test  and try to install the package:
# yum repolist
# yum install rpm-build

    [root@redhat64 yum.repos.d]# yum repolist
    Loaded plugins: product-id, security, subscription-manager
    This system is not registered to Red Hat Subscription Management. You can use subscription-manager to register.
    repo id                                               repo name                                                    status
    dvd-source                                            RHEL 6.4 dvd repo                                            3,648
    repolist: 3,648
    [root@redhat64 yum.repos.d]# yum install rpm-build
    Loaded plugins: product-id, security, subscription-manager
    This system is not registered to Red Hat Subscription Management. You can use subscription-manager to register.

    dvd-source                                                                                        | 3.9 kB     00:00 ...

    dvd-source/primary_db                                                                             | 3.1 MB     00:00 ...
    Setting up Install Process
    Resolving Dependencies
    --> Running transaction check
    ---> Package rpm-build.x86_64 0:4.8.0-32.el6 will be installed
    --> Finished Dependency Resolution

    Dependencies Resolved

    =========================================================================================================================
     Package                     Arch                     Version                         Repository                    Size
    =========================================================================================================================
    Installing:
     rpm-build                   x86_64                   4.8.0-32.el6                    dvd-source                   126 k

    Transaction Summary
    =========================================================================================================================
    Install       1 Package(s)

    Total download size: 126 k
    Installed size: 315 k
    Is this ok [y/N]: y
    Downloading Packages:
    Running rpm_check_debug
    Running Transaction Test
    Transaction Test Succeeded
    Running Transaction
    Warning: RPMDB altered outside of yum.

      Installing : rpm-build-4.8.0-32.el6.x86_64 [                                                                     ] 1/1
      Installing : rpm-build-4.8.0-32.el6.x86_64 [####                                                                 ] 1/1
      Installing : rpm-build-4.8.0-32.el6.x86_64 [#####                                                                ] 1/1
      Installing : rpm-build-4.8.0-32.el6.x86_64 [######                                                               ] 1/1
      Installing : rpm-build-4.8.0-32.el6.x86_64 [#######                                                              ] 1/1
      Installing : rpm-build-4.8.0-32.el6.x86_64 [########                                                             ] 1/1
      Installing : rpm-build-4.8.0-32.el6.x86_64 [#################                                                    ] 1/1
      Installing : rpm-build-4.8.0-32.el6.x86_64 [#########################                                            ] 1/1
      Installing : rpm-build-4.8.0-32.el6.x86_64 [###############################                                      ] 1/1
      Installing : rpm-build-4.8.0-32.el6.x86_64 [#################################                                    ] 1/1
      Installing : rpm-build-4.8.0-32.el6.x86_64 [###################################                                  ] 1/1
      Installing : rpm-build-4.8.0-32.el6.x86_64 [####################################                                 ] 1/1
      Installing : rpm-build-4.8.0-32.el6.x86_64 [#########################################                            ] 1/1
      Installing : rpm-build-4.8.0-32.el6.x86_64 [##########################################                           ] 1/1
      Installing : rpm-build-4.8.0-32.el6.x86_64 [###########################################                          ] 1/1
      Installing : rpm-build-4.8.0-32.el6.x86_64 [############################################                         ] 1/1
      Installing : rpm-build-4.8.0-32.el6.x86_64 [##############################################                       ] 1/1
      Installing : rpm-build-4.8.0-32.el6.x86_64 [################################################                     ] 1/1
      Installing : rpm-build-4.8.0-32.el6.x86_64 [#################################################                    ] 1/1
      Installing : rpm-build-4.8.0-32.el6.x86_64 [########################################################             ] 1/1
      Installing : rpm-build-4.8.0-32.el6.x86_64 [#########################################################            ] 1/1
      Installing : rpm-build-4.8.0-32.el6.x86_64 [##########################################################           ] 1/1
      Installing : rpm-build-4.8.0-32.el6.x86_64 [################################################################     ] 1/1
      Installing : rpm-build-4.8.0-32.el6.x86_64 [##################################################################   ] 1/1
      Installing : rpm-build-4.8.0-32.el6.x86_64 [###################################################################  ] 1/1
      Installing : rpm-build-4.8.0-32.el6.x86_64 [#################################################################### ] 1/1
      Installing : rpm-build-4.8.0-32.el6.x86_64                                                                         1/1

    dvd-source/productid                                                                              | 1.7 kB     00:00 ...
      Verifying  : rpm-build-4.8.0-32.el6.x86_64                                                                         1/1
    Installed:
      rpm-build.x86_64 0:4.8.0-32.el6                                                                                        
    Complete!
    [root@redhat64 yum.repos.d]# 
deepcar@ubuntu:~/Desktop$ apt-get apt 2.0.10 (arm64) Usage: apt-get [options] command apt-get [options] install|remove pkg1 [pkg2 ...] apt-get [options] source pkg1 [pkg2 ...] apt-get is a command line interface for retrieval of packages and information about them from authenticated sources and for installation, upgrade and removal of packages together with their dependencies. Most used commands: update - Retrieve new lists of packages upgrade - Perform an upgrade install - Install new packages (pkg is libc6 not libc6.deb) reinstall - Reinstall packages (pkg is libc6 not libc6.deb) remove - Remove packages purge - Remove packages and config files autoremove - Remove automatically all unused packages dist-upgrade - Distribution upgrade, see apt-get(8) dselect-upgrade - Follow dselect selections build-dep - Configure build-dependencies for source packages satisfy - Satisfy dependency strings clean - Erase downloaded archive files autoclean - Erase old downloaded archive files check - Verify that there are no broken dependencies source - Download source archives download - Download the binary package into the current directory changelog - Download and display the changelog for the given package See apt-get(8) for more information about the available commands. Configuration options and syntax is detailed in apt.conf(5). Information about how to configure sources can be found in sources.list(5). Package and version choices can be expressed via apt_preferences(5). Security details are available in apt-secure(8). This APT has Super Cow Powers.有什么问题
最新发布
03-09
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值