UbuntuにOracle XEをインストール

UbuntuOracle XEをインストール。

楽過ぎて泣けた。笑

インストール

libaioが必要ですが、依存関係で勝手にインストールされます。

$ sudo vi /etc/apt/source.list
deb http://oss.oracle.com/debian unstable main non-free

$ sudo wget http://oss.oracle.com/el4/RPM-GPG-KEY-oracle  -O- | sudo apt-key add - 
$ sudo apt-get update
$ sudo apt-get install oracle-xe-universal
パッケージリストを読み込んでいます... 完了
依存関係ツリーを作成しています                
状態情報を読み取っています... 完了
以下の特別パッケージがインストールされます:
  libaio
以下のパッケージが新たにインストールされます:
  libaio oracle-xe-universal
アップグレード: 0 個、新規インストール: 2 個、削除: 0 個、保留: 274 個。
262MB のアーカイブを取得する必要があります。
この操作後に追加で 451MB のディスク容量が消費されます。
続行しますか [Y/n]? y
取得:1 http://oss.oracle.com unstable/main libaio 0.3.104-1 [6018B]
取得:2 http://oss.oracle.com unstable/non-free oracle-xe-universal 10.2.0.1-1.1 [262MB]
262MB を 56s で取得しました (4637kB/s)                                         
未選択パッケージ libaio を選択しています。
(データベースを読み込んでいます ... 現在 104772 個のファイルとディレクトリがインストールされています。)
(.../libaio_0.3.104-1_i386.deb から) libaio を展開しています...
未選択パッケージ oracle-xe-universal を選択しています。
(.../oracle-xe-universal_10.2.0.1-1.1_i386.deb から) oracle-xe-universal を展開しています...
Processing triggers for man-db ...
libaio (0.3.104-1) を設定しています ...

oracle-xe-universal (10.2.0.1-1.1) を設定しています ...
update-rc.d: warning: /etc/init.d/oracle-xe missing LSB style header
Executing Post-install steps...
-e You must run '/etc/init.d/oracle-xe configure' as the root user to configure the database.


Processing triggers for libc6 ...
ldconfig deferred processing now taking place

設定??

言われたとおり、/etc/init.d/oracle-xe configureを実行します。

$ sudo /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]:

Specify a port that will be used for the database listener [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 10g Express Edition to be started on boot (y/n) [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:8080/apex"

ブラウザより、http://192.168.1.7:8080/apexにアクセスすればOK.

環境変数

oracleユーザのパスワード変更。

$ sudo passwd oracle
新しいUNIXパスワードを入力してください: 
新しいUNIX パスワードを再入力してください: 
passwd: パスワードは正しく更新されました

プラスして、zshがいいので、oracleのところの/bin/bashを/bin/zshに変更。

$ sudo vi /etc/passwd


環境変数は下記のようにしてやればOKのはずが、なぜかoracle_env.shの中のnls_lang.shの文法が間違っている?ので修正します。

具体的には

$ su - oracle
$ vi /usr/lib/oracle/xe/app/oracle/product/10.2.0/server/bin/nls_lang.sh
108 if [[ -n "$LC_ALL" ]]; then
109   locale=$LC_ALL
110 elif [[ -n "$LANG" ]]; then
111   locale=$LANG
112 else
113   locale=
114 fi

ってところ108行目と110行目の「[」と「]」を一つずつ消してやればOK.

その後、下記実行。

$ echo /usr/lib/oracle/xe/app/oracle/product/10.2.0/server/bin/oracle_env.sh >> ~/.zshrc

SQL*Plusよりログイン

$ su - oracle
$ sqlplus / as sysdba

補足

swapが足りない場合はココとかを参考にして増やすべし。