blob: 907a37213ced00613a238ebca0b9478c7d43cebb [file] [log] [blame]
Carmelo Casconed6615072017-12-15 00:53:43 -08001#!/bin/bash
2set -xe
3
Carmelo Casconec5569c22018-04-18 10:09:15 +09004VM_TYPE=${1:-dev}
5
Carmelo Casconed6615072017-12-15 00:53:43 -08006# Create user sdn
7useradd -m -d /home/sdn -s /bin/bash sdn
8echo "sdn:rocks" | chpasswd
9echo "sdn ALL=(ALL) NOPASSWD:ALL" > /etc/sudoers.d/99_sdn
10chmod 440 /etc/sudoers.d/99_sdn
11usermod -aG vboxsf sdn
Carmelo Casconef11513d2018-01-16 00:31:14 -080012update-locale LC_ALL="en_US.UTF-8"
Carmelo Casconed6615072017-12-15 00:53:43 -080013
Carmelo Cascone57defd32018-05-11 14:34:01 -070014
Carmelo Casconec5569c22018-04-18 10:09:15 +090015if [ ${VM_TYPE} = "tutorial" ]
16then
Carmelo Casconec5569c22018-04-18 10:09:15 +090017 su sdn <<'EOF'
Carmelo Cascone57defd32018-05-11 14:34:01 -070018cd /home/sdn
19bash /vagrant/tutorial-bootstrap.sh
Carmelo Casconec5569c22018-04-18 10:09:15 +090020EOF
Carmelo Casconec5569c22018-04-18 10:09:15 +090021fi
22
Carmelo Casconed6615072017-12-15 00:53:43 -080023# Java 8
24apt-get install software-properties-common -y
25add-apt-repository ppa:webupd8team/java -y
26apt-get update
Carmelo Casconed6615072017-12-15 00:53:43 -080027
Carmelo Cascone95e5afd2018-07-17 14:45:23 +020028DEBIAN_FRONTEND=noninteractive apt-get -y -o Dpkg::Options::="--force-confdef" -o Dpkg::Options::="--force-confold" upgrade
29
30echo "oracle-java8-installer shared/accepted-oracle-license-v1-1 select true" | debconf-set-selections
Carmelo Casconec5569c22018-04-18 10:09:15 +090031apt-get -y --no-install-recommends install \
Carmelo Cascone57defd32018-05-11 14:34:01 -070032 avahi-daemon \
33 bridge-utils \
34 git \
35 git-review \
36 htop \
Carmelo Casconec5569c22018-04-18 10:09:15 +090037 oracle-java8-installer \
38 oracle-java8-set-default \
Carmelo Cascone57defd32018-05-11 14:34:01 -070039 python2.7 \
40 python2.7-dev \
Carmelo Casconef11513d2018-01-16 00:31:14 -080041 valgrind \
Carmelo Cascone57defd32018-05-11 14:34:01 -070042 zip unzip \
43 tcpdump \
44 vlan \
45 ntp \
46 vim nano emacs \
Charles Chan87dc82e2018-08-05 16:27:10 -070047 arping \
Carmelo Cascone57defd32018-05-11 14:34:01 -070048
49
50curl https://bootstrap.pypa.io/get-pip.py -o get-pip.py
51python2.7 get-pip.py --force-reinstall
52rm -f get-pip.py
Carmelo Casconed6615072017-12-15 00:53:43 -080053
54tee -a /etc/ssh/sshd_config <<EOF
55
56UseDNS no
57EOF
58
59su sdn <<'EOF'
60cd /home/sdn
61bash /vagrant/user-bootstrap.sh
62EOF