Difference between revisions of "Amahi on VirtualBox"

From Amahi Wiki
Jump to: navigation, search
m (→‎Run the installation: Grammer, punctuation.)
 
(33 intermediate revisions by 8 users not shown)
Line 1: Line 1:
 +
{{MessageBox|
 +
backgroundcolor = #faa|
 +
image =Warning.png|
 +
heading =WARNING|
 +
message = Amahi 7.x (for Fedora 19) specific instructions!}}
 +
 +
[https://wiki.amahi.org/index.php/Amahi_Virtualized Back to 'Amahi Virtualized']
 
= Why do this? =
 
= Why do this? =
  
Line 6: Line 13:
  
 
* A working installation of VirtualBox
 
* A working installation of VirtualBox
* An express CD image (this was tested with Amahi-5.4-Express-2.6-Beta-i386.iso)
+
* 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!
 
* A desire to do this!
  
Line 13: Line 20:
 
The process is fractionally more complex than a standard Amahi install, because we need to tweak the VM network configuration part-way through.
 
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 Mac OS (and I expect Linux) there's an interface called "vboxnet0".  At the time of writing, the default on Mac OS is 192.168.56.1.
+
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 =
 
= Configure the hda =
  
First, configure your amahi install in the usual way at the [http://www.amahi.org/user control panel].  You must use the IP address of the VirtualBox "Host only" interface as your gateway (in my case, 192.168.56.1). If you have already have Amahi on your network, you might wish to consider changing the home domain to something other than home.com.
+
First, configure your Amahi install in the usual way at the [http://www.amahi.org/user 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.
 
Make a note of the install code indicated.
Line 27: Line 52:
 
* Select "Linux" and "Fedora" as the OS and version
 
* Select "Linux" and "Fedora" as the OS and version
 
* Create a virtual disk for the installation: 8GB, dynamically sized should be sufficient
 
* 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:
 
Once you've created the VM, go to the settings window and do the following:
Line 34: Line 60:
  
 
= Run the installation =
 
= Run the installation =
Start your VM and it will boot from the CD image.  Work through the installer in the usual way, entering the install code that the amahi control panel gave created earlier.  You may be asked to reboot a couple of times during the process.  (Note that if you get the initial CD install menu back, you need to disconnect the ISO image and then reboot again.)
+
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 command).
+
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 =
 
= 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:
 
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, Name: vboxnet0
+
* Adapter 1: Enabled, Attached to: Host-only Adapter
 
* Adapter 2: Enabled, Attached to: NAT
 
* Adapter 2: Enabled, Attached to: NAT
  
= Reconfiguring the system =
+
= Reconfiguring the network =
Boot the VM and wait for the login prompt.  Login as admin (default password: admin) and use su to become root.  Using your favourite editor, create the file:
+
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:
  
 
<blockquote><pre>/etc/sysconfig/network-scripts/ifcfg-eth1</pre></blockquote>
 
<blockquote><pre>/etc/sysconfig/network-scripts/ifcfg-eth1</pre></blockquote>
Line 51: Line 80:
 
with the contents:
 
with the contents:
  
<blockquote>
+
{{Text|Text=DEVICE=eth1
<pre>
 
DEVICE=eth1
 
 
BOOTPROTO=dhcp  
 
BOOTPROTO=dhcp  
ONBOOT=yes
+
ONBOOT=yes}}
</pre>
+
 
</blockquote>
+
== For Ubuntu 10.04 ==
 +
Using your favorite editor, open the file:
 +
 
 +
<blockquote><pre>/etc/network/interfaces</pre></blockquote>
 +
 
 +
At the end of the file add:
 +
 
 +
{{Text|Text=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:
 
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:
 +
{{Code|hda-change-gw 192.168.56.1}}
  
<blockquote>
+
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.)
<pre>
 
hda-change-gw 192.168.56.1
 
</pre>
 
</blockquote>
 
  
 
Now reboot.
 
Now reboot.
  
 
= Test it =
 
= Test it =
Wait until the VM comes back up and open a web browser.  Browse to http://192.168.56.1/ 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.   
+
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.
 
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.
Line 77: Line 111:
 
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).
 
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).
  
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''.)
+
== 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 [https://www.amahi.org/user 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 [http://wiki.libvirt.org/page/Virtio here].
 +
 
 +
= Guest Additions (Windows) =
 +
* [http://coffeeonthekeyboard.com/how-to-install-virtualbox-guest-additions-in-fedora-12-332/ How to Install VirtualBox Guest Additions in Fedora 12] has additional info that might be helpful.
 +
 
 +
 
 +
[[Category:Virtualization]]

Latest revision as of 03:50, 16 October 2015

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
​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
​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
​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)