HOWTO use VirtualBox to run simulations on Windows machines: Difference between revisions

From Nsnam
Jump to navigation Jump to search
(New page: {{TOC}} ns-3 is primarily a Linux platform and advanced ns-3 features will use Linux specific functions to accomplish their goals. Since Windows is such as widely used platorm, ns-3 does...)
 
(Add link to configure 64-bit VMs on 64-bit Windows 8 or 10 host machines)
 
(66 intermediate revisions by 2 users not shown)
Line 1: Line 1:
{{TOC}}
{{TOC}}


ns-3 is primarily a Linux platform and advanced ns-3 features will use Linux
ns-3 is primarily a Linux platform, and advanced ns-3 features will use Linux specific functions to accomplish their goals.  Since Windows is such a widely used platform, ns-3 does provide a supported solution for running in that environment using a Linux-emulation environment called [http://cygwin.com Cygwin]. However, Cygwin is not a perfect emulation of any Linux.  This means there will be features available on Linux systems that are simply not usable on Windows systems.
specific functions to accomplish their goals.  Since Windows is such as widely
used platorm, ns-3 does provide a supported solution for running in that  
environment using a Linux-emulation environment called [[http://cygwin.com Cygwin]].
However, Cygwin is not a perfect emulation of any Linux.  This means there will  
be features available on Linux systems that are simply not usable on Windows  
systems.


Fortnately, a technology called virtualization exists to allow one to share
Fortunately, a technology called virtualization exists to allow one to share computer hardware between operating systems and allow you use Linux systems essentially as if they were running natively on your hardware.  This happens as your Windows is running, so it appears as if Windows and Linux are sharing your hardware.
computer hardware between operating systems and allow you use Linux systems
essentially as if they were running natively on your hardware.  This happens as
your Windows is running, so it appears as if Windows and Linux were sharing
your hardware.


There are several virtualization schemes currently available.  Two of the most
There are several virtualization schemes currently available.  Two of the most popular are VMware (see [[HOWTO use VMware to set up virtual networks (Windows)]]) and VirtualBox.  We will cover VirtualBox in this HOWTO.  The following image is a screenshot of Fedora running as a virtual machine on a Windows XP (classic) desktop.  You can probably make out that the terminal session on Fedora has just completed running the ns-3 test suite (test.py).
popular are VMware (see  
 
================================================================================
[[Image:Screenshot_fc11.png]]
 
There is extensive documentation available online for VirtualBox.  Look [http://www.virtualbox.org/ here] for a starting point. Note that by downloading the VirtualBox code you are implicitly agreeing to  [http://www.virtualbox.org/wiki/VirtualBox_PUEL this license].
 
If you are using a 64-bit Windows 8 or 10 host machine, follow [http://www.fixedbyvonnie.com/2014/11/virtualbox-showing-32-bit-guest-versions-64-bit-host-os/#.WXBmZoSPLIU this tutorial] in order to configure 64-bit virtual machines (or even have access to the virtual cores of the host in the VirtualBox configuration window).


== HOWTO use VirtualBox to run simulations on Windows machines ==
== HOWTO use VirtualBox to run simulations on Windows machines ==


1.  Get the VMware server software
1.  The first thing you must do is get the VirtualBox binaries.
    a.  You may read in various release notes or documentation that you need
     a.  Go to [http://www.virtualbox.org/wiki/Downloads the VirtualBox downloads page]
        Microsoft servers of various kinds.  This is not the case. You can
     bDownload and run the VirtualBox binary for Windows Hosts by clicking on
        run VMware server on XP just fine;
        the x86/amd64 linkYou will get the usual '''File Download - Security'''
     b.  Go to http://www.vmware.com/download/server/ to get the software;
        '''Warning''' dialogJust click '''Run''' to download and run the about  
     cSelect the Download Now button (download as usual);
        70 megabyte file.
    dInstall the software in the usual way;
     cAfter the file downloads, you will get the usual Windows '''Internet'''
    eIgnore warnings about requiring Microsoft IIS to continue.
        '''Explorer - Security Warning''' dialogJust select '''Run'''.
2. Request a Serial Number
 
     a.  Go to http://register.vmware.com/content/registration.html
2Step through the '''Sun VirtualBox Setup Wizard'''.
    bFill out the page and select "Submit";
     a.  Press the '''Next >''' button.
    c.  You will be redirected to a page with your new serial number;
     b.  Accept the terms of the license agrreement (if you desire) by clicking
    d.  Copy the serial number;
         the corresponding radio button.
    e.  Run the VMware server;
     c.  Press the '''Next >''' button.
    f.  Select the menu item Help->Enter Serial Number ...
     d.  Review the features that will be installed if you desireI just accept
    gPaste in the new serial number.
         them as-is.
3.  Install a Virtual Machine
     e.  Press the '''Next >''' button.
     a.  Exit the VMware Server.
     f.  Decide if you want a desktop and quick lanch icon.  If you expect to  
     b.  We prefer Ubuntu JeOS (Just enough OS).  You can download the code from
         use ns-3 a lot it is probably worthwhile, but completely up to your  
        the VMware "Virtual Appliance Marketplace" by going to
         preference.
        http://www.vmware.com/appliances/directory/1136 and selecting "Download
     gPress the '''Next >''' button.
         this Appliance" link from the "Download" box to the right of the
 
        appliance name (Ubuntu 7.10 JeOS v1.031 with VMware drivers (70MB));
3Perform the actual installationWarning: This step will temporarily disconnect you from the Internet.
     c.  Download the appliance and unzip the file.  You should have a directory
     aPress the '''Install''' button to start the installation process.
        named "ub710jeos".  Copy this directory to the "c:\Virtual Machines"
     bYou will see a number of dialog boxes (six) complaining that VirtualBox
        (VMware) directory.
        has not passed '''Windows Logo Testing'''Press '''Continue Anyway'''.
     d.  Run the VMware serverIf you get a complaint about not having a disk
     cWhen you see the '''Sun VirtualBox installation is complete''' message
         in your CD-ROM, just continue;
         leave the '''Start Sun VirtualBox after installation''' radio button
     e.  Select the "Local Host" radio button and press "OK";
        selected.
     f.  Select the File->Open menu option and Browse for the 
     dPress the '''Finish''' button.
        "ub710jeos" directory and open the "ub710jeos.vmx" file;
 
5.  Start the new Virtual Machine
4Register with Sun OnlineVirtualBox will ask you to register with Sun Online.   If you already have a Sun Online account, enter it or just fill out the account creation part of the page and press '''Register'''If the registration process complains about a bad IP address, just create a new account.
    a.  Select the "Start this virtual machine" command on the VMware Server
        Console;
    b.  You will get a dialog box asking about a new UUID.  Select the "Create"
        radio button and press "OK";
    c. Ubuntu JeOS will start in a "console window." If you want to type into
         the JeOS VM, you must click your mouse in the console window.  If you
         want to exit to Windows, press <ctrl>+<alt> and you will pop out of
        the VM;
    d. Login as user: root, password root;
     eChange the password (passwd)if you are connected to the real world and
        like your system intact.
    f.  Ping www.google.com to test network connectivity.
5Freshen the Software Distribution
    aapt-get update
    b. apt-get install
    c. apt-get install pkg-config libxml2 libxml2-dev
     dapt-get install gcc g++ make automake autoconf binutils
    e. apt-get install openssh-server openssh-client openssl libssl-dev
     fapt-get install python-dev mercurial
    g.  apt-get install tcpdump gdb emacs
    h.  exit
6.  Log in as User (Appliance comes pre-configured with one user)  
    alog in as user: user, password user
     bChange your password (passwd) if you are connected to the real world and
         like your system intact
7. Get and Test ns-3-dev
     amkdir repos
    b. cd repos
    c.  hg clone http://code.nsnam.org/ns-3-dev
    dcd ns-3-dev
    e.  ./waf configure -d debug
    f.  ./waf
    g.  ./waf --regression


As an old math professor once said, "I feel joy"!
----
Sidebar:  In this HOWTO, we explain how to download a CD image from the web and use it to install a guest operating system in VirtualBox.  There is an alternative, which is to start with a pre-configured OS "Virtual Applicance." These are VMware things, but VirtualBox can read them. You can browse through hundreds of applicances [http://www.vmware.com/appliances/directory/cat/508 here].
----


Now it's time for a breatherYou have a configured Ubuntu JeOS Virtual Machine
5.  Download a Linux CD image.
and you've built and tested ns-3 on itNow might be a good time to copy this
    a.  Decide which version of Linux you are going to use.  If you have no
VM somewhere safe as your base machineIf you want to clone your machine you can
        strong preference, I would use the same version that ns-3 does most
use this copy, or if you manage to wedge the VM, you can use the copy as a
        of its testing on.  Look [http://www.nsnam.org/wiki/index.php/Main_Page here] for the ns-3 wiki.  Follow the
checkpoint and restore a working copy without going through all the pain we just
        [http://ns-regression.ee.washington.edu:8010/waterfall Buildbot Waterfall Display] link, and notice the list of platforms. 
suffered through.  
        At the time of this writing, most of them are fc10.  This translates
        to Fedora Core 10You can infer that ns-3 testing is mostly performed
        on Fedora systems, so Fedora it is; and Fedora 12 is the latest release
        as of this writing.
    b.  Go to [http://fedoraproject.org/ The Fedora Project] and then to [http://fedoraproject.org/en/get-fedora Get Fedora] and download a
        CD image.  You will get the usual '''File Download - Do you want to open'''
        '''or save this file?''' dialog.  Just click '''Save''' and tell the system
        where to put the almost 700 megabyte file.


8Checkpoint the VM
6Create a new virtual machine.
     a.  log out of the VM (exit);
    a.  Go to the Sun VirtualBox window you started in step 3.
     b.  Press the red rectangle (stop) button on the VMware Server Console;
    b.  Press the "New" button.  This will start a '''New Virtual Machine Wizard'''.
     cOpen My Computer/Virtual Machines
    c.  Press '''Next >''' in the wizard.
     dCopy "ub710jeos" to "ub710jeos checkpoint"
     d.  Give your new virtual machine a name, say "ns-3-fedora-12".
    e.  In the '''OS Type''' box, select '''Linux''' as the Operating System and
        '''Fedora''' as the Version.
    f.  Press '''Next >''' in the wizard.
    g.  Keeping in mind how much physical memory you have in your host machine,
        give the new virtual machine some memory.  This won't be available for
        your host machine.  I choose 512 MB on my 2 GB Windows machine.
    h.  Press '''Next >''' in the wizard.
    i.  Keeping in mind how much hard disk space you have in your host machine
        give the new virtual machine some memoryYou will need disk for the
        base OS, the toolchain and at least one ns-3 distribution, which will
        require about 1.2 gig at the time of this writing.
    j.  Press '''Next >''' in the '''New Virtual Machine Wizard''' to start the
        '''Create New Virtual Disk Wizard'''.
     k.  Press '''Next >''' in the '''Create New Virtual Disk Wizard'''.
    l.  Leave the '''Dynamically expanding storage''' radio button selected and
        press '''Next >''' in the '''Create New Virtual Disk Wizard'''.
    m.  Select a maximum size for the disk (I use 10 GB) and press '''Next >'''
        in the '''Create New Virtual Disk Wizard'''.
     oPress '''Finish''' in the '''Create New Virtual Disk Wizard''' to create
        your disk.
     p.  This takes you back to the '''New Virtual Machine Wizard''' which will
        be giving you a summary of the new virtual machine parametersPress
        '''Finish''' in the '''Create New Virtual Disk Wizard''' to create
        your new virtual machine.


Now it's time to start creating that test network that was the reason we started
7.  "Insert" your boot CD.  In the Sun VirtualBox window, you should now see avirtual machine named "ns-3-fedora-12" in the powered off state on the left side.  On the right side, you should see the "Details" tab selected, with the details for "ns-3-fedora-12" displayed.
this processWe'll use the checkpointed VM we just made and copy it to begin.
    a.  Click on the '''Storage''' item.
    b.  Under '''Storage Tree''' box, '''IDE Controller''', select the secondary master
        which should say '''Empty''' at this point.
    c.  Under the '''Attributes''' item there is a pulldown labeled '''CD/DVD Device'''.
        Select the folder icon to the rightThis will load the VirtualBox
        '''Virtual Media Manager'''.
    d.  Select the '''Add''' action and navigate to the folder in which you saved the
        Fedora 12 iso image above.  Select the iso image which will '''insert''' it
        as if it were a real CD.
    e.  Press OK to return to the main VirtualBox window.


9Create new VM with a Private Network
8Power up the virtual machine and install Fedora 12.
     a.  Copy "c:\Virtual Machines\ub710jeos checkpoint" to another directory in
     a.  Select the '''Start''' icon in the Sun VirtualBox window.  It is shaped like
         the "Virtual Machines" directory and call it "ns-3-test-1"
         a green arrow.
     b.  Select the File->Open menu option and Browse for the
     b.  Read the information dialog about how to get in and out of the virtual
         "ns-3-test-1" directory and open the "ub710jeos.vmx" file;
         machine window and press '''OK'''.
     eSelect the "Edit virtual machine settings" command on the VMware Server
     cRead the information dialog about color mode and press '''OK'''.
        Console;
     d.  Click into the new virtual machine window, select '''Capture''' and
     d.  Click on the "Options" tab;
        watch Fedora 12 start to install (this will take a while).
    e.  Enter "ns-3-test-1" in the "Virtual machine name" text box;
     eWhen the login box appears, press "Log In" and then double click the  
    f. Click on the "Hardware" tab;
        '''Install to Hard Disk''' icon.
     gClick on the "Add" button.  You will launch the "Add Hardware Wizard";
     fPress '''Next''' to begin the Fedora 12 installation process and copy the
    h. Click "Next";
         image to the virtual machine hard driveThis is going to take some
     iClick "Ethernet Adapter" and then "Next";
        considerable time since you are installing a whole operating system.
    j.  Click the "Host Only:  A private network shared with the host" radio
        We won't cover how to proceed here in detail since this is not a Fedora
         button and then "Next";
         12 installation guideDo remember that you will have to initialize your
    kClick "OK";
         virtual hard disk since you just "created" itGoogle is your friend if
    l. Select the "Start this virtual machine" command on the VMware Server
        you have problems.
         Console;
     gEventually you'll see "Congratulations, your Fedora installation is
    mYou will get a dialog box asking about a new UUID.  Select the "Create"
        complete"Press '''Close'''.
         radio button and press "OK";
     hShut down the Fedora system.
    nUbuntu JeOS will start in a "console window."
     oLog in as root (you changed the password, right?)
    pEdit (vi) "/etc/network/interfaces" and add the following lines
        '''''before''''' the similar delcaration of the primary network interface:
            # The private network interface
            auto eth1
            iface eth1 inet dhcp
    q. Edit (vi) /etc/hosts and replace instances of "ub710jeos" with
        "ns-3-test-1";
     r.  Edit (vi) /etc/hostname and replace "ub710jeos" with "ns-3-test-1";
    s.  Change the host hame by executing "hostname ns-3-test-1";
    t.  Log out of the VM;
    uPress the red square (stop) button on the VMware Server Console to
        stop the VM.


Now you have one VM with a private network on itYou can repeat step nine
9.  "Remove" your boot CDIn the Sun VirtualBox window, you should now see a virtual machine named "ns-3-fedora-12" in the powered off state on the left side.  On the right side, you should see the "Details" tab selected, with the details for "ns-3-fedora-12" displayed.
as many times as you want, renaming the VMs ns-3-test-2, ns-3-test-3, etcGo
    aClick on the '''Storage''' item.
ahead and make a ns-3-test-2 virtual machine just so we can do something
    b.  Click on the '''Fedora-12-i686-Live.iso''' CD in the '''IDE Controller''' under '''Storage Tree'''.
interesting.
    c.  Select '''Empty''' under the '''CD/DVD Device''' pulldown.
    d.  Press '''OK'''.


10. Start Your Virtual Test Network
10. Bring up your shiny new Fedora 12 system.
     a.  Select the "ns-3-test-1" tab on the VMware Server Console;
     a.  Select the '''Start''' icon in the Sun VirtualBox windowIt is shaped like
    bSelect the "Start this virtual machine" command on the VMware Server
         a green arrow.
         Console;
     b.  You'll have to do a few more setup steps (create a user) in the Fedora
    c. Ubuntu JeOS will start in a "console window";
        '''Setup Agent'''This will reboot one more time and then you can log
     d.  You should see an "ns-3-test-1 login" prompt when it comes up;
         in with your new user name.
    e.  Select the "ns-3-test-2" tab on the VMware Server Console;
    fSelect the "Start this virtual machine" command on the VMware Server
         Console;
    g.  Ubuntu JeOS will start in a "console window."
    h.  You should see an "ns-3-test-2 login" prompt when it comes up;


You can now switch between the running virtual machines by selecting the  
11. Install the GNU toolchain and some useful tools.  If you have added yourself as a sudoer, you can run the following commands (or others according to your taste) using sudo, otherwise log on as rootA more complete list is available [http://www.nsnam.org/wiki/index.php/Installation#Prerequisites here].
appropriate tab on the VMware Server ConsoleEnter a VM by clicking in the
    a.  yum install libxml2 libxml2-devel
console window and exit by pressing <ctrl>+<alt>Select another tab of a
    b.  yum install gcc gcc-c++ make automake autoconf binutils
running VM and enter that VM by clicking in the console window.  
    c.  yum install openssh-server openssh-clients openssl
    d.  yum install python python-devel mercurial bzr
    eyum install scons flex bison
    f. yum install tcpdump valgrind gdb emacs


12. Update /etc/hosts and Check Connectivity
12. Get and Test ns-3-dev
     a.  Log in to "ns-3-test-1" as root;
     a.  Make sure you have exited from su root, if you did that in step 11.
     b.  Run ifconfig -a and note the IP address of eth1;
     b.  cd ~
     c.  Log in to "ns-3-test-2" as root;
     c.  mkdir repos
     d.  Run ifconfig -a and note the IP address of eth1;
     d.  cd repos
     e.  Edit (vi) "/etc/hosts" on "ns-3-test-1" and add an appropriate line
     e.  hg clone http://code.nsnam.org/ns-3-allinone
        for "ns-3-test-2"On my machine it is
    fcd ns-3-allinone
        "192.168.136.129 ns-3-test-2";
     g./download.py
     fEdit (vi) "/etc/hosts" on "ns-3-test-2" and add an appropriate line
    h.  ./build.py
        for "ns-3-test-1"On my machine it is
    i. cd ns-3-dev
        "192.168.136.128 ns-3-test-1";
     j./test.py
     gOn ns-3-test-1 run "ping ns-3-test-2" to verify;
     k./waf --regression
     hOn ns-3-test-2 run "ping ns-3-test-1" to verify;


At this point, you probably will want to set up users, shells, aliases, other
As an old math professor once said, "I feel joy"!
tools (emacs, ddd, etc) or whatever else you will be needing.  For example,
I set up a new user to match my user name on all of the other ns-3-related
machines I work with, set the shell to bash, copied over my aliases, ssh keys,
etc., etc., yadda, yadda.


CAVEATS
If you are really going to use a virtual machine as a primary development platform, you will probably be annoyed by the limitation of the device driver to 800x600 resolution.  You can fix this by installing the so-called VirtualBox Guest Additions.  This will aso get rid of the annoying "mouse capture" and "mouse release" business.  If you install the Guest Additions, you can resize your virtual desktop to any size you want and mouse in and out of it just as if you were in a Windows window. Recommended. The screen shot at the top of the page was taken of a my home system which has these additions enabledSee the VirtualBox documentation for instructions, perhaps starting [http://www.virtualbox.org/manual/UserManual.html#id2507643 here] in the user manual.
    a.  Be careful about carelessly using disk space in these VMs.  We have
        intentionally limited the size of the backing disk file to 1 GB so we
        don't consume all of your Windows resources.  This does mean that you
        will be limited to perhaps one or two full builds of ns-3 with regression
        traces depending on what other stuff you install.  If you run out of
        disk, you can increase it using VMware tools installed for you in the
        Windows "Command Prompt."
        i.   Open your "Command Prompt";
        iiChange into "C:\Program Files\VMWare\VMware Server;
        iii. There is an executable there named "vmware-vdiskmanager.exe";
        iv. Find the full path to the disk image file you want to increase;
        v.  Increase the disk size using the following recipe:
            vmware-vdiskmanager -x 16GB "C:\Virtual Machines\ns-3-test-1\ub710jeos.vmdk"


Congratulations, you are now ns-3 emulation ready.
Note that if you installed Fedora 12, you may have to freshen your distribution to get this to work (if you see modprobe errors); and you may have to set KERN_DIR yourself to "/usr/src/kernels/'''your kernel version'''".  Hopefully this will get resolved as the Fedora 12 and VirtualBox combination is fully sorted.


[[User:Craigdo|Craigdo]] 16:17, 6 August 2008 (EDT)
----
[[User:Craigdo|Craigdo]] 03:13, 9 February 2010 (UTC)

Latest revision as of 09:02, 20 July 2017

Main Page - Roadmap - Summer Projects - Project Ideas - Developer FAQ - Tools - Related Projects

HOWTOs - Installation - Troubleshooting - User FAQ - Samples - Models - Education - Contributed Code - Papers

ns-3 is primarily a Linux platform, and advanced ns-3 features will use Linux specific functions to accomplish their goals. Since Windows is such a widely used platform, ns-3 does provide a supported solution for running in that environment using a Linux-emulation environment called Cygwin. However, Cygwin is not a perfect emulation of any Linux. This means there will be features available on Linux systems that are simply not usable on Windows systems.

Fortunately, a technology called virtualization exists to allow one to share computer hardware between operating systems and allow you use Linux systems essentially as if they were running natively on your hardware. This happens as your Windows is running, so it appears as if Windows and Linux are sharing your hardware.

There are several virtualization schemes currently available. Two of the most popular are VMware (see HOWTO use VMware to set up virtual networks (Windows)) and VirtualBox. We will cover VirtualBox in this HOWTO. The following image is a screenshot of Fedora running as a virtual machine on a Windows XP (classic) desktop. You can probably make out that the terminal session on Fedora has just completed running the ns-3 test suite (test.py).

Screenshot fc11.png

There is extensive documentation available online for VirtualBox. Look here for a starting point. Note that by downloading the VirtualBox code you are implicitly agreeing to this license.

If you are using a 64-bit Windows 8 or 10 host machine, follow this tutorial in order to configure 64-bit virtual machines (or even have access to the virtual cores of the host in the VirtualBox configuration window).

HOWTO use VirtualBox to run simulations on Windows machines

1. The first thing you must do is get the VirtualBox binaries.

   a.  Go to the VirtualBox downloads page
   b.  Download and run the VirtualBox binary for Windows Hosts by clicking on 
       the x86/amd64 link.  You will get the usual File Download - Security 
       Warning dialog.  Just click Run to download and run the about 
       70 megabyte file.
   c.  After the file downloads, you will get the usual Windows Internet 
       Explorer - Security Warning dialog.  Just select Run.

2. Step through the Sun VirtualBox Setup Wizard.

   a.  Press the Next > button.
   b.  Accept the terms of the license agrreement (if you desire) by clicking
       the corresponding radio button.
   c.  Press the Next > button.
   d.  Review the features that will be installed if you desire.  I just accept
       them as-is.
   e.  Press the Next > button.
   f.  Decide if you want a desktop and quick lanch icon.  If you expect to 
       use ns-3 a lot it is probably worthwhile, but completely up to your 
       preference.
   g.  Press the Next > button.

3. Perform the actual installation. Warning: This step will temporarily disconnect you from the Internet.

   a.  Press the Install button to start the installation process.
   b.  You will see a number of dialog boxes (six) complaining that VirtualBox
       has not passed Windows Logo Testing.  Press Continue Anyway.
   c.  When you see the Sun VirtualBox installation is complete message
       leave the Start Sun VirtualBox after installation radio button
       selected.
   d.  Press the Finish button.

4. Register with Sun Online. VirtualBox will ask you to register with Sun Online. If you already have a Sun Online account, enter it or just fill out the account creation part of the page and press Register. If the registration process complains about a bad IP address, just create a new account.


Sidebar: In this HOWTO, we explain how to download a CD image from the web and use it to install a guest operating system in VirtualBox. There is an alternative, which is to start with a pre-configured OS "Virtual Applicance." These are VMware things, but VirtualBox can read them. You can browse through hundreds of applicances here.


5. Download a Linux CD image.

   a.  Decide which version of Linux you are going to use.  If you have no 
       strong preference, I would use the same version that ns-3 does most
       of its testing on.  Look here for the ns-3 wiki.  Follow the
       Buildbot Waterfall Display link, and notice the list of platforms.  
       At the time of this writing, most of them are fc10.  This translates
       to Fedora Core 10.  You can infer that ns-3 testing is mostly performed
       on Fedora systems, so Fedora it is; and Fedora 12 is the latest release
       as of this writing.
   b.  Go to The Fedora Project and then to Get Fedora and download a
       CD image.  You will get the usual File Download - Do you want to open
       or save this file? dialog.  Just click Save and tell the system
       where to put the almost 700 megabyte file.

6. Create a new virtual machine.

   a.  Go to the Sun VirtualBox window you started in step 3.
   b.  Press the "New" button.  This will start a New Virtual Machine Wizard.
   c.  Press Next > in the wizard.
   d.  Give your new virtual machine a name, say "ns-3-fedora-12".
   e.  In the OS Type box, select Linux as the Operating System and
       Fedora as the Version.
   f.  Press Next > in the wizard.
   g.  Keeping in mind how much physical memory you have in your host machine,
       give the new virtual machine some memory.  This won't be available for 
       your host machine.  I choose 512 MB on my 2 GB Windows machine.
   h.  Press Next > in the wizard.
   i.  Keeping in mind how much hard disk space you have in your host machine
       give the new virtual machine some memory.  You will need disk for the 
       base OS, the toolchain and at least one ns-3 distribution, which will 
       require about 1.2 gig at the time of this writing.
   j.  Press Next > in the New Virtual Machine Wizard to start the
       Create New Virtual Disk Wizard.
   k.  Press Next > in the Create New Virtual Disk Wizard.
   l.  Leave the Dynamically expanding storage radio button selected and
       press Next > in the Create New Virtual Disk Wizard.
   m.  Select a maximum size for the disk (I use 10 GB) and press Next > 
       in the Create New Virtual Disk Wizard.
   o.  Press Finish in the Create New Virtual Disk Wizard to create
       your disk.
   p.  This takes you back to the New Virtual Machine Wizard which will 
       be giving you a summary of the new virtual machine parameters.  Press 
       Finish in the Create New Virtual Disk Wizard to create
       your new virtual machine.

7. "Insert" your boot CD. In the Sun VirtualBox window, you should now see avirtual machine named "ns-3-fedora-12" in the powered off state on the left side. On the right side, you should see the "Details" tab selected, with the details for "ns-3-fedora-12" displayed.

   a.  Click on the Storage item.
   b.  Under Storage Tree box, IDE Controller, select the secondary master
       which should say Empty at this point.
   c.  Under the Attributes item there is a pulldown labeled CD/DVD Device.
       Select the folder icon to the right.  This will load the VirtualBox
       Virtual Media Manager.
   d.  Select the Add action and navigate to the folder in which you saved the
       Fedora 12 iso image above.  Select the iso image which will insert it
       as if it were a real CD.
   e.  Press OK to return to the main VirtualBox window.

8. Power up the virtual machine and install Fedora 12.

   a.  Select the Start icon in the Sun VirtualBox window.  It is shaped like
       a green arrow.
   b.  Read the information dialog about how to get in and out of the virtual
       machine window and press OK.
   c.  Read the information dialog about color mode and press OK.
   d.  Click into the new virtual machine window, select Capture and 
       watch Fedora 12 start to install (this will take a while).
   e.  When the login box appears, press "Log In" and then double click the 
       Install to Hard Disk icon.
   f.  Press Next to begin the Fedora 12 installation process and copy the
       image to the virtual machine hard drive.  This is going to take some
       considerable time since you are installing a whole operating system.
       We won't cover how to proceed here in detail since this is not a Fedora
       12 installation guide.  Do remember that you will have to initialize your
       virtual hard disk since you just "created" it.  Google is your friend if 
       you have problems.
   g.  Eventually you'll see "Congratulations, your Fedora installation is 
       complete".  Press Close.
   h.  Shut down the Fedora system.

9. "Remove" your boot CD. In the Sun VirtualBox window, you should now see a virtual machine named "ns-3-fedora-12" in the powered off state on the left side. On the right side, you should see the "Details" tab selected, with the details for "ns-3-fedora-12" displayed.

   a.  Click on the Storage item.
   b.  Click on the Fedora-12-i686-Live.iso CD in the IDE Controller under Storage Tree.
   c.  Select Empty under the CD/DVD Device pulldown.
   d.  Press OK.

10. Bring up your shiny new Fedora 12 system.

   a.  Select the Start icon in the Sun VirtualBox window.  It is shaped like
       a green arrow.
   b.  You'll have to do a few more setup steps (create a user) in the Fedora
       Setup Agent.  This will reboot one more time and then you can log
       in with your new user name.

11. Install the GNU toolchain and some useful tools. If you have added yourself as a sudoer, you can run the following commands (or others according to your taste) using sudo, otherwise log on as root. A more complete list is available here.

   a.  yum install libxml2 libxml2-devel
   b.  yum install gcc gcc-c++ make automake autoconf binutils
   c.  yum install openssh-server openssh-clients openssl
   d.  yum install python python-devel mercurial bzr 
   e.  yum install scons flex bison
   f.  yum install tcpdump valgrind gdb emacs

12. Get and Test ns-3-dev

   a.  Make sure you have exited from su root, if you did that in step 11.
   b.  cd ~
   c.  mkdir repos
   d.  cd repos
   e.  hg clone http://code.nsnam.org/ns-3-allinone
   f.  cd ns-3-allinone
   g.  ./download.py
   h.  ./build.py
   i.  cd ns-3-dev
   j.  ./test.py
   k.  ./waf --regression

As an old math professor once said, "I feel joy"!

If you are really going to use a virtual machine as a primary development platform, you will probably be annoyed by the limitation of the device driver to 800x600 resolution. You can fix this by installing the so-called VirtualBox Guest Additions. This will aso get rid of the annoying "mouse capture" and "mouse release" business. If you install the Guest Additions, you can resize your virtual desktop to any size you want and mouse in and out of it just as if you were in a Windows window. Recommended. The screen shot at the top of the page was taken of a my home system which has these additions enabled. See the VirtualBox documentation for instructions, perhaps starting here in the user manual.

Note that if you installed Fedora 12, you may have to freshen your distribution to get this to work (if you see modprobe errors); and you may have to set KERN_DIR yourself to "/usr/src/kernels/your kernel version". Hopefully this will get resolved as the Fedora 12 and VirtualBox combination is fully sorted.


Craigdo 03:13, 9 February 2010 (UTC)