VMware Communities
oneechan69
Contributor
Contributor

VMware Fusion: how can I access an Apache server in my Ubuntu VM from my Mac Host?

I install apache2 in Ubuntu with sudo apt install apache2 -y, start it up with sudo service apache2 start, and can access it on the Ubuntu VM with the address localhost. I found that I can access the server from the host using the VM's IPv4 address found in Ubuntu Settings > Network > gear icon. Every time I boot up my Mac with the VM and the Apache server, I want to be able to access it from the host using the same address everytime, whether it's a static IP address, or somehow by entering localhost. I tried tutorials from here and here to set a static IP address, but they don't seem to work, and I don't know much about networking.

0 Kudos
1 Reply
oneechan69
Contributor
Contributor

Solution:

  • Shut down the virtual machine
  • on the menu bar go to Virtual Machine > Settings > Add Devices
  • Create a new Network device, set configuration to "Private to my Mac" under Custom, and generate a MAC address.
  • Start up Ubuntu and Apache2 server
  • In the settings app, and under network there should be more than one connection. Click the gear icon for each connection until you find the one with a matching MAC address. Copy the IP Address somewhere.
  • Follow this tutorial to change the IP Address to a static one (in the netplan file, use the IP address copied in the step above). This will make the IP address stay the same.
  • Entering the IP address in the host should take you to Apache's test page.
0 Kudos