Spacewalkを使う(Oracle XE編)
以前にこんな感じでPostgreSQLをDBにSpacewalkを入れてみたのですが、中々思うように動かせませんでした。
ということで、一旦安定していると思われるOracle XEを使った環境で再度挑戦することに。
その時の手順をまとめておこうと思います。
セットアップ方針
前回と方針はほとんど同じです。
こんな感じで進めます。基本は公開ドキュメントに即していきます。
-
- 今回はパッケージインストール
- データベースバックエンドはOracle XEを使う
- 使用するディストリビューションはCentOS5.5
- Web/AP/DBは分離せず、同じホストに同居させる
インストール
リポジトリの設定
# rpm -Uvh http://spacewalk.redhat.com/yum/1.2/RHEL/5/i386/spacewalk-repo-1.2-0.el5.noarch.rpm # rpm -Uvh http://download.fedora.redhat.com/pub/epel/5/i386/epel-release-5-4.noarch.rpm # rpm -ivh http://spacewalk.redhat.com/yum/1.2/RHEL/5/i386/spacewalk-client-repo-1.2-0.el5.noarch.rpm # 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
Oracle XE環境の用意
ここから
「oracle-xe-univ-10.2.0.1-1.0.i386.rpm」
「oracle-instantclient-basic-10.2.0.4-1.i386.rpm」
「oracle-instantclient-sqlplus-10.2.0.4-1.i386.rpm」
をダウンロードしてきます。
なお、ダウンロードするには会員登録が必要です。
Oracle用に専用ユーザー及びグループを作成しておきます。
# groupadd -r dba # useradd -r -M -g dba -d /usr/lib/oracle/xe -s /bin/bash oracle
サーバーにRPMパッケージを配置して、インストールします。
今回は「/usr/local/src」に配置したものとします。
# yum -y install bc libc.so.6 libaio.so.1 # yum -y localinstall --nogpgcheck /usr/local/src/oracle-xe-univ-10.2.0.1-1.0.i386.rpm # yum -y localinstall --nogpgcheck /usr/local/src/oracle-instantclient-basic-10.2.0.4-1.i386.rpm \ /usr/local/src/oracle-instantclient-sqlplus-10.2.0.4-1.i386.rpm # yum -y install oracle-lib-compat
SELinux用のポリシも合わせてインストールしておきます。
# yum -y install oracle-xe-selinux oracle-instantclient-selinux oracle-instantclient-sqlplus-selinux
「Oracle XE」のセットアップ
まず、セットアップを進めます。
# /etc/init.d/oracle-xe configure Oracle Database 10g Express Edition Configuration ------------------------------------------------- This will configure on-boot properties of Oracle Database 10g Express Edition. The following questions will determine whether the database should be starting upon system boot, the ports it will use, and the passwords that will be used for database accounts. Press <Enter> to accept the defaults. Ctrl-C will abort. Specify the HTTP port that will be used for Oracle Application Express [8080]:9055 Specify a port that will be used for the database listener [1521]:1521 Specify a password to be used for database accounts. Note that the same password will be used for SYS and SYSTEM. Oracle recommends the use of different passwords for each database account. This can be done after initial configuration:[your password] Confirm the password:[your password] Do you want Oracle Database 10g Express Edition to be started on boot (y/n) [y]:y Starting Oracle Net Listener...Done Configuring Database...Done Starting Oracle Database 10g Express Edition Instance...Done Installation Completed Successfully. To access the Database Home Page go to "http://127.0.0.1:9055/apex"
「tnsnames.ora」ファイルを作ります。SELinuxを有効にしている場合は restorecon も忘れずに。
# cat >> /etc/tnsnames.ora << 'EOF' XE = (DESCRIPTION = (ADDRESS_LIST = (ADDRESS = (PROTOCOL = TCP)(HOST = localhost)(PORT = 1521)) ) (CONNECT_DATA = (SERVICE_NAME = xe) ) ) EOF # restorecon -v /etc/tnsnames.ora
最後にDBユーザーの作成とログインテストです。
まずログイン確認です。
# sqlplus 'sys@xe as sysdba' SQL*Plus: Release 10.2.0.4.0 - Production on Thu Dec 9 14:04:26 2010 Copyright (c) 1982, 2007, Oracle. All Rights Reserved. Enter password: Connected to: Oracle Database 10g Express Edition Release 10.2.0.1.0 - Production SQL>
次にspacewalk用のユーザーを作成します。
# sqlplus 'sys@xe as sysdba' SQL*Plus: Release 10.2.0.4.0 - Production on Thu Dec 9 14:06:28 2010 Copyright (c) 1982, 2007, Oracle. All Rights Reserved. Enter password: Connected to: Oracle Database 10g Express Edition Release 10.2.0.1.0 - Production SQL> create user spacewalk identified by [your password] default tablespace users; User created. SQL> grant dba to spacewalk; Grant succeeded. SQL> quit
専用ユーザーを作成したらログイン確認です。
# sqlplus spacewalk/[your password]@xe
Spacewalkの初期設定
「spacewalk-setup --disconnected」コマンドを発行後、対話型で設定していきます。
こんな感じです。一通り入力すればインストールは完了なはず。
# spacewalk-setup --disconnected * Setting up Oracle environment. * Setting up database. ** Database: Setting up database connection for Oracle backend. DB User? spacewalk DB Password? [your password] DB SID? XE DB hostname? localhost DB port [1521]? 1521 DB protocol [TCP]? TCP ** Database: Testing database connection. *** 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 country 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. Visit https://xxx.xxx.xxx.xxx to create the Spacewalk administrator account.
Spacewalkの起動とログイン
起動は以下のコマンドを実行すればOKです。
# /usr/sbin/rhn-satellite start
後はPostgreSQLを選んだ場合と同じです。
今日はこんな所で。