Old VM Creation Notes

Bob Lantz edited this page Aug 28, 2012 · 1 revision
Clone this wiki locally

Old (generally obsolete) VM Creation Instructions:

For historical reference, the old VM creation instructions are preserved on this page.

Download Debian Lenny

Get Debian netinst .iso: wget http://cdimage.debian.org/debian-cd/5.0.4/i386/iso-cd/debian-504-i386-netinst.iso

Other options are at http://www.debian.org/CD/netinst/ .

New VM

Start Fusion

Click File, then New.

Click 'Use operating system installation disk image file' and find the iso you just downloaded.

Select 'Linux' for the Operating System and 'Debian 5'.

Customize settings:

  • Name: Mininet, or your choice
  • 4 GB Hard Disk, don't pre-allocate, don't split into 2 GB files (unless this is on a FAT volume)
  • 256 MB RAM (though after the install you can go lower, down to 192 MB or less)
  • 1 Virtual processor (2 may yield hangs during link teardown) Start up the Guest VM to begin the install.

Click on install.

Additional params (you may want to change these for your location):

  • Language: English
  • Location: United States
  • Keyboard: American English
  • Hostname: mininet
  • Domain: localdomain
  • Time zone: Pacific
  • Partitioning: Guided, use entire disk
  • Continue with SCSI 1
  • All files written to one partition
  • Finish partitioning and write all files to disk
  • Yes, write all changes to disk
  • Root password: mininet
  • Username: mininet
  • Password: mininet
  • United States
  • Mirror: ftp.us.debian.org, or whatever's closest
  • Proxy if you've got one
  • Feedback if you want to
  • All profiles (desktop, standard system) unclicked to minimize install size
  • Install GRUB to MBR: yes Once the machine boots, login to the console as username mininet, with password mininet.

Setup Sudo Acesss

Login as root, with password mininet: su

Setup visudo. Later instructions will assume sudo use. apt-get install sudo

Enter sudoers file: visudo

Change sudo defaults, so that the regular user PATH is used with sudo: Defaults !env_reset Defaults env_delete-="PYTHONPATH"

Add sudo access for your username (mininet will be the assumed username going forward). At the bottom, add: mininet ALL=NOPASSWD: ALL

Exit back to main username: exit

Setup SSH

At this point, you'll probably want to use SSH on the host machine to connect to the VM, for easier copy/paste. sudo apt-get install -y ssh

Find the IP: sudo ifconfig eth0

At point, you shouldn't need to enter any more commands into the VM console, and should be able to do everything over SSH, enabling you to simply copy and paste commands from this web page.

To save a hostname for this IP, on Mac OS X, modify /etc/hosts. Here is an example line: 192.168.115.143 mininet

You can now minimize the VM console; it's no longer needed.

To speed up future SSH connections, add your host's public key to the new VM. We assume the key is already generated. On the host: ssh-copy-id mininet

Now you should be able to log in without entering a password: ssh mininet@mininet

Install Mininet

Download Mininet

You don't need to install the Mininet Python code just yet; we'll run the included machine setup shell scripts directly. sudo apt-get install -y git-core git clone git://github.com/mininet/mininet.git

Install System

All-at-once

The main script is ~/mininet/util/install.sh, which does the following:

  • Install Kernel w/network namespace support
  • Install OpenFlow
  • Install Mininet dependencies
  • Install NOX
  • Install Open vSwitch Run this now: cd ~/ time ~/mininet/util/install.sh

... then wait for ~20 min.

Reboot to load new kernel:

sudo reboot

Clean out unneeded kernel stuff:

~/mininet/util/install.sh -c

Additional setup:

Piece-by-Piece

Each step in the combined install can be done piece-by-piece. See the all() function at the bottom of mininet/util/install.sh, and run each command with the corresponding -line flag.

For example, to install the kernel w/network namespace support:

Run: sudo ~/mininet/util/install.sh -k

Optional: OpenFlow legacy regression test install

Setup env vars for OpenFlow tests: cd ~/ sudo openflow/regress/scripts/install_deps.pl cp ~/openflow/regress/scripts/env_vars . vim env_vars su source /home/mininet/env_vars

Add to top of /root/.bashrc: source /home/mininet/env_vars

Run tests: of_user_veth_test.pl

Customize and Verify Mininet

Go to VM-Setup-Notes to customize the VM, install and verify Mininet, and then do the Walkthrough. These instructions should have ensured all required and optional dependencies are installed.

Post-VM-Creation cleanup

Follow these instructions if you intend to share the VM. They will:

  • free up disk space
  • remove tmp logs
  • clear history:
  • remove private ssh keys
  • remove authorized keys
  • remove Mininet (until release is publicly available)

sudo ~/mininet/util/install.sh -d

Shut down guest VM and remove lock file (.lck) if needed.

To prevent the " .vmx tries to connect to a non-existent CD-ROM image" error, disconnect the CD-ROM in the VMWare settings.

Also remove any log files in the VM directory:

rm *.log

Compress externally in the directory you created the VM: tar -czf Mininet.tar.gz Mininet.vmwarevm/

Kernel Compilation from scratch

A script in Mininet will built a custom kernel on Debian machines. You could run this from the Mininet VM, even.

~/mininet/util/kbuild/kbuild

If building from scratch, make sure you have a kernel later than 2.6.29, configured with the following: CONFIG_BRIDGE=m CONFIG_TUN=m CONFIG_VETH=m CONFIG_PCNET32=m CONFIG_NET_NS=y

For kernel 2.6.33+, as of 3/26/10, the tun kmod has bug when used in a network-namespaced process; a patch is included to work around this kernel oops. See ~/mininet/kbuild for the patch.

Disk Usage Notes

Commands to check disk space: df -a sudo du -B1000 --max-depth=1 / -- Main/BobLantz - 24 May 2012