Statistics
| Branch: | Tag: | Revision:

mininet / util / vm / install-mininet-vm.sh @ master

History | View | Annotate | Download (1.59 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/splash//' /etc/default/grub
15
sudo sed -i -e 's/quiet/text/' /etc/default/grub
16
sudo update-grub
17
# Update from official archive
18
sudo apt-get update
19
# 12.10 and earlier
20
#sudo sed -i -e 's/us.archive.ubuntu.com/mirrors.kernel.org/' \
21
#	/etc/apt/sources.list
22
# 13.04 and later
23
#sudo sed -i -e 's/\/archive.ubuntu.com/\/mirrors.kernel.org/' \
24
#	/etc/apt/sources.list
25
# Clean up vmware easy install junk if present
26
if [ -e /etc/issue.backup ]; then
27
    sudo mv /etc/issue.backup /etc/issue
28
fi
29
if [ -e /etc/rc.local.backup ]; then
30
    sudo mv /etc/rc.local.backup /etc/rc.local
31
fi
32
# Fetch Mininet
33
sudo apt-get -y install git-core openssh-server
34
git clone git://github.com/mininet/mininet
35
# Optionally check out branch
36
if [ "$1" != "" ]; then
37
  pushd mininet
38
  #git checkout -b $1 $1
39
  # TODO branch will in detached HEAD state if it is not master
40
  git checkout $1
41
  popd
42
fi
43
# Install Mininet
44
time mininet/util/install.sh
45
# Finalize VM
46
time mininet/util/install.sh -tcd
47
# Ignoring this since NOX classic is deprecated
48
#if ! grep NOX_CORE_DIR .bashrc; then
49
#  echo "export NOX_CORE_DIR=~/noxcore/build/src/" >> .bashrc
50
#fi
51
echo "Done preparing Mininet VM."