第 2 章 安装

本章论述了如何访问内容集、在系统中安装 Red Hat Software Collections 3.0 并重新构建 Red Hat Software Collections。

2.1. 访问 Red Hat Software Collections

Red Hat Software Collections 内容集可供使用 Red Hat Enterprise Linux 6 和 Red Hat Enterprise Linux 7 订阅的客户,网址为: https://access.redhat.com/solutions/472793根据您注册了 Red Hat Enterprise Linux 系统的订阅管理服务,您可以使用 Red Hat Subscription Management 启用 Red Hat Software Collections,或使用 RHN Classic 启用。有关如何使用 RHN Classic 或红帽订阅管理启用 Red Hat Software Collections 的详细信息,请查看以下相应部分。有关如何在这些订阅管理服务中注册系统的详情,请参考 使用和配置 Red Hat Subscription Manager
从 Red Hat Software Collections 2.2 开始 https://access.redhat.com/downloads,Red Hat Software Collections 和 Red Hat Developer Toolset 内容也以 ISO 格式提供,特别是用于 服务器Workstation。请注意,需要 Optional 频道的软件包(在 第 2.1.3 节 “Optional 频道中的软件包” 中列出的)无法从 ISO 镜像安装。
注意
需要 Optional 频道的软件包无法从 ISO 镜像安装。第 2.1.3 节 “Optional 频道中的软件包” 中提供了需要启用 Optional 频道的软件包列表。
Beta 内容在 ISO 格式不可用。

2.1.1. 使用 Red Hat Subscription Management

如果您的系统使用 Red Hat Subscription Management 注册,请完成以下步骤附加订阅,该订阅提供对 Red Hat Software Collections 的访问权限并启用存储库:
  1. 显示您的系统所有可用订阅的列表,并确定提供 Red Hat Software Collections 的订阅池 ID。要做到这一点,以 root 用户身份在 shell 提示符后输入以下内容:
    subscription-manager list --available
    对于每个可用订阅,这个命令会显示其名称、唯一标识符、过期日期和其他与它相关的详细信息。池 ID 在以 Pool Id 开头的行上列出。
  2. root 用户身份运行以下命令,为您的系统附加适当的订阅:
    subscription-manager attach --pool=pool_id
    pool_id 替换为您在上一步中确定的池 ID。要验证系统当前附加的订阅列表,以 root 用户身份输入:
    subscription-manager list --consumed
  3. 显示可用的 Yum 列表存储库列表,以检索存储库元数据并确定 Red Hat Software Collections 存储库的确切名称。以 root 用户身份,输入:
    subscription-manager repos --list
    或者,对简短列表运行 yum repolist all
    软件仓库名称取决于您使用的 Red Hat Enterprise Linux 的特定版本,采用以下格式:
    rhel-variant-rhscl-6-rpms
    rhel-variant-rhscl-6-debug-rpms
    rhel-variant-rhscl-6-source-rpms
    
    rhel-server-rhscl-6-eus-rpms
    rhel-server-rhscl-6-eus-source-rpms
    rhel-server-rhscl-6-eus-debug-rpms
    
    rhel-variant-rhscl-7-rpms
    rhel-variant-rhscl-7-debug-rpms
    rhel-variant-rhscl-7-source-rpms
    
    rhel-server-rhscl-7-eus-rpms
    rhel-server-rhscl-7-eus-source-rpms
    rhel-server-rhscl-7-eus-debug-rpms
    使用 Red Hat Enterprise Linux 系统变体(即 serverworkstation )替换 variant。请注意,在客户端或 ComputeNode 变体上都不支持 Red Hat Software Collections。
  4. root 用户身份运行以下命令来启用适当的存储库:
    subscription-manager repos --enable repository
订阅附加到系统后,您可以安装 Red Hat Software Collections,如 第 2.2 节 “安装 Red Hat Software Collections” 所述。有关如何使用红帽订阅管理注册您的系统并将其与订阅相关联的更多信息,请参阅使用和配置 Red Hat Subscription Manager

2.1.2. 使用 RHN Classic

