This chapter describes the necessary steps for rebuilding and using Red Hat Software Collections 1.2 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 perl516 'perl hello.pl'
You can execute any command using the
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 1.2 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 postgresql92 Software Collections as default, type:
scl enable python27 postgresql92 bash
The list of Software Collections that are enabled in the current session is stored in the
$X_SCLS environment variable, for instance:
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
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
chkconfig software_collection-service_name on
For example, to start the
postgresql service from the postgresql92 Software Collection and enable it in runlevels 2, 3, 4, and 5, type as
service postgresql92-postgresql start
Starting postgresql92-postgresql service: [ OK ]
chkconfig postgresql92-postgresql on
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
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 mariadb55, type:
scl enable mariadb55 "man mariadb55"
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.
3.4. Dockerfiles for Red Hat Software Collections
Red Hat Software Collections 1.2 is shipped with Dockerfiles for the following Software Collections:
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.
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.
3.4.1. Installation and usage
To install the rhscl-dockerfiles package, type the following command as
yum install rhscl-dockerfiles
Use these Dockerfiles to create Docker images for the covered Software Collections.
Usage of Dockerfiles is described in the Using Dockerfiles
section in the Red Hat Enterprise Linux 7 Resource Management and Linux Containers Guide
3.4.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.