搜索

第 3 章 使用方法

download PDF
本章论述了重建和使用 Red Hat Software Collections 3.0 所需的步骤,以及部署使用 Red Hat Software Collections 的应用程序。

3.1. 使用 Red Hat Software Collections

3.1.1. 从 Software Collection 运行可执行文件

要从特定的 Software Collection 运行可执行文件,在 shell 提示符下输入以下命令:
scl enable software_collection... 'command...'
或者,使用以下命令:
scl enable software_collection... -- command...
使用您要使用的 Software Collections 的空格分隔列表替换 software_collection,使用您要运行的命令替换 command。例如,要执行存储在名为 hello.pl 的 Perl 程序以及 perl516 软件集合中的 Perl 解释器,请输入:
~]$ scl enable rh-perl524 'perl hello.pl'
Hello, World!
您可以使用 scl 工具执行任何命令,从而导致它使用所选 Software Collection 的可执行文件运行,并优先选择其对应的 Red Hat Enterprise Linux 系统。有关 Red Hat Software Collections 附带的 Software Collections 的完整列表,请参阅 表 1.1 “Red Hat Software Collections 3.0 组件”

3.1.2. 使用 Software Collection 作为默认值运行 Shell 会话

要启动一个新的 shell 会话,它带有来自所选 Software Collection 的可执行文件,首选使用 Red Hat Enterprise Linux 等效的,在 shell 提示符后输入以下内容:
scl enable software_collection... bash
使用您要使用的 Software Collections 列表替换 software_collection。例如,要启动带有 python27rh-postgresql95 Software Collections 的新 shell 会话,请输入:
~]$ scl enable python27 rh-postgresql95 bash
在当前会话中启用的 Software Collections 列表存储在 $X_SCLS 环境变量中,例如:
~]$ echo $X_SCLS
python27 rh-postgresql95
有关 Red Hat Software Collections 附带的 Software Collections 的完整列表,请参阅 表 1.1 “Red Hat Software Collections 3.0 组件”

3.1.3. 从 Software Collection 中运行系统服务

包括系统服务的软件集合在 /etc/rc.d/init.d/ 目录中安装相应的初始化脚本。要在当前会话中启动该服务,以 root 用户身份在 shell 提示符后输入以下内容:
service software_collection-service_name start
software_collection 替换为 Software Collection 和 service_name 的名称,使用您要启动的服务名称。要将此服务配置为在引导时自动启动,请以 root 用户身份输入以下命令:
chkconfig software_collection-service_name on
例如,要从 rh- postgresql 95 Software Collection 启动 postgresql 服务,并在运行级别 2、3、4 和 5 中启用它,以 root 用户身份:
~]# service rh-postgresql95-postgresql start
Starting rh-postgresql95-postgresql service:                  [  OK  ]
~]# chkconfig rh-postgresql95-postgresql on
有关如何在 Red Hat Enterprise Linux 6 中管理系统服务的更多信息,请参阅 Red Hat Enterprise Linux 6 部署指南。有关 Red Hat Software Collections 附带的 Software Collections 的完整列表,请参阅 表 1.1 “Red Hat Software Collections 3.0 组件”

3.2. 从 Software Collection 访问 man page

每个 Software Collection 都包含描述此组件内容的一般手册页。每个手册页的名称都与组件相同,它位于/opt/rh 目录中。
要阅读 Software Collection 的手册页,请输入以下命令:
scl enable software_collection 'man software_collection'
software_collection 替换为特定的 Red Hat Software Collections 组件。例如,要显示 rh-mariadb101 的手册页,请输入:
~]$ scl enable rh-mariadb101 "man rh-mariadb101"

3.3. 部署使用 Red Hat Software Collections 的应用程序

通常,您可以使用以下两种方法部署依赖于生产中红帽软件集合的组件的应用程序:
  • 手动安装所有必需的 Software Collections 和软件包,然后部署应用程序,或者
  • 为您的应用程序创建一个新的 Software Collection,并将所有必需的 Software Collections 和其他软件包指定为依赖项。