重要
红帽已关闭 RHN UI。我们建议用户过渡到 RHSM,以继续获得其订阅的支持。从 2017 年 10 月 31 日开始,客户将不再能够注册 RHN 托管。自 2018 年 3 月 31 日起,客户将不再接收来自 RHN 托管的更新。
,如果您的系统使用 RHN Classic 注册,请完成以下步骤以订阅 Red Hat Software Collections:
  1. 显示可用于您的所有频道的列表,并确定 Red Hat Software Collections 频道的确切名称。要做到这一点,以 root 用户身份在 shell 提示符后输入以下内容:
    rhn-channel --available-channels
    频道的名称取决于您使用的 Red Hat Enterprise Linux 的特定版本,采用以下格式,其中 变体 是 Red Hat Enterprise Linux 系统变体( 服务器或工作站 ):
    rhel-x86_64-variant-6-rhscl-1
    
    rhel-x86_64-server-6.5.z-rhscl-1
    rhel-x86_64-server-6.6.z-rhscl-1
    
    rhel-x86_64-variant-7-rhscl-1
    
    rhel-x86_64-server-7.1.eus-rhscl-1
    Red Hat Enterprise Linux 7 频道只能通过 Red Hat Satellite 实例访问。
    注意
    Red Hat Software Collections 2.x 与 Red Hat Software Collections 1.x 在同一频道中分发。
  2. root 用户身份运行以下命令,将系统订阅到 Red Hat Software Collections 频道:
    rhn-channel --add --channel=channel_name
    使用您在上一步中确定的名称替换 channel_name
  3. 验证您订阅的频道列表。以 root 用户身份,输入:
    rhn-channel --list
订阅系统后,您可以安装 Red Hat Software Collections,如 第 2.2 节 “安装 Red Hat Software Collections” 所述。有关如何使用 RHN Classic 注册您的系统的详情,请参考 使用和配置 Red Hat Subscription Manager

2.1.3. Optional 频道中的软件包

有些 Red Hat Software Collections 3.0 软件包需要启用 Optional 频道才能完成这些软件包的完整安装。有关如何向这个频道订阅您的系统的详情,请查看 Red Hat Subscription Management 的相关知识库文章 https://access.redhat.com/solutions/392003,或者 https://access.redhat.com/solutions/70019 您的系统使用 RHN Classic 注册。
下表中列出了需要启用 Optional 频道的 Software Collections for Red Hat Enterprise Linux 6 中的软件包。

表 2.1. 在 Red Hat Enterprise Linux 6 中,需要启用 Optional Channel 的软件包

Software Collection 中的软件包Optional 频道中所需的软件包
devtoolset-6-dyninst-testsuiteglibc-static
devtoolset-7-dyninst-testsuiteglibc-static
rh-git29-git-allcvsps
rh-git29-git-cvscvsps
rh-git29-perl-Git-SVNperl-YAML, subversion-perl
rh-mariadb101-boost-devellibicu-devel
rh-mariadb101-boost-exampleslibicu-devel
rh-mariadb101-boost-staticlibicu-devel
rh-mongodb30upg-boost-devellibicu-devel
rh-mongodb30upg-boost-exampleslibicu-devel
rh-mongodb30upg-boost-staticlibicu-devel
rh-mongodb30upg-yaml-cpp-devellibicu-devel
rh-mongodb32-boost-devellibicu-devel
rh-mongodb32-boost-exampleslibicu-devel
rh-mongodb32-boost-staticlibicu-devel
rh-mongodb32-yaml-cpp-devellibicu-devel
rh-mongodb34-boost-devellibicu-devel
rh-mongodb34-boost-exampleslibicu-devel
rh-mongodb34-boost-staticlibicu-devel
rh-mongodb34-yaml-cpp-devellibicu-devel
rh-php56-php-imaplibc-client
rh-php56-php-recoderecode
rh-php70-php-imaplibc-client
rh-php70-php-recoderecode
下表中列出了需要 Red Hat Enterprise Linux 7 中 Optional 频道的 Software Collections 软件包。

表 2.2. 在 Red Hat Enterprise Linux 7 中,需要启用 Optional Channel 的软件包

Software Collection 中的软件包Optional 频道中所需的软件包
devtoolset-7-dyninst-testsuiteglibc-static
devtoolset-7-gcc-plugin-devellibmpc-devel
httpd24-mod_ldapapr-util-ldap
rh-eclipse46ruby-doc
rh-eclipse46-eclipse-dltk-rubyruby-doc
rh-eclipse46-eclipse-dltk-sdkruby-doc
rh-eclipse46-eclipse-dltk-testsruby-doc
rh-git29-git-allcvsps
rh-git29-git-cvscvsps
rh-git29-perl-Git-SVNsubversion-perl
rh-perl520-perl-Pod-Perldocgroff
请注意,不支持 Optional 频道中的软件包。详情请查看 知识库文章。https://access.redhat.com/articles/1150793

2.2. 安装 Red Hat Software Collections

