Menu

A currated repository of web design tools and resources that I use...

Parallels Ubuntu Offline Development Environment Mac

November 28, 2017 - Development Tools, How To
Parallels Ubuntu Offline Development Environment Mac

In most cases, I want my development server to be it’s own machine, with it’s own IP address. It can connect to the internet, databases, and other APIs and other devs in the office can access my machine via shell, webmin etc.

On my laptop, I wanted an completely offline system. I built a light version of our database and files and stored them locally on my laptop hard disk. How you do that will depend on your architecture. Below, I’ll document the changes I made to my parallels install and my Ubuntu virtual machine.

I am running Parallels 12 currently.

 

Step 1 – Make your virtual machine have a dynamic IP address

You need to edit a file on your virtual machine:

/etc/network/interfaces

If you have the tools installed, you can use gedit via shell:

$ sudo gedit /etc/network/interfaces

Or FTP in and edit the file with a text editor.

If you have a static IP address already, you will see something similar to this:
iface eth0 inet static
address 192.168.0.10
netmask 255.255.255.0
gateway 192.168.0.1

In my case, it was using the keyword eth1 instead of eth0. I changed this block of code to:
auto eth0
iface eth0 inet dhcp

Then I restarted my network adapter on my virtual machine:
$ sudo /etc/init.d/networking restart

I did have trouble once getting these setting to take so I had to reboot the virtual machine.

Now you should have a dynamic IP address. Which means it could change and is assigned dynamically by the router.

Step 2 – Change the network adapter in Parallels

In the control center for your virtual machine, you want to select “shared network”. You can read more about it here:

http://kb.parallels.com/en/4948

Now your virtual machine will not require an internet connection for your Mac to access it. You will need to edit your hosts files to point to the new IP address assigned to the virtual machine by parallels. You can get the IP address via shell using the command ifconfig.

Step 3 – Edit host files

You will need to edit the file:
/etc/hosts

You probably have some lines in there with an IP address space development domain. Change the IP address to match the new IP address of your virtual machine. Now your mac will not go out through a router to access your virtual machine.

Daniel Posted by

Leave a Reply

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