中央の場所に必要なファイル群を配備し、各クライアントでシンプルでスクリプト化が可能なコマンドを実行することで検索やインストールができるというのが共通して目的としているところです。 本章では企業や組織内のいずれのシステムからでも呼び出すことができるスクリプトの作成について見ていくことにします。
# First, install the latest client RPMs to the system.
rpm -Uvh \
http://proxy-or-sat.example.com.com/pub/rhn_register-2.8.27-1.7.3.i386.rpm \
http://proxy-or-sat.example.com.com/pub/rhn_register-gnome-2.8.27-1.7.3.i386.rpm \
http://proxy-or-sat.example.com.com/pub/up2date-3.0.7-1.i386.rpm \
http://proxy-or-sat.example.com.com/pub/up2date-gnome-3.0.7-1.i386.rpm
# Second, reconfigure the clients to talk to the correct server.
perl -p -i -e 's/s/www\.rhns\.redhat\.com/proxy-or-sat\.example\.com/g' \
/etc/sysconfig/rhn/rhn_register \
/etc/sysconfig/rhn/up2date
# Third, install the SSL client certificate for your company's
# RHN Satellite Server or RHN Proxy Server.
rpm -Uvh http://proxy-or-sat.example.com/pub/rhn-org-trusted-ssl-cert-*.noarch.rpm
# Fourth, reconfigure the clients to use the new SSL certificate.
perl -p -i -e 's/^sslCA/#sslCA/g;' \
/etc/sysconfig/rhn/up2date /etc/sysconfig/rhn/rhn_register
echo "sslCACert=/usr/share/rhn/RHN-ORG-TRUSTED-SSL-CERT" \
>> /etc/sysconfig/rhn/up2date
echo "sslCACert=/usr/share/rhn/RHN-ORG-TRUSTED-SSL-CERT" \
>> /etc/sysconfig/rhn/rhn_register
# Fifth, download the GPG key needed to validate custom packages.
wget -O - -q http://proxy-or-sat.example.com.com/pub/YOUR-RPM-GPG-KEY
# Sixth, import that GPG key to your GPG keyring.
rpm --import /path/to/YOUR-RPM-GPG-KEY
# First, install the latest client RPMs to the system.
rpm -Uvh \
http://proxy-or-sat.example.com.com/pub/rhn_register-2.8.27-1.7.3.i386.rpm \
http://proxy-or-sat.example.com.com/pub/rhn_register-gnome-2.8.27-1.7.3.i386.rpm \
http://proxy-or-sat.example.com.com/pub/up2date-3.0.7-1.i386.rpm \
http://proxy-or-sat.example.com.com/pub/up2date-gnome-3.0.7-1.i386.rpm
# Second, reconfigure the clients to talk to the correct server.
perl -p -i -e 's/s/www\.rhns\.redhat\.com/proxy-or-sat\.example\.com/g' \
/etc/sysconfig/rhn/rhn_register \
/etc/sysconfig/rhn/up2date
# Third, install the SSL client certificate for your company's
# RHN Satellite Server or RHN Proxy Server.
rpm -Uvh http://proxy-or-sat.example.com/pub/rhn-org-trusted-ssl-cert-*.noarch.rpm
# Fourth, reconfigure the clients to use the new SSL certificate.
perl -p -i -e 's/^sslCA/#sslCA/g;' \
/etc/sysconfig/rhn/up2date /etc/sysconfig/rhn/rhn_register
echo "sslCACert=/usr/share/rhn/RHN-ORG-TRUSTED-SSL-CERT" \
>> /etc/sysconfig/rhn/up2date
echo "sslCACert=/usr/share/rhn/RHN-ORG-TRUSTED-SSL-CERT" \
>> /etc/sysconfig/rhn/rhn_register
# Fifth, download the GPG key needed to validate custom packages.
wget -O - -q http://proxy-or-sat.example.com.com/pub/YOUR-RPM-GPG-KEY
# Sixth, import that GPG key to your GPG keyring.
rpm --import /path/to/YOUR-RPM-GPG-KEY
Copy to Clipboard
Copied!
Toggle word wrap
Toggle overflow
このスクリプトは簡潔で反復可能なプロセスで構成されており、 Red Hat Network クライアントを設定して RHN Proxy Server や RHN Satellite Server への登録の準備を完了させることができるはずです。 RHN サーバーの URL、 そのパブリックディレクトリ、 実際の GPG キーなどの重要となる値はスクリプト内にあるプレースホルダーに入力する必要があります。 また、 使用環境に応じて追加の修正が必要となる場合があります。 本スクリプトはほとんどこのままでも機能しますが参考として使用するようにしてください。
wget -O - http://proxy-or-sat.example.com.com/pub/bootstrap_script | bash
wget -O - http://proxy-or-sat.example.com.com/pub/bootstrap_script | bash
Copy to Clipboard
Copied!
Toggle word wrap
Toggle overflow
この一行のコマンドはネットワーク上の全システムに呼び出すことができます。 管理者が対象となる全システムに SSH アクセスができる場合は、システム一覧に対して繰り返し全システムで遠隔的にコマンドを実行する簡単な作業となるでしょう。また、 既存のキックスタートスクリプトの %post セクションも追加することもできます。