有关如何手动安装独立的 Red Hat Software Collections 组件的详情,请参考 第 2.2 节 “安装 Red Hat Software Collections”。有关如何使用 Red Hat Software Collections 的详情,请参考 第 3.1 节 “使用 Red Hat Software Collections”。有关如何创建自定义 Software Collection 或扩展现有软件集合的详细信息,请参阅 Red Hat Software Collections Packaging Guide

3.4. Red Hat Software Collections 容器镜像

基于红帽软件集合的容器镜像包括应用程序、守护进程和数据库。镜像可以在 Red Hat Enterprise Linux 7 服务器和 Red Hat Enterprise Linux Atomic Host 上运行。有关其用法的详情,请参考 使用 Red Hat Software Collections 3 容器镜像。有关基于 Red Hat Software Collections 版本 2.4 及更早版本的容器镜像的详情,请参阅使用 Red Hat Software Collections 2 容器镜像
Red Hat Software Collections 3.0 提供了以下容器镜像:
  • rhscl/devtoolset-7-toolchain-rhel7
  • rhscl/devtoolset-7-perftools-rhel7
  • rhscl/httpd-24-rhel7
  • rhscl/mariadb-102-rhel7
  • rhscl/mongodb-34-rhel7
  • rhscl/nginx-112-rhel7
  • rhscl/nodejs-8-rhel7
  • rhscl/php-71-rhel7
  • rhscl/postgresql-96-rhel7
  • rhscl/python-36-rhel7
以下容器镜像基于 Red Hat Software Collections 2.4 :
  • rhscl/devtoolset-6-toolchain-rhel7
  • rhscl/devtoolset-6-perftools-rhel7
  • rhscl/nginx-110-rhel7
  • rhscl/nodejs-6-rhel7
  • rhscl/python-27-rhel7
  • rhscl/ruby-24-rhel7
  • rhscl/ror-50-rhel7
  • rhscl/thermostat-16-agent-rhel7 (EOL)
  • rhscl/thermostat-16-storage-rhel7 (EOL)
以下容器镜像基于 Red Hat Software Collections 2.3:
  • rhscl/mysql-57-rhel7
  • rhscl/perl-524-rhel7
  • rhscl/php-70-rhel7
  • rhscl/redis-32-rhel7
  • rhscl/mongodb-32-rhel7
  • rhscl/php-56-rhel7
  • rhscl/python-35-rhel7
  • rhscl/ruby-23-rhel7
以下容器镜像基于 Red Hat Software Collections 2.2:
  • rhscl/devtoolset-4-toolchain-rhel7
  • rhscl/devtoolset-4-perftools-rhel7
  • rhscl/mariadb-101-rhel7
  • rhscl/nginx-18-rhel7
  • rhscl/nodejs-4-rhel7
  • rhscl/postgresql-95-rhel7
  • rhscl/ror-42-rhel7
  • rhscl/thermostat-1-agent-rhel7 (EOL)
  • rhscl/varnish-4-rhel7
以下容器镜像基于 Red Hat Software Collections 2.0:
  • rhscl/mariadb-100-rhel7
  • rhscl/mongodb-26-rhel7
  • rhscl/mysql-56-rhel7
  • rhscl/nginx-16-rhel7 (EOL)
  • rhscl/passenger-40-rhel7
  • rhscl/perl-520-rhel7
  • rhscl/postgresql-94-rhel7
  • rhscl/python-34-rhel7
  • rhscl/ror-41-rhel7
  • rhscl/ruby-22-rhel7
  • rhscl/s2i-base-rhel7
不再支持标记为 Life (EOL)的镜像。
Red Hat logoGithubRedditYoutubeTwitter

学习

尝试、购买和销售

社区

关于红帽文档

通过我们的产品和服务,以及可以信赖的内容,帮助红帽用户创新并实现他们的目标。

让开源更具包容性

红帽致力于替换我们的代码、文档和 Web 属性中存在问题的语言。欲了解更多详情,请参阅红帽博客.

關於紅帽

我们提供强化的解决方案,使企业能够更轻松地跨平台和环境(从核心数据中心到网络边缘)工作。

© 2024 Red Hat, Inc.