Alternative Instructions

Alternative Network Settings - "Bridged Adapter"

If you want your VM to appear on the network like any other machine, you need the Bridged Adapter setting. Under the "Network" section of your VM's configuration, change the "Name" dropdown to Bridged Adapter and then choose your the local host connection from the "Name" dropdown. (e.g., en0: Ethernet, en1: Wi-Fi)

This network configutation will expose your VM to the network, making it accessible like any other machine. However in practice, your VM may not interact well with your networks services e.g. DHCP. If you have trouble connecting to the internet and/or network on you VM, change to a different network configuration.

After starting your VM, when you reach the login screen, make note of the IP address your VM is using (e.g., *** You can access the application at http://10.30.46.27 ***). You can enter the IP address into a web browser to test that your VM is running and serving web pages.

Note: the IP address of your VM is dynamically assigned and can change. If you forget the current IP value you can find the current IP being used via the ip address command.

Alternative Network Settings - "NAT"

Navigate to the "Network" section and to "Adapter 1." Change the Attached to setting to NAT. This setting hides your VM in it's own network hosted on your computer. Next, select the Advanced option, revealing the Port Forwarding button. Select Port Forwarding, and enter the following rules:

Name Protocol Host IP Host Port Guest IP Guest Port
HTTP TCP 80 10.0.2.15 80
SSH TCP 22 10.0.2.15 22

Confirm your VM is serving web pages by opening a browser and entering "localhost" into the location bar. You should see a page that says "Congratulations!".

Shared Folder

For ease of transferring files, we can share a folder with the host system. A shared folder is not strictly necessary, you could use scp or a GUI such as WinSCP as an alternative way to transfer files. You must first add the "guest additions" to your VM; follow these directions to install the "guest additions."

Now back in the VirtualBox machine settings, add a "Shared Folder" named vmshare that is connected to a folder (should be empty) you choose on your host OS. Make sure that the "Auto-mount" and "Make Permanent" options should be checked. Reboot the VM and you should now have a connection between the guest and host systems.

This "Shared Folder" will be mounted at /media/sf_XXX where "XXX" is the name you've given the shared folder e.g. vmshare. Since we want to share the web server's "htdocs" directory, let's set up a shared folder on the VM that is linked to the web server's folder, give the daemon user access to that folder by adding them to the vboxsf group then reboot:

dev@dev314:~$ sudo mkdir /media/sf_vmshare/website
dev@dev314:~$ sudo ln -s /media/sf_vmshare/website /var/www/html
dev@dev314:~$ sudo chmod a+rwx /media/sf_vmshare
dev@dev314:~$ sudo adduser daemon vboxsf
dev@dev314:~$ sudo adduser dev vboxsf
			

Note that this may delete everything previously existing in the htdocs folder on the VM but that's OK as we'd be deleting the files anyway. Also, for convenience, let's add a link between the dev user's home directory and the web directory.

dev@dev314:~$ ln -s /media/sf_vmshare/website /home/dev/website


This page was last modified on 2026-08-19 at 20:15:09.

Copyright © 2018–2026 George Fox University. All rights reserved.