Amahi on VirtualBox

From Amahi Wiki
Jump to: navigation, search
Warning.png WARNING
Amahi 7.x (for Fedora 19) specific instructions!



Back to 'Amahi Virtualized'

Why do this?

If you want to test Amahi without upsetting your existing network configuration, one of the easiest ways of doing so is using a virtual machine. The following description applies to VirtualBox, version 3.2.10. It results in a functioning Amahi install that can be accessed both from the host machine and other VMs, including PXE-booting VM.

Prerequisites

  • A working installation of VirtualBox
  • An Express CD image (this was tested with Amahi-5.4-Express-2.6-Beta-i386.iso). This can be done using the normal Fedora i386/x86_64 DVD as well.
  • A desire to do this!

The catch

The process is fractionally more complex than a standard Amahi install, because we need to tweak the VM network configuration part-way through.

You will also need to know the IP address range that your version of VirtualBox uses for its "Host only" network type. Check the network configuration of the host system.

On a Mac OS host, there's an interface called "vboxnet0". At the time of writing, the default on Mac OS is 192.168.56.1.

On a Linux host, you need to create "vboxnet0" on VirtualBox. It's on file -> Settings -> Network, and then add a host only network. It will also have 192.168.56.1 as default IP address range.

Configure the hda

First, configure your Amahi install in the usual way at the control panel. You must use the IP address of the VirtualBox "Host only" interface as your gateway (in my case, 192.168.56.1).

You can also set the VirtualBox DHCP server to a single start/end address (i.e. 192.168.56.10). This will ensure your VM has only one possible IP and that will be the one you add to the profile. If you do not do this, then you will need to find out the IP address in order to access the dashboard.

If you want to use the VirtualBox DHCP server, here's how to do it. Be aware that this affects all virtual machines on the host system, not just the virtual machine you are creating for Amahi.

  • In the VirtualBox Manager go to File -> Preferences -> Network -> Host-only Networks -> double-click on "VirtualBox Host-Only Ethernet Adapter" -> select the DHCP Server tab.
  • Check "Enable Server".
    • Server Address: 192.168.56.1
    • Server Mask: 255.255.255.0
    • Lower Address Bound: 192.168.56.10
    • Upper Address Bound: 192.168.56.10


If you have already have Amahi on your network, you might wish to consider changing the home domain to something other than home.com.

Make a note of the install code indicated.

Create the VM

Create a fresh VM in the usual VirtualBox way:

  • Name it as you see fit ("Amahi-test")
  • Select "Linux" and "Fedora" as the OS and version
  • Create a virtual disk for the installation: 8GB, dynamically sized should be sufficient


Once you've created the VM, go to the settings window and do the following:

  • Check that the first network interface is configured as NAT
  • Under storage, attach the Express CD image as a CD

Run the installation

Start your VM and it will boot from the CD image. Work through the Express CD installer in the usual way, entering the install code that the Amahi control panel gave you earlier. You will be asked to reboot a couple of times during the process. (During the first reboot you will have to disconnect the Express CD iso image, otherwise you'll get back to the installer menu.)

Eventually, the console should show a text login prompt. At which point you should shut down the VM, either by sending the shutdown signal from VirtualBox or log in and issue the shutdown command.

Altering the VM network config

At this stage we are going to configure two network interfaces. Open the VirtualBox network settings window for your VM. Configure the first two adapters thus:

  • Adapter 1: Enabled, Attached to: Host-only Adapter
  • Adapter 2: Enabled, Attached to: NAT

Reconfiguring the network

Boot the VM and wait for the login prompt. Login as admin (default password: admin) and use su to become root.

For Fedora 14

Using your favourite editor, create the file:

/etc/sysconfig/network-scripts/ifcfg-eth1

with the contents:

Text
sh: warning: setlocale: LC_ALL: cannot change locale (C.UTF-8) ​DEVICE=eth1 BOOTPROTO=dhcp ONBOOT=yes​

For Ubuntu 10.04

Using your favorite editor, open the file:

/etc/network/interfaces

At the end of the file add:

Text
sh: warning: setlocale: LC_ALL: cannot change locale (C.UTF-8) ​auto eth1 iface eth1 inet dhcp​

Reinitialize the gateway

Now we need to reconfigure the hda to ensure that it picks up the new network config, using the command hda-change-gw and the IP address of the host-only network. In my case:

bash code
sh: warning: setlocale: LC_ALL: cannot change locale (C.UTF-8) ​hda-change-gw 192.168.56.1​


This allows amahi to serve on the host-only network, eth0, while still having access to the wider internet through the eth1 NAT interface. (The latter is necessary if you want to install any apps, for instance.)

Now reboot.

Test it

Wait until the VM comes back up and open a web browser. Browse to http://192.168.56.10 should put up the usual Amahi log-in page. If not, something's gone wrong. You can also connect via ssh from the host if you don't want to use the VirtualBox console.

Note that the DNS & DHCP will not be visible from the host system unless you alter the host system config. However, other VMs connected to the same host-only network will be able to use these services, including PXE-booting.

Other approaches to network config

Amahi will work behind VirtualBox NAT quite happily, but at the time of writing, VirtualBox port-forwarding doesn't play nicely with Amahi's network config. (Or at least it didn't for me.) NAT also won't permit two virtual machines communicating (e.g. for testing PXE-booting).

Bridged Mode

If you want Amahi within the VM to serve other machines on your LAN, select bridged mode instead of NAT initially and don't alter the network config. The basic install process will just work.

However, in your Amahi control panel you should enter a configuraion that matches your existin network and does not clash with any other machine. This is important.

If you are running on a Linux host, you can go into the "Advanced" settings and set the "Adapter Type" to "Paravirtualized Network (virtio-net)". For more information as to why you might want to do this, check read here.

Guest Additions (Windows)