Spacewalkを使う
以前にこんな記事を読み、Spacewalkなるものがある事を知りました
前から使ってみようと思いながら着手できていなかったのですが、
ひとまずインストールするところまで進められたので、
まとめておこうと思います。
Spacewalkって?
Linuxシステムの統合管理ツールですね。
RedHat社が出している「Red Hat Network Satellite」のオープンソース版になるようです。
この辺りを読むと良いです。
-
- What is Spacewalk?
- What's the difference between Satellite and Spacewalk?
セットアップ方針
こんな感じで進めます。基本は公開ドキュメントに即していきます。
-
- 今回はパッケージインストール
- データベースバックエンドはPostgreSQLを使う
- 使用するディストリビューションはCentOS5.5
- Web/AP/DBは分離せず、同じホストに同居させる
インストール
リポジトリの設定
yum用のリポジトリを設定します。
元々バックエンドのデータベースはOracleを使う事が想定されており、
最近PostgreSQLにも対応しようとしているようです。
PostgreSQLを使おうとする場合、まだ実験段階のようなので、「Nightly builds」を指定する必要があります。
(実際Nightly Builds をリポジトリとして指定しておかないとうまく行かず、依存関係でエラーとなりました)
# rpm -Uvh http://spacewalk.redhat.com/yum/1.1/RHEL/5/i386/spacewalk-repo-1.1-3.el5.noarch.rpm # cat >> /etc/yum.repos.d/spacewalk.repo << 'EOF' [spacewalk] name=Spacewalk # RHEL5 / CentOS5 baseurl=http://koji.spacewalkproject.org/spacewalk/split/spacewalk-5E/server/spacewalk-5E-nightly/$basearch/os/ gpgkey=http://spacewalk.redhat.com/yum/RPM-GPG-KEY-spacewalk-2010 enabled=1 gpgcheck=0 EOF # rpm -Uvh http://download.fedora.redhat.com/pub/epel/5/i386/epel-release-5-4.noarch.rpm # rpm -Uvh http://spacewalk.redhat.com/yum/1.1/RHEL/5/i386/spacewalk-client-repo-1.1-3.el5.noarch.rpm Import Redhat's RPM GPG key: # wget -O /etc/pki/rpm-gpg/RPM-GPG-KEY-redhat-release http://www.redhat.com/security/37017186.txt # rpm --import /etc/pki/rpm-gpg/RPM-GPG-KEY-redhat-release
PostgreSQL環境の用意
PostgreSQL8.4以上を指定してyumでインストールします。
# yum install -y 'postgresql-server > 8.4'
インストールが終わったらPostgreSQLを有効にします。
# chkconfig postgresql on # service postgresql initdb # service postgresql start
DBユーザーを作成します。マニュアルに習い、
DB名:spaceschema
DBユーザー: spaceuser
で作成します。
# su - postgres -c 'PGPASSWORD=[your password]; createdb spaceschema; createlang plpgsql spaceschema; yes $PGPASSWORD | createuser -P -sDR spaceuser'
「pg_hba.conf」を修正します。
以下の記載にします。
※今回はWeb/AP/DBのホストが同じなので、この設定
# vi /var/lib/pgsql/data/pg_hba.conf local spaceschema spaceuser md5 host spaceschema spaceuser 127.0.0.1/8 md5 host spaceschema spaceuser ::1/128 md5
設定を変えたので、再起動します。
# service postgresql reload
ログインテストをします。マニュアルでは以下のような例が示されていました。
プロンプトが変わればOK。\qで抜けましょう。
PGPASSWORD=[your password] psql -a -U spaceuser spaceschema PGPASSWORD=[your password] psql -h localhost -a -U spaceuser spaceschema
Spacewalkの初期設定
「spacewalk-setup --disconnected」コマンドを発行後、対話型で設定していきます。
こんな感じです。一通り入力すればインストールは完了なはず。
# spacewalk-setup --disconnected ** Database: Setting up database connection for PostgreSQL backend. hostname (leave empty for local)? [your host] Port [5432]? 5432 Database? spaceschema Username? spaceuser Password? ** Database: Populating database. *** Progress: #### * Setting up users and groups. ** GPG: Initializing GPG and importing key. ** GPG: Creating /root/.gnupg directory You must enter an email address. Admin Email Address? [your address] Performing initial configuration. * Activating Spacewalk. ** Loading Spacewalk Certificate. ** Verifying certificate locally. ** Activating Spacewalk. * Enabling Monitoring. * Configuring apache SSL virtual host. Should setup configure apache's default ssl server for you (saves original ssl.conf) [Y]? Y ** /etc/httpd/conf.d/ssl.conf has been backed up to ssl.conf-swsave * Configuring tomcat. ** /etc/tomcat5/tomcat5.conf has been backed up to tomcat5.conf-swsave ** /etc/tomcat5/server.xml has been backed up to server.xml-swsave ** /etc/tomcat5/web.xml has been backed up to web.xml-swsave * Configuring jabberd. * Creating SSL certificates. CA certificate password? [your password] Re-enter CA certificate password? [your password] Organization? [your organization] Organization Unit [your host]? [your host] Email Address [your address]? [your address] City? [your city] State? [your state] Country code (Examples: "US", "JP", "IN", or type "?" to see a list)? [your contry code] ** SSL: Generating CA certificate. ** SSL: Deploying CA certificate. ** SSL: Generating server certificate. ** SSL: Storing SSL certificates. * Deploying configuration files. * Update configuration in database. * Setting up Cobbler.. Cobbler requires tftp and xinetd services be turned on for PXE provisioning functionality. Enable these services [Y/n]?Y cobblerd does not appear to be running/accessible * Restarting services. Installation complete.
Spacewalkの起動とログイン
起動は以下のコマンドを実行すればOKです。
# /usr/sbin/rhn-satellite start
ブラウザでセットアップしたホストにアクセスすると、
初期ユーザーの登録画面が表示されるので、任意のユーザーを登録します。
ログインするとこんな画面が表示されます。
参考
- Spacewalk: Free & Open Source Linux Systems Management
- HowToInstall - spacewalk
- PostgreSQL - spacewalk
- PostgreSQLServerSetup - spacewalk
面白そうなので、色々使ってみようと思っています。
今日はこんな所で。