-
Notifications
You must be signed in to change notification settings - Fork 34
/
INSTALL
123 lines (86 loc) · 3.49 KB
/
INSTALL
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
== Dependencies ==
1. install needed python modules
apt-get install python-paramiko python-pyinotify python-simplejson python-ldap
2. (only on the tester machine)
install vmware-vix
# go to http://www.vmware.com/support/developer/vix-api/
# extract the archive
# tar xf VMware-vix-1.6.2-127388.i386.tar.gz
# install vmware-vix
sudo ./vmware-vix-distrib/vmware-install.pl
# remove vmware-vix directory
rm -rf vmware-vix-distrib
3. # (only on the tester machine)
# install pyvix
git clone git://github.com/luciang/pyvix.git
sudo apt-get install python2.7-dev
cd pyvix && python setup.py install
4. # install vmchecker
cd vmchecker/
python setup.py install
== Configure machines ==
# on storer:
vmchecker-init-course storer
# on tester:
vmchecker-init-course tester
Don't forget to edit /etc/vmchecker/config.list to add the
directories in which vmchecker-init-course was invoked and associate
them a course id.
== Setting up the LXC/KVM environment ==
=== LXC ===
# Install needed modules
sudo sh vmchecker/lxc-resources/deps.sh
# Setup interfaces
sudo cp vmchecker/lxc-resources/interfaces /etc/network/interfaces
# or copy the settings manually
# add the following to /etc/hosts
10.3.1.1 deb0 deb0.virt deb0.virt.local
10.3.1.11 deb1 deb1.virt deb1.virt.local
10.3.1.12 deb2 deb2.virt deb2.virt.local
10.3.1.13 deb3 deb3.virt deb3.virt.local
10.3.1.14 deb4 deb4.virt deb4.virt.local
# Init cgroups
mkdir -p /cgroup
mount none -t cgroup /cgroup
# Add the following line to /etc/fstab
none /cgroup cgroup defaults 0 0
# restart networking
# Add the following to the hosts /etc/sudoers file:
ALL ALL=NOPASSWD: /usr/bin/lxc-start *
ALL ALL=NOPASSWD: /usr/bin/lxc-stop *
ALL ALL=NOPASSWD: /usr/bin/lxc-info *
ALL ALL=NOPASSWD: /usr/bin/lxc-backup *
ALL ALL=NOPASSWD: /usr/bin/lxc-restore *
# If you need web conectivity inside the lxc container:
sudo vmchecker/lxc-resources/host_iptables.sh
== Creating the virtual machines ==
* VMware
Create a vmware virtual machine and install an operating system.
Install VMware-tools inside the virtual machine.
* LXC
# create lxc container
sudo sh vmchecker/lxc-resources/easylxc deb1
# check connectivity
ssh root@deb1
# if SSH fails, or asks for password,
# copy the key ~/.ssh/id_rsa.pub to
# /var/lib/lxc/deb1/rootfs/root/.ssh/authorized_keys
* KVM
sudo apt-get install virtinst kvm
sudo virt-install --connect qemu:///system --name kvm2 --hvm --ram 512 --disk path=/home/icecold/kvm/saisp-vm.qcow2,format=qcow2 --network network=default --import --vnc
# Install all needed packages
# Copy ssh key to /root/.ssh/authorized_keys
# Check that ssh works
# virsh destroy kvm2
# virsh undefine kvm2
# Create snapshot image
# TODO: improve snapshot creation with libvirt commands
qemu-img create -f qcow2 -b saisp-vm.qcow2 image.qcow2
cp image.qcow2 run.qcow2
# Setup domain for testing assignments
sudo virt-install --connect qemu:///system --name kvm2 --hvm --ram 512 --disk path=/var/lib/kvm/run.qcow2,format=qcow2 --network network=default --import --graphics none
Note:
The VMPath param in the course config should be as follows:
For VMware: the path to the vmx file
For KVM: the name of the virtual domain (Eg. kvm2)
For LXC: the name of the container, as listed in /etc/hosts (Eg. deb1)