Monday, January 14, 2019

Flexible Server Part III: Setting up a guest VM


In Part III we set up a guest VM using xen tools. xen-create-image is one such utility that helps to create a bootable image and start-up configuration file. You will need to refer to your network configuration (DNS, DHCP) for MAC assignment but static configuration is also possible.
?

  
01
02
03
04
05
06
07
08
09
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
gsw@goat-lin:/etc/xen-tools$ sudo xen-create-image --hostname=goat-lin001.webber.net --memory=512mb --vcpus=2 --dhcp  --nohosts --noswap --output=/etc/xen --nopygrub --dist=bionic --mac=00:16:3E:CB:0A:FE --lvm=roots-vg
General Information
--------------------
Hostname       :  goat-lin001.webber.net
Distribution   :  bionic
Mirror         :  http://archive.ubuntu.com/ubuntu
Partitions     :  /               4G    (ext4)
Image type     :  full
Memory size    :  512mb
Bootloader     :  pygrub
Networking Information
----------------------
IP Address     : DHCP [MAC: 00:16:3E:CB:0A:FE]
Creating ext4 filesystem on /dev/roots-vg/goat-lin001.webber.net-disk
Done
Installation method: debootstrap
Done
Running hooks
Done
No role scripts were specified.  Skipping
Creating Xen configuration file
Done
No role scripts were specified.  Skipping
Setting up root password
Generating a password for the new guest.
All done
Logfile produced at:
         /var/log/xen-tools/goat-lin001.webber.net.log
Installation Summary
---------------------
Hostname        :  goat-lin001.webber.net
Distribution    :  bionic
MAC Address     :  00:16:3E:CB:0A:FE
IP Address(es)  :  dynamic
SSH Fingerprint :  SHA256:xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx (DSA)
SSH Fingerprint :  SHA256:xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx (ECDSA)
SSH Fingerprint :  SHA256:xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx (ED25519)
SSH Fingerprint :  SHA256:xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx (RSA)
Root Password   :  xxxxxxxxxxxxxxxxxxxxxxx

  
gsw@goat-lin:/etc/xen-tools$ sudo xen-create-image --hostname=goat-lin001.webber.net --memory=512mb --vcpus=2 --dhcp  --nohosts --noswap --output=/etc/xen --nopygrub --dist=bionic --mac=00:16:3E:CB:0A:FE --lvm=roots-vg

General Information
--------------------
Hostname       :  goat-lin001.webber.net
Distribution   :  bionic
Mirror         :  http://archive.ubuntu.com/ubuntu
Partitions     :  /               4G    (ext4)
Image type     :  full
Memory size    :  512mb
Bootloader     :  pygrub

Networking Information
----------------------
IP Address     : DHCP [MAC: 00:16:3E:CB:0A:FE]


Creating ext4 filesystem on /dev/roots-vg/goat-lin001.webber.net-disk
Done
Installation method: debootstrap
Done

Running hooks
Done

No role scripts were specified.  Skipping

Creating Xen configuration file
Done

No role scripts were specified.  Skipping
Setting up root password
Generating a password for the new guest.
All done


Logfile produced at:
         /var/log/xen-tools/goat-lin001.webber.net.log

Installation Summary
---------------------
Hostname        :  goat-lin001.webber.net
Distribution    :  bionic
MAC Address     :  00:16:3E:CB:0A:FE
IP Address(es)  :  dynamic
SSH Fingerprint :  SHA256:xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx (DSA)
SSH Fingerprint :  SHA256:xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx (ECDSA)
SSH Fingerprint :  SHA256:xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx (ED25519)
SSH Fingerprint :  SHA256:xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx (RSA)
Root Password   :  xxxxxxxxxxxxxxxxxxxxxxx


This process can take some time as the packages will be pulled down to your server to prepare the image. There are probably ways to optimise this but I haven't investigated these here. Lastly, you can now boot your new guest VM/Dom-U.
?

  
1
2
3
root@goat-lin:/etc/xen> xl create goat-lin001.webber.net.cfg
Parsing config from /etc/xen/goat-lin001.webber.net.cfg
root@goat-lin:/etc/xen>  xl console goat-lin001.webber.net

  
root@goat-lin:/etc/xen> xl create goat-lin001.webber.net.cfg
Parsing config from /etc/xen/goat-lin001.webber.net.cfg
root@goat-lin:/etc/xen>  xl console goat-lin001.webber.net
You should also be able to ssh into the new VM remotely at this point using the FQDN or IP you set up. Failing that, uxing xl console per the above will give you a local terminal connection.

Next: Flexible Server Part IV: Base build of guest VM

No comments:

Post a Comment