第3章 使用法

この章では、Red Hat Software Collections 3.2 を再構築して使用し、Red Hat Software Collections を使用するアプリケーションをデプロイするために必要な手順を説明します。

3.1. Red Hat Software Collections の使用

3.1.1. Software Collection からの実行可能ファイルの実行

特定の Software Collection から実行ファイルを実行するには、シェルプロンプトで以下のコマンドを入力します。
scl enable software_collection... 'command...'
または、以下のコマンドを使用します。
scl enable software_collection... -- command...
software_collection を、使用する Software Collections のスペース区切りのリストに置き換え、command を、実行するコマンドに置き換えます。たとえば、perl526 Software Collection から Perl インタープリターで hello.pl という名前が付けられたファイルに保存されている Perl プログラムを実行するには、以下を入力します。
~]$ scl enable rh-perl526 'perl hello.pl'
Hello, World!
この scl ユーティリティーを使用してコマンドを実行すると、同等の Red Hat Enterprise Linux システムの代わりに、選択した Software Collection から実行可能なものを使用して実行できます。Red Hat Software Collections で配布される Software Collections の完全リストは、表1.1「Red Hat Software Collections 3.2 コンポーネント」を参照してください。

3.1.2. デフォルトで Software Collection を使用したシェルセッションの実行

Red Hat Enterprise Linux の同等のものよりも選択した Software Collection の実行可能ファイルで新しいシェルセッションを開始するには、シェルプロンプトで次のように入力します。
scl enable software_collection... bash
software_collection を、使用する Software Collections のスペース区切りリストに置き換えます。たとえば、デフォルトとして python27 および rh-postgresql10 Software Collections で新しいシェルセッションを開始するには、以下を入力します。
~]$ scl enable python27 rh-postgresql10 bash
現行セッションで有効になっている Software Collections のリストは、$X_SCLS 環境変数に保存されます。以下に例を示します。
~]$ echo $X_SCLS
python27 rh-postgresql10
Red Hat Software Collections で配布される Software Collections の完全リストは、表1.1「Red Hat Software Collections 3.2 コンポーネント」を参照してください。

3.1.3. Software Collection からのシステムサービスの実行

Red Hat Enterprise Linux 6 の Software Collection からシステムサービスの実行

システムサービスを含む Software Collections は、対応する init スクリプトを /etc/rc.d/init.d/ ディレクトリーにインストールします。現行のセッションでそのようなサービスを起動するには、シェルプロンプトで root として以下を入力します。
service software_collection-service_name start
software_collection を、Software Collection および service_name を、開始するサービスの名前に置き換えます。
システムの起動時にこのサービスが自動的に開始するように設定するには、root で以下のコマンドを入力します。
chkconfig software_collection-service_name on
たとえば、rh-postgresql96 Software Collection から postgresql サービスを起動し、ランレベル 2、3、4、および 5 で root で有効にするには、root で次のコマンドを実行します。
~]# service rh-postgresql96-postgresql start
Starting rh-postgresql96-postgresql service:                  [  OK  ]
~]# chkconfig rh-postgresql96-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.2 コンポーネント」を参照してください。

Red Hat Enterprise Linux 7 の Software Collection からシステムサービスの実行

Red Hat Enterprise Linux 7 では、init スクリプトが systemd サービスのユニットファイルに置き換えられました。このファイルは、.service ファイル拡張子で終わり、init スクリプトとして同様の目的で使用されています。現行セッションでサービスを起動するには、root で以下のコマンドを実行します。
systemctl start software_collection-service_name.service
software_collection を、Software Collection および service_name を、開始するサービスの名前に置き換えます。
システムの起動時にこのサービスが自動的に開始するように設定するには、root で以下のコマンドを入力します。
systemctl enable software_collection-service_name.service
たとえば、rh-postgresql10 Software Collection から postgresql サービスを起動し、システムの起動時に有効にするには、root で以下を入力します。
~]# systemctl start rh-postgresql10-postgresql.service
~]# systemctl enable rh-postgresql10-postgresql.service
Red Hat Enterprise Linux 7 でシステムサービスを管理する方法は、Red Hat Enterprise Linux 7 System Administrator's Guide を参照してください。Red Hat Software Collections で配布される Software Collections の完全リストは、表1.1「Red Hat Software Collections 3.2 コンポーネント」を参照してください。

3.2. Software Collection からの手動ページへのアクセス

