openstack-manuals/doc/training-guides/lab000-virtualbox-basics.xml

662 lines
25 KiB
XML
Raw Blame History

This file contains ambiguous Unicode characters

This file contains Unicode characters that might be confused with other characters. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.

<?xml version="1.0" encoding="utf-8"?>
<!DOCTYPE chapter [
<!ENTITY % openstack SYSTEM "../common/entities/openstack.ent">
%openstack;
]>
<chapter xmlns="http://docbook.org/ns/docbook"
xmlns:xi="http://www.w3.org/2001/XInclude"
xmlns:xlink="http://www.w3.org/1999/xlink"
version="5.0"
xml:id="lab000-virtualbox-basics">
<title>VirtualBox Basics</title>
<para><guilabel>Getting Started</guilabel></para>
<para>The following are the conventional methods of deploying
OpenStack on Virtual Box for the sake of a test/sandbox or just to
try out OpenStack on commodity hardware.</para>
<para>1. DevStack</para>
<para>2. Vagrant</para>
<para>But DevStack and Vagrant bring in some level of automated
deployment as running the scripts will get your VirtualBox
Instance configured as the required OpenStack deployment. We
will be manually deploying OpenStack on VirtualBox Instance to
get better view of how OpenStack works.</para>
<para><guilabel>Prerequisite:</guilabel></para>
<para>Well, its a daunting task to just cover all of OpenStacks
concepts let alone Virtualization and Networking. So some basic
idea/knowledge on Virtualization, Networking and Linux is
required. Even though I will try to keep the level as low as
possible for making it easy for Linux Newbies as well as
experts.</para>
<para>These Virtual Machines and Virtual Networks will be given
equal privilege as a physical machine on a physical
network.</para>
<para>Just for those who would want to do a deeper research or
study, for more information you may refer the following
links</para>
<para><emphasis role="bold">OpenStack:</emphasis>OpenStack
Official Documentation (docs.openstack.org)</para>
<para><emphasis role="bold">Networking:</emphasis>Computer
Networks (5th Edition) by Andrew S. Tanenbaum</para>
<para><emphasis role="bold">VirtualBox:</emphasis>Virtual Box
Manual (http://www.virtualbox.org/manual/UserManual.html)</para>
<para><emphasis role="bold">Requirements :</emphasis></para>
<para>Operating Systems - I recommend Ubuntu Server 12.04 LTS,
Ubuntu Server 13.10 or Debian Wheezy</para>
<para><emphasis role="bold">Note :</emphasis>Ubuntu 12.10 is not
supporting OpenStack Grizzly Packages. Ubuntu team has decided not
to package Grizzly Packages for Ubuntu 12.10.</para>
<itemizedlist>
<listitem>
<para>Recommended Requirements.</para>
</listitem>
</itemizedlist>
<informaltable class="c25">
<tbody>
<tr>
<td rowspan="1" colspan="1">VT Enabled PC:</td>
<td rowspan="1" colspan="1">Intel ix or AMD QuadCore</td>
</tr>
<tr>
<td rowspan="1" colspan="1">4&nbsp;GB RAM:</td>
<td rowspan="1" colspan="1">DDR2/DDR3</td>
</tr>
</tbody>
</informaltable>
<itemizedlist>
<listitem>
<para>Minimum Requirements.</para>
</listitem>
</itemizedlist>
<informaltable class="c25">
<tbody>
<tr>
<td rowspan="1" colspan="1">Non-VT PC's:</td>
<td rowspan="1" colspan="1">Intel Core 2 Duo or Amd Dual
Core</td>
</tr>
<tr>
<td rowspan="1" colspan="1">2GB Ram:</td>
<td rowspan="1" colspan="1">DDR2/DDR3</td>
</tr>
</tbody>
</informaltable>
<para>If you don't know whether your processor is VT enabled, you
could check it by installing cpu checker:</para>
<screen><prompt>#</prompt> <userinput>apt-get install cpu-checker</userinput>
<prompt>#</prompt> <userinput>kvm-ok</userinput></screen>
<para>If your device does not support VT it will show:</para>
<screen><computeroutput>INFO:Your CPU does not support KVM extensions
KVM acceleration can NOT be used</computeroutput></screen>
<para>You will still be able to use Virtual Box but the instances
will be very slow.</para>
<para>There are many ways to configure your OpenStack Setup, we
will be deploying OpenStack Multi Node using OVS as the Network
Plugin and QEMU/ KVM as the hypervisor.</para>
<para><emphasis role="bold">Host Only Connections:</emphasis></para>
<itemizedlist>
<listitem>
<para>Host only connections provide an Internal network
between your host and the Virtual Machine instances up and
running on your host machine.This network is not traceable
by other networks.</para>
</listitem>
<listitem>
<para>You may even use Bridged connection if you have a
router/switch. I am assuming the worst case (one IP without
any router), so that it is simple to get the required
networks running without the hassle of IP tables.</para>
</listitem>
<listitem>
<para>The following are the host only connections that you
will be setting up later on :</para>
</listitem>
</itemizedlist>
<orderedlist>
<listitem>
<para>vboxnet0 - OpenStack Management Network - Host static IP
10.10.10.1</para>
</listitem>
<listitem>
<para>vboxnet1 - VM Conf.Network - Host Static IP
10.20.20.1</para>
</listitem>
<listitem>
<para>vboxnet2 - VM External Network Access (Host
Machine) 192.168.100.1</para>
<para><emphasis role="bold">Network Diagram :</emphasis></para>
</listitem>
</orderedlist>
<figure>
<title>Network Diagram</title>
<mediaobject>
<imageobject>
<imagedata contentwidth="4in" fileref="figures/lab000-virtual-box/image03.png"/>
</imageobject>
</mediaobject>
</figure>
<para>Publicly editable image source at <link
xlink:href="https://docs.google.com/drawings/d/1GX3FXmkz3c_tUDpZXUVMpyIxicWuHs5fNsHvYNjwNNk/edit?usp=sharing"
>https://docs.google.com/drawings/d/1GX3FXmkz3c_tUDpZXUVMpyIxicWuHs5fNsHvYNjwNNk/edit?usp=sharing</link></para>
<para>Vboxnet0, Vboxnet1, Vboxnet2 - are virtual networks setup up
by virtual box with your host machine. This is the way your host
can communicate with the virtual machines. These networks are in
turn used by virtual box VMs for OpenStack networks, so that
OpenStacks services can communicate with each other.</para>
<para><guilabel>Setup Your VM Environment</guilabel></para>
<para>Before you can start configuring your Environment you need to
download some of the following stuff:</para>
<orderedlist>
<listitem>
<para><link xlink:href="https://www.virtualbox.org/wiki/Downloads">
Oracle Virtual Box</link></para>
</listitem>
</orderedlist>
<para>Note:You cannot set up a amd64 VM on a x86 machine.</para>
<orderedlist>
<listitem>
<para><link xlink:href="http://www.ubuntu.com/download/server">
Ubuntu 12.04 Server or Ubuntu 13.04 Server</link></para>
</listitem>
</orderedlist>
<para>Note:You need a x86 image for VM's if kvm-ok fails, even
though you are on amd64 machine.</para>
<para>Note: Even Though I'm using Ubuntu as Host, the same is
applicable to Windows, Mac and other Linux Hosts.</para>
<itemizedlist>
<listitem>
<para>If you have i5 or i7 2nd gen processor you can have VT
technology inside VM's provided by VmWare. This means that
your OpenStack nodes(Which are in turn VM's) will give
positive result on KVM-OK. (I call it - Nesting of type-2
Hypervisors). Rest of the configurations remain same except
for the UI and few other trivial differences.</para>
</listitem>
</itemizedlist>
<para><guilabel>Configure Virtual Networks</guilabel></para>
<itemizedlist>
<listitem>
<para>This section of the guide will help you setup your
networks for your Virtual Machine.</para>
</listitem>
<listitem>
<para>Launch Virtual Box</para>
</listitem>
</itemizedlist>
<itemizedlist>
<listitem>
<para>Click on <emphasis role="bold"
>File>Preferences</emphasis> present on the menu bar of
Virtual Box.</para>
</listitem>
<listitem>
<para>Select the <emphasis role="bold">Network
tab</emphasis>.</para>
</listitem>
<listitem>
<para>On the right side you will see an option to add
Host-Only networks.</para>
</listitem>
</itemizedlist>
<figure>
<title>Create Host Only Networks</title>
<mediaobject>
<imageobject>
<imagedata fileref="figures/lab000-virtual-box/image13.png"
contentwidth="6in"/>
</imageobject>
</mediaobject>
</figure>
<itemizedlist>
<listitem>
<para>Create three Host-Only Network Connections. As shown
above.</para>
</listitem>
<listitem>
<para>Edit the Host-Only Connections to have the following
settings.</para>
</listitem>
</itemizedlist>
<para><emphasis role="bold">Vboxnet0</emphasis></para>
<informaltable class="c25">
<tbody>
<tr>
<th rowspan="1" colspan="1">Option</th>
<th rowspan="1" colspan="1">Value</th>
</tr>
<tr>
<td rowspan="1" colspan="1">IPv4 Address:</td>
<td rowspan="1" colspan="1">10.10.10.1</td>
</tr>
<tr>
<td rowspan="1" colspan="1">IPv4 Network Mask:</td>
<td rowspan="1" colspan="1">255.255.255.0</td>
</tr>
<tr>
<td rowspan="1" colspan="1">IPv6 Address:</td>
<td rowspan="1" colspan="1">Can be Left Blank</td>
</tr>
<tr>
<td rowspan="1" colspan="1">IPv6 Network Mask Length :</td>
<td rowspan="1" colspan="1">Can be Left Blank</td>
</tr>
</tbody>
</informaltable>
<figure>
<title>Vboxnet0</title>
<mediaobject>
<imageobject>
<imagedata fileref="figures/lab000-virtual-box/image19.png"
contentwidth="6in"/>
</imageobject>
</mediaobject>
</figure>
<para><emphasis role="bold">Vboxnet1</emphasis></para>
<informaltable class="c25">
<tbody>
<tr>
<th rowspan="1" colspan="1">Option</th>
<th rowspan="1" colspan="1">Value</th>
</tr>
<tr>
<td rowspan="1" colspan="1">IPv4 Address:</td>
<td rowspan="1" colspan="1">10.20.20.1</td>
</tr>
<tr>
<td rowspan="1" colspan="1">IPv4 Network Mask:</td>
<td rowspan="1" colspan="1">255.255.255.0</td>
</tr>
<tr>
<td rowspan="1" colspan="1">IPv6 Address:</td>
<td rowspan="1" colspan="1">Can be Left Blank</td>
</tr>
<tr>
<td rowspan="1" colspan="1">IPv6 Network Mask Length :</td>
<td rowspan="1" colspan="1">Can be Left Blank</td>
</tr>
</tbody>
</informaltable>
<figure>
<title>Vboxnet1</title>
<mediaobject>
<imageobject>
<imagedata fileref="figures/lab000-virtual-box/image16.png"
contentwidth="6in"/>
</imageobject>
</mediaobject>
</figure>
<para><emphasis role="bold">Vboxnet2</emphasis></para>
<informaltable class="c25">
<tbody>
<tr>
<th rowspan="1" colspan="1">Option</th>
<th rowspan="1" colspan="1">Value</th>
</tr>
<tr>
<td rowspan="1" colspan="1">IPv4 Address:</td>
<td rowspan="1" colspan="1">192.168.100.1</td>
</tr>
<tr>
<td rowspan="1" colspan="1">IPv4 Network Mask:</td>
<td rowspan="1" colspan="1">255.255.255.0</td>
</tr>
<tr>
<td rowspan="1" colspan="1">IPv6 Address:</td>
<td rowspan="1" colspan="1">Can be Left Blank</td>
</tr>
<tr>
<td rowspan="1" colspan="1">IPv6 Network Mask Length :</td>
<td rowspan="1" colspan="1">Can be Left Blank</td>
</tr>
</tbody>
</informaltable>
<figure>
<title>Image: Vboxnet2</title>
<mediaobject>
<imageobject>
<imagedata fileref="figures/lab000-virtual-box/image08.png"
contentwidth="6in"/>
</imageobject>
</mediaobject>
</figure>
<para><guilabel>Install SSH and FTP</guilabel></para>
<itemizedlist>
<listitem>
<para>You may benefit by installing SSH and FTP so that you
could use your remote shell to login into the machine and
use your terminal which is more convenient that using the
Virtual Machines tty through the Virtual Box's UI. You get a
few added comforts like copy - paste commands into the
remote terminal which is not possible directly on VM.</para>
</listitem>
<listitem>
<para>FTP is for transferring files to and fro ... you can
also use SFTP or install FTPD on both HOST and VM's.</para>
</listitem>
<listitem>
<para>Installation of SSH and FTP with its configuration is
out of scope of this GUIDE and I may put it up but it
depends upon my free time. If someone wants to contribute to
this - please do so.</para>
</listitem>
</itemizedlist>
<para><emphasis role="bold">Note:</emphasis>Please set up the
Networks from inside the VM before trying to SSH and FTP into the
machines. I would suggest setting it up at once just after the
installation of the Server on VM's is over.</para>
<para><guilabel>Install Your VM's Instances</guilabel></para>
<itemizedlist>
<listitem>
<para>During Installation of The Operating Systems you will be
asked for Custom Software to Install , if you are confused
or not sure about this, just skip this step by pressing
Enter Key without selecting any of the given Options.</para>
</listitem>
</itemizedlist>
<para><emphasis role="bold">Warning</emphasis> - Please do not
install any of the other packages except for which are mentioned
below unless you know what you are doing. There is a good chance
that you may end up getting unwanted errors, package conflicts ...
due to the same.</para>
<para><guilabel>Control Node:</guilabel></para>
<para>Create a new virtual machine. Select Ubuntu Server</para>
<figure>
<title>Create New Virtual Machine</title>
<mediaobject>
<imageobject>
<imagedata fileref="figures/lab000-virtual-box/image11.png"
contentwidth="6in"/>
</imageobject>
</mediaobject>
</figure>
<para>Select the appropriate amount of RAM. For the control node,
the minimum is 512&nbsp;MB of RAM. For other settings, use the
defaults. The hard disk size can be 8&nbsp;GB as default.</para>
<para>Configure the networks</para>
<para>(Ignore the IP Address for now, you will set it up from
inside the VM)</para>
<informaltable class="c25">
<tbody>
<tr>
<th rowspan="1" colspan="1">Network Adapter</th>
<th rowspan="1" colspan="1">Host-Only Adapter Name</th>
<th rowspan="1" colspan="1">IP Address</th>
</tr>
<tr>
<td rowspan="1" colspan="1">eth0</td>
<td rowspan="1" colspan="1">Vboxnet0</td>
<td rowspan="1" colspan="1">10.10.10.51</td>
</tr>
<tr>
<td rowspan="1" colspan="1">eth1</td>
<td rowspan="1" colspan="1">Vboxnet2</td>
<td rowspan="1" colspan="1">192.168.100.51</td>
</tr>
<tr>
<td rowspan="1" colspan="1">eth2</td>
<td rowspan="1" colspan="1">NAT</td>
<td rowspan="1" colspan="1">DHCP</td>
</tr>
</tbody>
</informaltable>
<para><emphasis role="bold">Adapter 1 (Vboxnet0)</emphasis></para>
<figure>
<title>Adapter1 - Vboxnet0</title>
<mediaobject>
<imageobject>
<imagedata fileref="figures/lab000-virtual-box/image07.png"
contentwidth="6in"/>
</imageobject>
</mediaobject>
</figure>
<para><emphasis role="bold">Adapter 2 (Vboxnet2)</emphasis></para>
<figure>
<title>Adapter2 - Vboxnet2</title>
<mediaobject>
<imageobject>
<imagedata fileref="figures/lab000-virtual-box/image18.png"
contentwidth="6in"/>
</imageobject>
</mediaobject>
</figure>
<para><emphasis role="bold">Adapter 3 (NAT)</emphasis></para>
<figure>
<title>Adapter3 - NAT</title>
<mediaobject>
<imageobject>
<imagedata fileref="figures/lab000-virtual-box/image14.png"
contentwidth="6in"/>
</imageobject>
</mediaobject>
</figure>
<para>Now Install Ubuntu Server 12.04 or 13.04 on this
machine.</para>
<para><emphasis role="bold">Note :</emphasis>Install SSH server
when asked for Custom Software to Install. Rest of the packages
are not required and may come in the way of OpenStack packages -
like DNS servers etc. (not necessary). Unless you know what you
are doing.</para>
<para><guilabel>Network Node:</guilabel></para>
<para>Create a new Virtual Machine,</para>
<para>Minimum RAM is 512&nbsp;MB. Rest all can be left default. Minimum
HDD space 8&nbsp;GB.</para>
<figure>
<title>Create New Virtual Machine</title>
<mediaobject>
<imageobject>
<imagedata fileref="figures/lab000-virtual-box/image12.png"
contentwidth="6in"/>
</imageobject>
</mediaobject>
</figure>
<para>Configure the networks</para>
<para>(Ignore the IP Address for now, you will set it up from
inside the VM)</para>
<informaltable class="c25">
<tbody>
<tr>
<th rowspan="1" colspan="1">Network Adapter</th>
<th rowspan="1" colspan="1">Host-Only Adapter Name</th>
<th rowspan="1" colspan="1">IP Address</th>
</tr>
<tr>
<td rowspan="1" colspan="1">eth0</td>
<td rowspan="1" colspan="1">Vboxnet0</td>
<td rowspan="1" colspan="1">10.10.10.52</td>
</tr>
<tr>
<td rowspan="1" colspan="1">eth1</td>
<td rowspan="1" colspan="1">Vboxnet1</td>
<td rowspan="1" colspan="1">10.20.20.52</td>
</tr>
<tr>
<td rowspan="1" colspan="1">eth2</td>
<td rowspan="1" colspan="1">Vboxnet2</td>
<td rowspan="1" colspan="1">192.168.100.52</td>
</tr>
<tr>
<td rowspan="1" colspan="1">eth3</td>
<td rowspan="1" colspan="1">NAT</td>
<td rowspan="1" colspan="1">DHCP</td>
</tr>
</tbody>
</informaltable>
<para><emphasis role="bold">Adapter 1 (Vboxnet0)</emphasis></para>
<figure>
<title>Adapter 1 - Vboxnet0</title>
<mediaobject>
<imageobject>
<imagedata fileref="figures/lab000-virtual-box/image05.png"
contentwidth="6in"/>
</imageobject>
</mediaobject>
</figure>
<para><emphasis role="bold">Adapter 2 (Vboxnet1)</emphasis></para>
<figure>
<title>Adapter2 - Vboxnet1</title>
<mediaobject>
<imageobject>
<imagedata fileref="figures/lab000-virtual-box/image17.png"
contentwidth="6in"/>
</imageobject>
</mediaobject>
</figure>
<para><emphasis role="bold">Adapter 3 (Vboxnet2)</emphasis></para>
<figure>
<title>Adapter3 - Vboxnet2</title>
<mediaobject>
<imageobject>
<imagedata fileref="figures/lab000-virtual-box/image02.png"
contentwidth="6in"/>
</imageobject>
</mediaobject>
</figure>
<para><emphasis role="bold">Adapter 4 (NAT)</emphasis></para>
<figure>
<title>Adapter4 - NAT</title>
<mediaobject>
<imageobject>
<imagedata fileref="figures/lab000-virtual-box/image00.png"
contentwidth="6in"/>
</imageobject>
</mediaobject>
</figure>
<para>Now Install Ubuntu Server 12.04 or 13.04 on this
machine.</para>
<para><emphasis role="bold">Note :</emphasis>Install SSH server
when asked for Custom Software to Install. Rest of the packages
are not required and may come in the way of OpenStack packages -
like DNS servers etc. (not necessary). Unless you know what you
are doing.</para>
<para><guilabel>Compute Node:</guilabel></para>
<para>Create a virtual machine with at least 1,000&nbsp;MB RAM and
8&nbsp;GB HDD. For other settings, use the defaults.</para>
<figure>
<title>Create New Virtual Machine</title>
<mediaobject>
<imageobject>
<imagedata fileref="figures/lab000-virtual-box/image04.png"
contentwidth="6in"/>
</imageobject>
</mediaobject>
</figure>
<para>Configure the networks</para>
<para>(Ignore the IP Address for now, you will set it up from
inside the VM)</para>
<informaltable class="c25">
<tbody>
<tr>
<th rowspan="1" colspan="1">Network Adapter</th>
<th rowspan="1" colspan="1">Host-Only Adapter Name</th>
<th rowspan="1" colspan="1">IP Address</th>
</tr>
<tr>
<td rowspan="1" colspan="1">eth0</td>
<td rowspan="1" colspan="1">Vboxnet0</td>
<td rowspan="1" colspan="1">10.10.10.53</td>
</tr>
<tr>
<td rowspan="1" colspan="1">eth1</td>
<td rowspan="1" colspan="1">Vboxnet1</td>
<td rowspan="1" colspan="1">10.20.20.53</td>
</tr>
<tr>
<td rowspan="1" colspan="1">eth2</td>
<td rowspan="1" colspan="1">NAT</td>
<td rowspan="1" colspan="1">DHCP</td>
</tr>
</tbody>
</informaltable>
<para><emphasis role="bold">Adapter 1 (Vboxnet0)</emphasis></para>
<figure>
<title>Adapter1 - Vboxnet0</title>
<mediaobject>
<imageobject>
<imagedata fileref="figures/lab000-virtual-box/image15.png"
contentwidth="6in"/>
</imageobject>
</mediaobject>
</figure>
<para><emphasis role="bold">Adapter 2 (Vboxnet1)</emphasis></para>
<figure>
<title>Adapter2 - Vboxnet1</title>
<mediaobject>
<imageobject>
<imagedata fileref="figures/lab000-virtual-box/image10.png"
contentwidth="6in"/>
</imageobject>
</mediaobject>
</figure>
<para><emphasis role="bold">Adapter 3 (NAT)</emphasis></para>
<figure>
<title>Adapter3 - NAT</title>
<mediaobject>
<imageobject>
<imagedata fileref="figures/lab000-virtual-box/image01.png"
contentwidth="6in"/>
</imageobject>
</mediaobject>
</figure>
<para>Now Install Ubuntu Server 12.04 or 13.04 on this
machine.</para>
<para><emphasis role="bold">Note :</emphasis>Install SSH server
when asked for Custom Software to Install. Rest of the packages
are not required and may come in the way of OpenStack packages -
like DNS servers etc. (not necessary). Unless you know what you
are doing.</para>
<para><guilabel>Warnings/Advice :</guilabel></para>
<itemizedlist>
<listitem>
<para>Well there are a few warnings that I must give you out
of experience due to common habits that most people may
have :</para>
</listitem>
</itemizedlist>
<para>Sometimes shutting down your Virtual Machine may lead to
malfunctioning of OpenStack Services. Try not to direct
shutdown your 3. In case your VM's don't get internet.</para>
<itemizedlist>
<listitem>
<para>From your VM Instance, use <command>ping</command>
command to see whether Internet is on.</para>
<screen><prompt>$</prompt> <userinput>ping www.google.com</userinput></screen>
</listitem>
<listitem>
<para>If its not connected, restart networking
service:</para>
<screen><prompt>#</prompt> <userinput>service networking restart</userinput>
<prompt>#</prompt> <userinput>ping www.google.com</userinput></screen>
</listitem>
<listitem>
<para>If this doesn't work, you need to check your network
settings from Virtual Box, you may have left something or
misconfigured it.</para>
</listitem>
<listitem>
<para>This should reconnect your network about 99% of the
times. If you are really unlucky you must be having some
other problems or your Internet connection itself is not
functioning.</para>
</listitem>
<listitem>
<para>Note :There are known bugs with the ping under NAT.
Although the latest versions of Virtual Box have better
performance, sometimes ping may not work even if your
Network is connected to internet.</para>
</listitem>
</itemizedlist>
<para>Congrats, you are ready with the infrastructure for
deploying OpenStack. Just make sure that you have installed
Ubuntu Server on the above setup Virtual Box Instances. In the
next section we will go through deploying OpenStack using the
above created Virtual Box instances.</para>
</chapter>