LoginSignup
17
17

More than 5 years have passed since last update.

OS X で Vagrant な Ubuntu に Oracle XE をインストール

Last updated at Posted at 2014-04-16

環境
- OS X 10.9.2
- Vagrant 1.5.2
- Ubuntu 12.04 64bit (precise64)
- Oracle Database XE 11.2

(参考)ubuntu 13.04(64bit)にoracle-xe-11.2をcuiでインストール

-
仮想マシンを作成する

$ vagrant init hashicorp/precise64
$ vagrant up

Oracleからパッケージを入手する(要OTNアカウント)
http://www.oracle.com/technetwork/jp/database/database-technologies/express-edition/downloads/index.html
- oracle-xe-11.2.0-1.0.x86_64.rpm.zip

仮想マシンにパッケージをコピーする

$ vagrant ssh-config > .vagrant.ssh.config
$ scp -F .vagrant.ssh.config path/to/oracle-xe-11.2.0-1.0.x86_64.rpm.zip default:

仮想マシンにログインする

$ vagrant ssh

-

$ sudo apt-get update
$ sudo apt-get install alien libaio1 unixodbc unzip
$ unzip oracle-xe-11.2.0-1.0.x86_64.rpm.zip
$ cd Disk1/

rpm形式をdebian形式に変換する

$ sudo alien --to-deb --scripts oracle-xe-11.2.0-1.0.x86_64.rpm
oracle-xe_11.2.0-2_amd64.deb generated

-
chkconfigファイルを作成する

$ sudo vi /sbin/chkconfig
#!/bin/bash
# Oracle 11gR2 XE installer chkconfig hack for Debian by Dude
file=/etc/init.d/oracle-xe
if [[ ! `tail -n1 $file | grep INIT` ]]; then
   echo >> $file
   echo '### BEGIN INIT INFO' >> $file
   echo '# Provides:             OracleXE' >> $file
   echo '# Required-Start:       $remote_fs $syslog' >> $file
   echo '# Required-Stop:        $remote_fs $syslog' >> $file
   echo '# Default-Start:        2 3 4 5' >> $file
   echo '# Default-Stop:         0 1 6' >> $file
   echo '# Short-Description:    Oracle 11g Express Edition' >> $file
   echo '### END INIT INFO' >> $file
fi
update-rc.d oracle-xe defaults 80 01
$ sudo chmod 755 /sbin/chkconfig
$ sudo ln -s /usr/bin/awk /bin/awk
$ sudo dpkg --install ./oracle-xe_11.2.0-2_amd64.deb

初期化スクリプトを修正する

sudo vi /u01/app/oracle/product/11.2.0/xe/config/scripts/init.ora
sudo vi /u01/app/oracle/product/11.2.0/xe/config/scripts/initXETemp.ora
#memory_target=
pga_aggregate_target=200540160
sga_target=601620480

パスワードは oracle に設定する

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

sqlplusで確認する

$ source /u01/app/oracle/product/11.2.0/xe/bin/oracle_env.sh
$ sqlplus system/oracle

-
仮想マシンをログアウトして1521ポートをフォワードする

$ vi Vagrantfile
config.vm.network :forwarded_port, guest: 1521, host: 1521
$ vagrant reload
$ sqlplus system/oracle@127.0.0.1

ボックスを保存する

$ vagrant package
$ vagrant box add oracle package.box
17
17
0

Register as a new user and use Qiita more conveniently

  1. You get articles that match your needs
  2. You can efficiently read back useful information
  3. You can use dark theme
What you can do with signing up
17
17