Statistics
| Branch: | Tag: | Revision:

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

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