For a workshop on Node.js I needed a VM to demonstrate and students try out the Oracle DB Driver for Node. I wanted a lean VM with the bare minimum: Oracle Database XE, Node, the Oracle DB Driver for Node and the Git client (for fetching sources from GitHub). I stumbled across the OXAR repository in GitHub (https://github.com/OraOpenSource/OXAR ) – Oracle XE & APEX build script along with images for popular cloud platforms http://www.oraopensource.com/oxar/ . Using the sources I found here, I could create my VM in a few simple, largely automated steps. I ended up with a 4.5 GB sized VM image (which exports as a 1.5 GB appliance) that runs in 1 GB. It is more than adequate for my needs.
The steps – for myself if I need to go through them again and of course for you, the reader, to also create this handsome, useful VM.
The steps for creating your own VM image are as follows:
2. get the OXAR repository content
git clone https://github.com/OraOpenSource/OXAR
3. Download Oracle 11gR2 XE installer for Linux from OTN: http://www.oracle.com/technetwork/database/database-technologies/express-edition/downloads/index.html and copy the downloaded file oracle-xe-11.2.0-1.0.x86_64.rpm.zip (the Linux installer for Oracle 11gR2 XE Database downloaded from OTN) to the OXAR/files directory
4. edit the file config.properties in the OXAR root directory
– set parameter OOS_ORACLE_FILE_URL to file:///vagrant/files/oracle-xe-11.2.0-1.0.x86_64.rpm.zip and save the change:
Use the OOS_MODULE_XXX flags to specify which components should be installed. Here I have chosen not to install APEX and NODE4ORDS.
5. run vagrant using the statement:
6. after rebooting the system, the VM will be started (or you can start it using vagrant up again or by using the VirtualBox manager).
You can start an SSH session into it by connecting to localhost:50022, then login to Linux using vagrant/vagrant
7. connect to the database using sqlplus hr/oracle
8. Try out Node.js
9. To try out Node against Oracle Database using the driver, you can clone the GitHub Repository:
Next, cd into the newly created directory
and run the file select.js:
10. To try out PL/SQL as well:
Create the procedure get_salary using the file get_salary_proc.sql
Run Node program plsql.js: