Statistics
| Branch: | Tag: | Revision:

mininet / util / vm / install-mininet-vm.sh @ 0d271f94

History | View | Annotate | Download (1.43 KB)

1
#!/bin/bash
2

    
3
# This script is intended to install Mininet into
4
# a brand-new Ubuntu virtual machine,
5
# to create a fully usable "tutorial" VM.
6
#
7
# optional argument: Mininet branch to install
8
set -e
9
echo `whoami` ALL=(ALL) NOPASSWD:ALL | sudo tee -a /etc/sudoers > /dev/null
10
sudo sed -i -e 's/Default/#Default/' /etc/sudoers
11
echo mininet-vm | sudo tee /etc/hostname > /dev/null
12
sudo sed -i -e 's/ubuntu/mininet-vm/g' /etc/hosts
13
sudo hostname `cat /etc/hostname`
14
sudo sed -i -e 's/quiet splash/text/' /etc/default/grub
15
sudo update-grub
16
# 12.10 and earlier
17
sudo sed -i -e 's/us.archive.ubuntu.com/mirrors.kernel.org/' \
18
	/etc/apt/sources.list
19
# 13.04 and later
20
sudo sed -i -e 's/\/archive.ubuntu.com/\/mirrors.kernel.org/' \
21
	/etc/apt/sources.list
22
sudo apt-get update
23
# Clean up vmware easy install junk if present
24
if [ -e /etc/issue.backup ]; then
25
    sudo mv /etc/issue.backup /etc/issue
26
fi
27
if [ -e /etc/rc.local.backup ]; then
28
    sudo mv /etc/rc.local.backup /etc/rc.local
29
fi
30
# Fetch Mininet
31
sudo apt-get -y install git-core openssh-server
32
git clone git://github.com/mininet/mininet
33
# Optionally check out branch
34
if [ "$1" != "" ]; then
35
  pushd mininet
36
  git checkout -b $1 $1
37
  popd
38
fi
39
# Install Mininet
40
time mininet/util/install.sh
41
# Finalize VM
42
time mininet/util/install.sh -tc
43
# Ignoring this since NOX classic is deprecated
44
#if ! grep NOX_CORE_DIR .bashrc; then
45
#  echo "export NOX_CORE_DIR=~/noxcore/build/src/" >> .bashrc
46
#fi
47
echo "Done preparing Mininet VM."