OHDSI Home | Forums | Wiki | Github

Connecting to ohdsi-in-a-box SQL from another machine


(Calum Macdonald) #1

Hi All,

I am new to these forums, so apologies if this information is out there already.

I just setup ohdsi-in-a-box (via VM, not AWS), I was wondering if anyone has experience or instructions on how I can expose the postgresql database(s) to my host machine, or even better, my local wifi network?

cheers,
Calum


(Calum Macdonald) #2

I figured it out myself, it was not too bad. Here are the instructions for anyone else trying…

  1. Before launching the VM, click settings, then the ‘Network’ tab. Switch from NAT to Bridged Adapter
  2. Launch the VM
  3. Make sure openssh is installed/enabled sudo apt-get install openssh-server
  4. Check you see tcp connection in port 22 for ssh netstat -lnpt | grep 22
  5. Check you can ssh into the VM from within the VM with ssh 127.0.0.1
  6. Allow incoming traffic iptables -A INPUT -p tcp --dport ssh -j ACCEPT
  7. Get the IP address of the VM now via ip addr show (will be the first non 127.0.0.1 ip you see)
  8. ssh from an external machine ssh ohdsi@
  9. connect to postgresql via postgresql://ohdsi:<passworrd>@<VM IP>:5432/ohds

Now I can connect to the VM/VirtualBox from any computer in my local network and access the databases however I like

cheers,
Calum


t