forked from NeoGeographyToolkit/StereoPipeline
-
Notifications
You must be signed in to change notification settings - Fork 1
/
Copy pathVIRTMACHINES
137 lines (83 loc) · 3.56 KB
/
VIRTMACHINES
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
124
125
126
127
128
129
130
131
132
133
134
135
This is documentation for ASP developers about how set up a Linux
virtual machine and build ASP and its dependencies inside of it. A
virtual machine makes it easier work on a desired OS version and to
install third-party libraries.
We use KVM to manage virtual machines. The system administrators
need to have it installed on the host machine.
It is suggested that the virtual machine (the guest) to be used for
building ASP be reasonably old, so that the shipped ASP build works on
as many machines as possible. Here is an example of installing CentOS 7
as a guest.
wget http://archive.kernel.org/centos-vault/7.0.1406/isos/x86_64/CentOS-7.0-1406-x86_64-livecd.iso
mkdir -p ~/projects/libvrt
fallocate -l 100000M ~/projects/libvrt/centos7.img
virt-install -r 12288 --accelerate -n centos7 -f ~/projects/libvrt/centos7.img --cdrom CentOS-7.0-1406-x86_64-livecd.iso --vcpus=14 --vnc --vncport=5950
One should choose to use manual partitioning and create a single drive
rather than having the space divided among multiple logical drives
which makes it harder to use the space efficiently.
# Managing the virtual machine
To open a GUI in the machine, use either:
vncviewer localhost:5950
(the same VNC port used when the machine was created), or
virt-viewer centos7
Use
virsh list --all
to view the guests,
virsh start <machine>
to start it,
virsh destroy <machine>
to force shutting down the guest, and
virsh undefine <guest>
followed by
rm -rf ~/projects/libvrt
to wipe any trace of all guest machines (use with extreme care!).
# Connecting to the guest via ssh using remote port forwarding
A connection from the host to a guest can be done by reverse port
forwarding (there should be a better way).
Here is an example. From the guest, one can do:
ssh -f -N HOSTUSER@HOST -R 6000:localhost:22
Then, from HOST, one should be able to connect to the guest via:
ssh localhost -p 6000 -o UserKnownHostsFile=/dev/null -o StrictHostKeyChecking=no -l GUESTUSER
The guest must be configured to allow incoming ssh connections by
installing openssh-server. The sshd daemon may need to be installed or
restarted on the guest, using:
sudo service sshd restart
If the following lines are added to HOST's .ssh/config:
Host GUEST
Hostname localhost
HostKeyAlias GUEST
CheckHostIP no
Port 6000
User GUESTUSER
then one should be able to connect to the guest simply by running
ssh GUEST.
Occasionally a port may become unavailable, and hence will need to be changed.
# Speeding up network access
The network speed between HOST and GUEST can be very slow. It can be
greatly sped up using virtio. This can be done as follows.
Locate the virtual machine, for example, with the command:
virsh list --all
on the host. Here it is assumed we name it centos7.
Dump and edit an xml file:
virsh dumpxml centos7 > centos7.xml
vim centos7.xml
Under the line
<mac address='...'/>
add the line:
<model type='virtio'/>
Save this file and exit. Then undefine, shut down, redefine, and
restart the machine as follows:
virsh undefine centos7
virsh destroy centos7
virsh create centos7.xml
This should create and start the machine.
# Further customization and administration
The number of CPUs and RAM for GUEST can be changed each time before
starting it by again editing the xml file.
See INSTALLGUIDE for how to continue the installation of dependencies
and building ASP.
To bring up the network connection on CentOS, run:
dhclient eth0
One should also change the machine name of the guest to, for example,
centos7 and reflect this in the daily regression scripts in
BinaryBuilder.