How to SSH into your VirtualBox VM from another machine, OS X edtion

By far the easiest way to get Oracle up and running on OS X is to install VirtualBox and run a developer VM. The VirtualBox and VMs are free downloads from Oracle. You don’t have to install the database and the developer VM comes with labs to get you started.

So what could make it even better? Well, the VM needs memory and CPU, and my laptop is old and feeble (the problem with “laptop RAC” alas). What if I could install the VM on a desktop and just ssh into it from my older, low-powered low-memory laptop?

I found posts on getting this to work with Windows and Linux hosts, but not for OS X, so here’s the writeup.

How to set up your OS X VirtualBox VM so that you can ssh into it from another machine

guest: Linux, host: OS X
Assumptions: You have installed VirtualBox on OS X, you have a RedHat Linux VM guest OS, and sshd is installed and working in the guest OS.

In the Host OS:
1. With VM powered off, go into VM settings and add a network adapter of type Bridged
2. Start the VM

In the guest OS:
3. type “ifconfig -a” to see the name and MAC address of the new network adapter
4. In the guest OS, go to Applications -> System -> Settings -> Network
5. Click “Create new profile” and fill it:
identity: name of the adapter eg. enp0s9
MAC address: choose the one that matches the Bridged adapter
IPv4: choose DHCP
IPv6: turn off
then click “Apply”
6. “ifconfig -a” to see the dynamically IP address that is up on the new interface
7. Test that you can ssh to that IP address:
ssh oracle@10.0.1.19

In the host OS:
8. Switch to terminal window and test that you can ssh to that IP address:
ssh oracle@10.0.1.19

In another machine in your network:
9. Switch to terminal window and test that you can ssh to that IP address:
ssh oracle@10.0.1.19

Assorted tips

Time Machine: be sure to exclude the VM disks from Time Machine backup – otherwise TM will constantly back them up as the DB changes (I think DB must be in archlov mode)

Logging in to the CDB – don’t forget to unset TWO_TASK if you want to connect “/ as sysdba”! The Developer VM comes with env var “TWO_TASK=orcl”.

Leave a Reply

Your email address will not be published. Required fields are marked *

This site uses Akismet to reduce spam. Learn how your comment data is processed.