すべての Software Collection には、このコンポーネントの内容を説明する一般的な man ページが含まれています。各 man ページにはコンポーネントと同じ名前が付いており、/opt/rh ディレクトリーにあります。
Software Collection の man ページを確認するには、以下のコマンドを入力します。
scl enable software_collection 'man software_collection'
software_collection を、特定の Red Hat Software Collections コンポーネントに置き換えます。たとえば、rh-mariadb102 の man ページを表示するには、以下を入力します。
~]$ scl enable rh-mariadb102 "man rh-mariadb102"

3.3. Red Hat Software Collections を使用するアプリケーションのデプロイ

通常、以下の 2 つの方法のいずれかを使用して、実稼働環境の Red Hat Software Collections のコンポーネントに依存するアプリケーションをデプロイすることができます。
  • 必要な Software Collections およびパッケージをすべて手動でインストールしてから、アプリケーションをデプロイする、または
  • アプリケーション用の新しい Software Collection を作成し、必要な Software Collections およびその他のパッケージをすべて依存関係として指定する
個々の Red Hat Software Collections コンポーネントを手動でインストールする方法は、「Red Hat Software Collections のインストール」 を参照してください。Red Hat Software Collections の使用方法に関する詳細は、「Red Hat Software Collections の使用」 を参照してください。カスタム Software Collection を作成する方法や、既存のソフトウェアを拡張する方法については、Red Hat Software Collections Packaging Guideを参照してください。

3.4. Red Hat Software Collections コンテナーイメージ

Red Hat Software Collections に基づくコンテナーイメージには、アプリケーション、デーモン、およびデータベースが含まれます。イメージは、Red Hat Enterprise Linux 7 Server および Red Hat Enterprise Linux Atomic Host で実行できます。使用方法は、Using Red Hat Software Collections 3 Container Imagesを参照してください。Red Hat Software Collections バージョン 2.4 以前の Red Hat Software Collections バージョン 2.4 をベースとしたコンテナーイメージの詳細は、Using Red Hat Software Collections 2 Container Images を参照してください。
以下のコンテナーイメージは Red Hat Software Collections 3.2 で利用可能です。
  • rhscl/devtoolset-8-toolchain-rhel7
  • rhscl/devtoolset-8-perftools-rhel7
  • rhscl/httpd-24-rhel7
  • rhscl/mysql-80-rhel7
  • rhscl/nginx-114-rhel7
  • rhscl/php-72-rhel7
  • rhscl/varnish-6-rhel7
以下のコンテナーイメージは、Red Hat Software Collections 3.1 をベースとしています。
  • rhscl/devtoolset-7-toolchain-rhel7
  • rhscl/devtoolset-7-perftools-rhel7
  • rhscl/mongodb-36-rhel7
  • rhscl/perl-526-rhel7
  • rhscl/php-70-rhel7
  • rhscl/postgresql-10-rhel7
  • rhscl/ruby-25-rhel7
  • rhscl/varnish-5-rhel7
以下のコンテナーイメージは Red Hat Software Collections 3.0 をベースとしています。
  • 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 (EOL)
  • rhscl/devtoolset-6-perftools-rhel7 (EOL)
  • 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/redis-32-rhel7
  • rhscl/mongodb-32-rhel7
  • rhscl/php-56-rhel7 (EOL)
  • rhscl/python-35-rhel7
  • rhscl/ruby-23-rhel7
以下のコンテナーイメージは、Red Hat Software Collections 2.2 に基づいています。
  • rhscl/devtoolset-4-toolchain-rhel7 (EOL)
  • rhscl/devtoolset-4-perftools-rhel7 (EOL)
  • rhscl/mariadb-101-rhel7
  • rhscl/nginx-18-rhel7 (EOL)
  • rhscl/nodejs-4-rhel7 (EOL)
  • rhscl/postgresql-95-rhel7
  • rhscl/ror-42-rhel7
  • rhscl/thermostat-1-agent-rhel7 (EOL)
  • rhscl/varnish-4-rhel7 (EOL)
以下のコンテナーイメージは、Red Hat Software Collections 2.0 に基づいています。
  • rhscl/mariadb-100-rhel7 (EOL)
  • rhscl/mongodb-26-rhel7 (EOL)
  • rhscl/mysql-56-rhel7 (EOL)
  • rhscl/nginx-16-rhel7 (EOL)
  • rhscl/passenger-40-rhel7 (EOL)
  • rhscl/perl-520-rhel7 (EOL)
  • rhscl/postgresql-94-rhel7 (EOL)
  • rhscl/python-34-rhel7 (EOL)
  • rhscl/ror-41-rhel7 (EOL)
  • rhscl/ruby-22-rhel7 (EOL)
  • rhscl/s2i-base-rhel7
EOL(End of Life) と表示されているイメージはサポート対象外となります。