always one step forward

Oracle Database Express Edition (XE) 11g インストール on Amazon EC2

楽勝、と思ってたら(自分にとっては)はまりポイントが意外と多かったのでメモ。Markdown 記法の練習も兼ねました


環境


手順

ダウンロード 〜 swap 領域定義 〜 インストール
  • Oracle サイトからダウンロード

    http://www.oracle.com/technetwork/products/express-edition/downloads/index.html

  • EC2 サーバの任意ディレクトリに .rpm パッケージを配置

    • いったんローカルにダウンロードして Cyberduck で転送
  • 任意ディレクトリ上で .rpm をインストール

    $ sudo rpm -ivh oracle-xe-11.2.0-1.0.x86_64.rpm

  • swap が足りないとおこられた

    This system does not meet the minimum requirements for swap space. Based on the amount of physical memory available on the system, Oracle Database 11g Express Edition requires 1188 MB of swap space. This system has 1171 MB of swap space. Configure more swap space on the system and retry the installation.

  • $ swapon -s を確認するとそもそも swap 領域が定義されてさえいなかった(ので、EC2 サーバ使用時は最初に領域定義が必要)

    Filename Type Size Used Priority
    (以下空欄)

  • メッセージによると 1188MB 必要とあったので、1024*1200=1228800 からだいたいで 1230 と指定して、スワップファイル swapfile を作成

    $ sudo dd if=/dev/zero of=/swapfile bs=1024K count=1230

    1230+0 records in
    1230+0 records out
    1289748480 bytes (1.3 GB) copied, 35.8868 s, 35.9 MB/s

  • 作成したスワップファイル swap をフォーマットして、スワップ領域として使えるように設定

    $ sudo mkswap /swapfile

    $ sudo swapon /swapfile

  • $ swapon -s でできたか確認

    Filename Type Size Used Priority
    /swapfile file 125916 0 -1

  • $ sudo vim /etc/fstab で /etc/fstab の最終行(太字)にスワップ領域の定義を追記(サーバ再起動後も有効になるように)

    # LABEL=/ / ext4 defaults,noatime 1 1
    tmpfs /dev/shm tmpfs defaults 0 0
    devpts /dev/pts devpts gid=5,mode=620 0 0
    sysfs /sys sysfs defaults 0 0
    proc /proc proc defaults 0 0
    /swapfile swap swap defaults 0 0

  • ようやくあらためて Oracle をインストール

    $ sudo rpm -ivh oracle-xe-11.2.0-1.0.x86_64.rpm

    準備中... ########################################### [100%]
    1:oracle-xe ########################################### [100%]
    Executing post-install steps...
    You must run '/etc/init.d/oracle-xe configure' as the root user to configure the database.

Oracle インストール後の設定
  • 指示通り以下を実行

    $ sudo /etc/init.d/oracle-xe configure

    Oracle Database 11g Express Edition Configuration
    -------------------------------------------------
    This will configure on-boot properties of Oracle Database 11g 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 to accept the defaults. Ctrl-C will abort.

    Specify the HTTP port that will be used for Oracle Application Express [8080]:8080

    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:(パスワード入力)
    Confirm the password:(パスワード入力)

    Do you want Oracle Database 11g Express Edition to be started on boot (y/n) [y]:y

    Starting Oracle Net Listener...Done
    Configuring database...Done(ここは数分待つ)
    Starting Oracle Database 11g Express Edition instance...Done
    Installation completed successfully.

次は DBインスタンス追加、セキュリティ設定などが必要なのだろう、追って次エントリ以降に