Skip to content

Commit

Permalink
Run files through dos2unix to ensure LF line endings (see issue hilve…
Browse files Browse the repository at this point in the history
  • Loading branch information
hilverd committed Jan 26, 2014
1 parent b0710fb commit 0d98042
Show file tree
Hide file tree
Showing 2 changed files with 80 additions and 58 deletions.
62 changes: 28 additions & 34 deletions README.md
Original file line number Diff line number Diff line change
@@ -1,30 +1,27 @@
# Oracle XE 11g on Ubuntu 12.04 using Vagrant

This project enables you to install Oracle 11g XE in a virtual machine running
Ubuntu 12.04, using [Vagrant] and [Puppet].
This project enables you to install Oracle 11g XE in a virtual machine running Ubuntu 12.04, using
[Vagrant] and [Puppet].

## Acknowledgements

This project was created based on the information in
[Installing Oracle 11g R2 Express Edition on Ubuntu 64-bit] by Manish Raj, and
the GitHub repository [vagrant-oracle-xe] by Stefan Glase. The former explains
how to install Oracle XE 11g on Ubuntu 12.04, without explicitly providing a
Vagrant or provisioner configuration. The latter has the same purpose as this
project but uses Ubuntu 11.10.
[Installing Oracle 11g R2 Express Edition on Ubuntu 64-bit] by Manish Raj, and the GitHub repository
[vagrant-oracle-xe] by Stefan Glase. The former explains how to install Oracle XE 11g on Ubuntu
12.04, without explicitly providing a Vagrant or provisioner configuration. The latter has the same
purpose as this project but uses Ubuntu 11.10.

Thanks to André Kelpe, Brandon Gresham, Charles Walker, Chris Thompson,
Jeff Caddel, Matthew Buckett, Richard Kolb, and Steven Hsu for various
contributions.
Thanks to André Kelpe, Brandon Gresham, Charles Walker, Chris Thompson, Jeff Caddel, Joe FitzGerald,
Mark Crossfield, Matthew Buckett, Richard Kolb, and Steven Hsu for various contributions.

## Requirements

* You need to have [Vagrant] installed.
* The host machine probably needs at least 4 GB of RAM (I have only tested 8 GB
of RAM).
* As Oracle 11g XE is only available for 64-bit machines at the moment, the host
machine needs to have a 64-bit architecture.
* I have tested this project on a host machine running Ubuntu 12.04, but other
operating systems should also work, as long as they can run Vagrant.
* The host machine probably needs at least 4 GB of RAM (I have only tested 8 GB of RAM).
* As Oracle 11g XE is only available for 64-bit machines at the moment, the host machine needs to
have a 64-bit architecture.
* I have tested this project on a host machine running Ubuntu 12.04, but other operating systems
should also work, as long as they can run Vagrant.

## Installation

Expand All @@ -37,21 +34,20 @@ contributions.
vagrant plugin install vagrant-vbguest

* Download [Oracle Database 11g Express Edition] for Linux x64. Place the file
`oracle-xe-11.2.0-1.0.x86_64.rpm.zip` in the directory `modules/oracle/files`
of this project. (Alternatively, you could keep the zip file in some other
location and make a hard link to it from `modules/oracle/files`.)
`oracle-xe-11.2.0-1.0.x86_64.rpm.zip` in the directory `modules/oracle/files` of this
project. (Alternatively, you could keep the zip file in some other location and make a hard link
to it from `modules/oracle/files`.)

* Run `vagrant up` from the base directory of this project. This should take a
few minutes.
* Run `vagrant up` from the base directory of this project. This should take a few minutes.

You should now be able to connect to the new database at `localhost:1521/XE`
as `system` with password `manager`. For example, if you have `sqlplus`
installed on the host machine you can do
You should now be able to
[connect](http://www.oracle.com/technetwork/developer-tools/sql-developer/downloads/index.html) to
the new database at `localhost:1521/XE` as `system` with password `manager`. For example, if you
have `sqlplus` installed on the host machine you can do

sqlplus system/manager@//localhost:1521/XE

To make sqlplus behave like other tools (history, arrow keys etc.) you can do
this:
To make sqlplus behave like other tools (history, arrow keys etc.) you can do this:

rlwrap sqlplus system/manager@//localhost:1521/XE

Expand All @@ -68,18 +64,16 @@ You might need to add an entry to your `tnsnames.ora` file first:

## Troubleshooting

It is important to assign enough memory to the virtual machine, otherwise you
will get an error
It is important to assign enough memory to the virtual machine, otherwise you will get an error

ORA-00845: MEMORY_TARGET not supported on this system

during the configuration stage. In the `Vagrantfile` 512 MB is assigned. Lower
values may also work, as long as (I believe) 2 GB of virtual memory is available
for Oracle, swap is included in this calculation.
during the configuration stage. In the `Vagrantfile` 512 MB is assigned. Lower values may also work,
as long as (I believe) 2 GB of virtual memory is available for Oracle, swap is included in this
calculation.

If you want to raise the limit of the number of concurrent connections, say to
200, then according to
[How many connections can Oracle Express Edition (XE) handle?] you should run
If you want to raise the limit of the number of concurrent connections, say to 200, then according
to [How many connections can Oracle Express Edition (XE) handle?] you should run

ALTER SYSTEM SET processes=200 scope=spfile

Expand Down
76 changes: 52 additions & 24 deletions modules/oracle/manifests/init.pp
Original file line number Diff line number Diff line change
@@ -1,33 +1,48 @@
class oracle::server {

exec { "apt-update":
command => "/usr/bin/apt-get -y update",
timeout => 3600;
command => "/usr/bin/apt-get -y update",
timeout => 3600;
}

package {
["alien", "bc", "libaio1", "unixodbc", "unzip", "rlwrap"]:
["alien", "bc", "libaio1", "unixodbc", "unzip", "rlwrap", "dos2unix"]:
ensure => installed;
}

exec {
"procps":
refreshonly => true,
command => "/etc/init.d/procps start";
exec { "procps":
refreshonly => true,
command => "/etc/init.d/procps start";
}

file {
"/sbin/chkconfig":
"/tmp/chkconfig":
mode => 0755,
source => "puppet:///modules/oracle/chkconfig";
"/etc/sysctl.d/60-oracle.conf":
"/tmp/60-oracle.conf":
notify => Exec['procps'],
source => "puppet:///modules/oracle/60-oracle.conf";
"/etc/rc2.d/S01shm_load":
"/tmp/S01shm_load":
mode => 0755,
source => "puppet:///modules/oracle/S01shm_load";
}

# If we're running on Windows, then Git may have converted line endings to CRLF upon cloning the
# repository. Here we use dos2unix to make sure that they are LF.
exec {
"dos2unix chkconfig":
command => "/usr/bin/dos2unix -n /tmp/chkconfig /sbin/chkconfig",
creates => "/sbin/chkconfig",
require => [File["/tmp/chkconfig"], Package["dos2unix"]];
"dos2unix 60-oracle.conf":
command => "/usr/bin/dos2unix -n /tmp/60-oracle.conf /etc/sysctl.d/60-oracle.conf",
creates => "/etc/sysctl.d/60-oracle.conf",
require => [File["/tmp/60-oracle.conf"], Package["dos2unix"]];
"dos2unix S01shm_load":
command => "/usr/bin/dos2unix -n /tmp/S01shm_load /etc/rc2.d/S01shm_load",
creates => "/etc/rc2.d/S01shm_load",
require => [File["/tmp/S01shm_load"], Package["dos2unix"]];
}

user {
"syslog":
ensure => present,
Expand All @@ -39,12 +54,11 @@
ensure => present;
}

exec {
"set up shm":
command => "/etc/rc2.d/S01shm_load start",
require => File["/etc/rc2.d/S01shm_load"],
user => root,
unless => "/bin/mount | grep /dev/shm 2>/dev/null";
exec { "set up shm":
command => "/etc/rc2.d/S01shm_load start",
require => Exec["dos2unix S01shm_load"],
user => root,
unless => "/bin/mount | grep /dev/shm 2>/dev/null";
}

Exec["apt-update"] -> Package <| |>
Expand Down Expand Up @@ -86,9 +100,9 @@
file {
"/home/vagrant/oracle-xe-11.2.0-1.0.x86_64.rpm.zip":
source => "puppet:///modules/oracle/oracle-xe-11.2.0-1.0.x86_64.rpm.zip";
"/etc/profile.d/oracle-env.sh":
"/tmp/oracle-env.sh":
source => "puppet:///modules/oracle/oracle-env.sh";
"/tmp/xe.rsp":
"/tmp/xe.rsp.orig":
source => "puppet:///modules/oracle/xe.rsp";
"/bin/awk":
ensure => link,
Expand All @@ -99,6 +113,17 @@
ensure => present;
}

exec {
"dos2unix oracle-env.sh":
command => "/usr/bin/dos2unix -n /tmp/oracle-env.sh /etc/profile.d/oracle-env.sh",
creates => "/etc/profile.d/oracle-env.sh",
require => [File["/tmp/oracle-env.sh"], Package["dos2unix"]];
"dos2unix xe.rsp":
command => "/usr/bin/dos2unix -n /tmp/xe.rsp.orig /tmp/xe.rsp",
creates => "/tmp/xe.rsp",
require => [File["/tmp/xe.rsp.orig"], Package["dos2unix"]];
}

exec {
"unzip xe":
command => "/usr/bin/unzip -o oracle-xe-11.2.0-1.0.x86_64.rpm.zip",
Expand All @@ -120,8 +145,8 @@
command => "/etc/init.d/oracle-xe configure responseFile=/tmp/xe.rsp >> /tmp/xe-install.log",
timeout => 3600,
require => [Package["oracle-xe"],
File["/etc/profile.d/oracle-env.sh"],
File["/tmp/xe.rsp"],
Exec["dos2unix oracle-env.sh"],
Exec["dos2unix xe.rsp"],
File["/var/lock/subsys/listener"],
Exec["set up shm"],
Exec["enable swapfile"]],
Expand All @@ -137,8 +162,11 @@
}

service {
"oracle-xe":
ensure => "running",
require => [Package["oracle-xe"], Exec["configure xe"]],
"oracle-xe":
ensure => "running",
require => [Package["oracle-xe"],
Exec["configure xe"],
Exec["dos2unix chkconfig"],
Exec["dos2unix 60-oracle.conf"]],
}
}

0 comments on commit 0d98042

Please sign in to comment.