搜索

此内容没有您所选择的语言版本。

Chapter 3. Usage

download PDF
This chapter describes the necessary steps for rebuilding and using Red Hat Software Collections 2.3, and deploying applications that use Red Hat Software Collections.

3.1. Using Red Hat Software Collections

3.1.1. Running an Executable from a Software Collection

To run an executable from a particular Software Collection, type the following command at a shell prompt:
scl enable software_collection... 'command...'
Or, alternatively, use the following command:
scl enable software_collection... -- command...
Replace software_collection with a space-separated list of Software Collections you want to use and command with the command you want to run. For example, to execute a Perl program stored in a file named hello.pl with the Perl interpreter from the perl516 Software Collection, type:
~]$ scl enable rh-perl524 'perl hello.pl'
Hello, World!
You can execute any command using the scl utility, causing it to be run with the executables from a selected Software Collection in preference to their possible Red Hat Enterprise Linux system equivalents. For a complete list of Software Collections that are distributed with Red Hat Software Collections, see Table 1.1, “Red Hat Software Collections 2.3 Components”.

3.1.2. Running a Shell Session with a Software Collection as Default

To start a new shell session with executables from a selected Software Collection in preference to their Red Hat Enterprise Linux equivalents, type the following at a shell prompt:
scl enable software_collection... bash
Replace software_collection with a space-separated list of Software Collections you want to use. For example, to start a new shell session with the python27 and rh-postgresql95 Software Collections as default, type:
~]$ scl enable python27 rh-postgresql95 bash
The list of Software Collections that are enabled in the current session is stored in the $X_SCLS environment variable, for instance:
~]$ echo $X_SCLS
python27 rh-postgresql95
For a complete list of Software Collections that are distributed with Red Hat Software Collections, see Table 1.1, “Red Hat Software Collections 2.3 Components”.

3.1.3. Running a System Service from a Software Collection

Software Collections that include system services install corresponding init scripts in the /etc/rc.d/init.d/ directory. To start such a service in the current session, type the following at a shell prompt as root:
service software_collection-service_name start
Replace software_collection with the name of the Software Collection and service_name with the name of the service you want to start. To configure this service to start automatically at boot time, type the following command as root:
chkconfig software_collection-service_name on
For example, to start the postgresql service from the rh-postgresql95 Software Collection and enable it in runlevels 2, 3, 4, and 5, type as root:
~]# service rh-postgresql95-postgresql start
Starting rh-postgresql95-postgresql service:                  [  OK  ]
~]# chkconfig rh-postgresql95-postgresql on
For more information on how to manage system services in Red Hat Enterprise Linux 6, refer to the Red Hat Enterprise Linux 6 Deployment Guide. For a complete list of Software Collections that are distributed with Red Hat Software Collections, see Table 1.1, “Red Hat Software Collections 2.3 Components”.

3.2. Accessing a Manual Page from a Software Collection

Every Software Collection contains a general manual page that describes the content of this component. Each manual page has the same name as the component and it is located in the/opt/rh directory.
To read a manual page for a Software Collection, type the following command:
scl enable software_collection 'man software_collection'
Replace software_collection with the particular Red Hat Software Collections component. For example, to display the manual page for rh-mariadb101, type:
~]$ scl enable rh-mariadb101 "man rh-mariadb101"

3.3. Deploying Applications That Use Red Hat Software Collections

In general, you can use one of the following two approaches to deploy an application that depends on a component from Red Hat Software Collections in production:
  • Install all required Software Collections and packages manually and then deploy your application, or
  • Create a new Software Collection for your application and specify all required Software Collections and other packages as dependencies.
For more information on how to manually install individual Red Hat Software Collections components, see Section 2.2, “Installing Red Hat Software Collections”. For further details on how to use Red Hat Software Collections, see Section 3.1, “Using Red Hat Software Collections”. For a detailed explanation of how to create a custom Software Collection or extend an existing one, read the Red Hat Software Collections Packaging Guide.

3.4. Red Hat Software Collections Container Images

