Install Setup Ubuntu - RichardForshaw/dev-tools-blog GitHub Wiki

Installing a Ubuntu Virtual Dev Environment

Virtual machines

VMWare v VirtualBox. I have found the two to be fairly similar however VirtualBox is more resiliant when working off an external drive, which puts VirtualBox in front.

Which Ubuntu?

Depending on what you want to do. If you want minimal Ubuntu and are likely to be implementing a backend service, and you don't mind using a lot of text or running your development from your host over Samba, then get Ubuntu Server. You will need to install your necessary packages yourself.

If you are doing graphical Ubuntu development or want to use local graphical development tools then get Ubuntu Desktop

Creating the VM

Create a new Virtual machine in your VM platform of choice. Note that Ubuntu Desktop requires at least 6.5GB of space, and won't install without it. Ubuntu Server only requires about 1.5GB to install.

Networking

There are a couple of options on Networking. I generally use two:

  1. Configure your VM with 2 network interfaces. One with NAT (to access the internet) and one with Host-Only (for the host and guest to talk to each other.) Generally once you have accessed the internet to install all your packages then you can disconnect that connection and your VM will be safe from any external threats, which is just one less thing to worry about. If you have many internal VMs, then they can talk to each other over the host-only network.
  2. Configure your VM with a Bridged Network Adapter. This allows your VM to talk to your host and to the internet, however your guest will be permanently visible to the outside world. If this scares you (which it should), you should turn on the UFW (Uncomplicated Firewall), and at least just turn it on (sudo ufw enable) and open a port for SSH to work only from your local subnet (sudo ufw allow from 192.168.1.0/24 to any port 22). This means you can SSH into your new machine in a nice terminal. You will probably have to open more ports depending on other development tools you wish to use.

Gotchas

Static IP addressing

Usually you will use DHCP on both the interface, but sometimes you want a static IP. With option (1) above your /etc/network/intefaces file should look like this:

# The loopback network interface
auto lo
iface lo inet loopback

# The primary network interface
auto eth0
iface eth0 inet dhcp

auto eth1
iface eth1 inet static
    address 192.168.56.100
    netmask 255.255.255.0

Note, please DON'T put a gateway entry in eth0... this will become the DEFAULT GATEWAY for all networking and your NAT connection will not be able to resolve any internet names.

Installing Ubuntu

This is straightforward - download the necessary ISO from the ubuntu website and 'load it' into the appropriate drive in Settings->Storage. Then start the VM. It will load the ISO and run the installer.

<ToDo: List any specific settings>

Get essential services working

Remote access

Make sure you can log in. If you are using networking option 1 above, then you might need to enable the second interface by adding the following line to /etc/network/interfaces:

auto eth1
iface eth1 inet dhcp

Then you can run ifup eth1

If you still can't access via putty, then see if you are running ufw (sudo ufw status) To allow access from your subnet: sudo ufw allow from <subnet-X.Y.Z>.0/24

Samba

sudo ufw allow Samba

Other

Set a name

Edit the name in /etc/hostname and /etc/hosts and restart.

Give yourself a normal user login, wigth sudo power

sudo adduser <newname> sudo adduser <newname> sudo

⚠️ **GitHub.com Fallback** ⚠️