Red Hat Software Collections 作为 RPM 软件包的集合,可以使用 Red Hat Enterprise Linux 中包含的标准软件包管理工具安装、更新和卸载。请注意,需要一个有效的订阅才能在您的系统上安装 Red Hat Software Collections。有关如何将您的系统与适当的订阅关联并可以访问 Red Hat Software Collections 的详细信息,请参阅 第 2.1 节 “访问 Red Hat Software Collections”
使用 Red Hat Software Collections 3.0 需要删除任何早期的预发布版本,包括 Beta 版本。如果您已安装任何版本的 Red Hat Software Collections 3.0,请从您的系统中卸载它并安装新版本,如 第 2.3 节 “卸载 Red Hat Software Collections”第 2.2.1 节 “安装单个 Software Collections” 部分所述。
Red Hat Software Collections 不支持从 Red Hat Enterprise Linux 6 原位升级到 Red Hat Enterprise Linux 7。因此,在升级后,安装的 Software Collections 可能无法正常工作。如果要从 Red Hat Enterprise Linux 6 升级到 Red Hat Enterprise Linux 7,强烈建议删除所有 Red Hat Software Collections 软件包,执行原位升级,更新 Red Hat Software Collections 软件仓库,并再次安装 Software Collections 软件包。建议您在升级前备份所有数据。

2.2.1. 安装单个 Software Collections

要安装 表 1.1 “Red Hat Software Collections 3.0 组件” 中列出的任何 Software Collections,请以 root 用户身份在 shell 提示符后输入以下内容来安装对应的 meta 软件包:
yum install software_collection...
使用您要安装的 Software Collections 列表替换 software_collection。例如,要安装 php54rh-mariadb100,请以 root 用户身份键入:
~]# yum install rh-php56 rh-mariadb100
这会为所选 Software Collection 安装主 meta 软件包,以及一组所需软件包作为其依赖项。有关如何安装其他软件包(如附加模块)的详情,请参考 第 2.2.2 节 “安装可选软件包”

2.2.2. 安装可选软件包

Red Hat Software Collections 的每个组件都带有很多默认未安装的可选软件包。要列出属于特定 Software Collection 但未在您的系统中安装的所有软件包,在 shell 提示符下输入以下内容:
yum list available software_collection-\*
要安装这些可选软件包,以 root 用户身份键入:
yum install package_name...
使用您要安装的软件包列表替换 package_name。例如,要安装 rh-perl520-perl-CPANrh-perl520-perl-Archive-Tar,请输入:
~]# yum install rh-perl524-perl-CPAN rh-perl524-perl-Archive-Tar

2.2.3. 安装调试信息

要为任何 Red Hat Software Collections 软件包安装调试信息,请确保已安装 yum-utils 软件包,并以 root 用户身份运行以下命令:
debuginfo-install package_name
例如,要安装 rh-ruby22-ruby 软件包的调试信息,请输入:
~]# debuginfo-install rh-ruby22-ruby
请注意,为了使用这个命令,您需要使用这些软件包访问存储库。如果您的系统通过红帽订阅管理注册,请启用 rhel-variant-rhscl-6-debug-rpmsrhel-variant-rhscl-7-debug-rpms 存储库,如 第 2.1.1 节 “使用 Red Hat Subscription Management” 所述。如果您的系统使用 RHN Classic 注册,请将系统订阅到 rhel-x86_64-variant-6-rhscl-1-debuginforhel-x86_64-variant-7-rhscl-1-debuginfo 频道,如 第 2.1.2 节 “使用 RHN Classic” 所述。有关如何访问 debuginfo 软件包的更多信息,请参阅 https://access.redhat.com/solutions/9907

2.3. 卸载 Red Hat Software Collections

要卸载任何 Software Collections 组件,以 root 用户身份在 shell 提示符后输入以下内容:
yum remove software_collection\*
使用您要卸载的 Software Collection 组件替换 software_collection
请注意,卸载 Red Hat Software Collections 提供的软件包不会影响这些工具的 Red Hat Enterprise Linux 系统版本。

2.4. 重建 Red Hat Software Collections

<collection>-build 软件包默认不提供。如果要重建集合,且不想使用 rpmbuild --define 'scl foo' 命令,您首先需要重新构建 metapackage,它提供 < collection>-build 软件包。
请注意,现有集合不应使用不同的内容重建。要将新软件包添加到现有集合中,您需要创建一个包含新软件包的新集合,并使其依赖于原始集合中的软件包。必须在不更改的情况下使用原始集合。
有关构建软件集合的详细信息,请参阅 Red Hat Software Collections 打包指南