Container images based on Red Hat Software Collections have been available since Red Hat Software Collections 2.0. The container images include applications, daemons, and databases. The images can be run on Red Hat Enterprise Linux 7 Server and Red Hat Enterprise Linux Atomic Host. For information about their usage, see the Knowledgebase article at https://access.redhat.com/articles/1752723. For details about images based on the Red Hat Developer Toolset components, refer to the Red Hat Developer Toolset User Guide.
The following container images are new in Red Hat Software Collections 2.3:
  • rhscl/devtoolset-6-toolchain-rhel7
  • rhscl/devtoolset-6-perftools-rhel7
  • rhscl/mysql-57-rhel7
  • rhscl/perl-524-rhel7
  • rhscl/php-70-rhel7
  • rhscl/redis-32-rhel7
  • rhscl/thermostat-16-agent-rhel7
  • rhscl/thermostat-16-storage-rhel7
The following container images have been updated in Red Hat Software Collections 2.3:
  • rhscl/mongodb-32-rhel7
  • rhscl/php-56-rhel7
  • rhscl/python-35-rhel7
  • rhscl/ruby-23-rhel7
The following container images are based on 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
  • rhscl/varnish-4-rhel7
  • rhscl/httpd-24-rhel7
  • rhscl/python-27-rhel7
The following container images are based on Red Hat Software Collections 2.0:
  • rhscl/mariadb-100-rhel7
  • rhscl/mongodb-26-rhel7
  • rhscl/mysql-56-rhel7
  • rhscl/nginx-16-rhel7
  • 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

3.5. Dockerfiles for Red Hat Software Collections

Red Hat Software Collections is shipped with Dockerfiles for the following Software Collections:
  • httpd24
  • mariadb55
  • mongodb24
  • mysql55
  • nginx16
  • nodejs010
  • perl516
  • php54
  • php55
  • postgresql92
  • python27
  • python33
  • rh-mariadb100
  • rh-mongodb26
  • rh-mysql56
  • rh-passenger40
  • rh-perl520
  • rh-php56
  • rh-postgresql94
  • rh-python34
  • rh-ror41
  • rh-ruby22
  • ror40
  • ruby193
  • ruby200
The Dockerfiles are included in the rhscl-dockerfiles package distributed with Red Hat Software Collections. Dockerfiles are text files that define how a Docker image is created. Note that the rhscl-dockerfiles package has not been updated since Red Hat Software Collections 2.0.

Note

The docker package, which contains the Docker daemon, command line tool, and other necessary components for building and using docker-formatted container images, is currently only available for the Server variant of the Red Hat Enterprise Linux 7 product. Red Hat Software Collections Dockerfiles are distributed for Red Hat Enterprise Linux 6 as well, but the images built using them can only be deployed on Red Hat Enterprise Linux 7 Server.
Each Dockerfile creates a minimal Docker image from Red Hat Enterprise Linux 6 or Red Hat Enterprise Linux 7 plus the Software Collection. Each Dockerfile will create an image which:
  • Installs the basic set of packages from each Software Collection,
  • Exposes some TCP ports; for example, port 80 and 443 for the httpd24 collection.
The Dockerfiles are provided as examples, using which customers can build more complex containers.
Dockerfiles are available also for previously released Software Collections. For detailed information about them, refer to the Red Hat Software Collections documentation and the Red Hat Software Collections Product Life Cycle document.

3.5.1. Installation and Usage

To install the rhscl-dockerfiles package, type the following command as root:
yum install rhscl-dockerfiles
Use these Dockerfiles to create Docker images for the covered Software Collections.
For more information about building an image from a Dockerfile, see the Get Started with Docker Formatted Container Images chapter in the Getting Started with Containers documentation.

3.5.2. Deploying Software Collections Dependent on the Red Hat Software Collections Docker Images

You can use a Red Hat Software Collections Docker image as a base image and create your own containerized Software Collection on top of it as a separate image.
For more information about creating a new Docker image, see the Creating Docker Images section in the Getting Started with Containers documentation.
Red Hat logoGithubRedditYoutubeTwitter

学习

尝试、购买和销售

社区

关于红帽文档

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

让开源更具包容性

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

關於紅帽

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

© 2024 Red Hat, Inc.