Saturday, September 30, 2017

Debian Stretch: XEN configure & create DomU HVM Centos part 2

Get centos iso cd
# mkdir iso/
# cd iso
# mkdir centos7
# cd centos7
# wget http://centos.biz.net.id/7/isos/x86_64/CentOS-7-x86_64-NetInstall-1708.iso
Note: you can choose your closest mirror.

Create logical volume for guest
# lvcreate -L300g -n xcentos701-disk volGroup1
  Logical volume "xcentos701-disk" created.
# lvdisplay
  --- Logical volume ---
  LV Path                /dev/volGroup1/xcentos701-disk
  LV Name                xcentos701-disk
  VG Name                volGroup1
  LV UUID                jmP1d1-9xFo-ruio-eEXx-Vkgi-w1Ah-X4tO7B
  LV Write Access        read/write
  LV Creation host, time server, 2017-09-29 02:29:55 +0700
  LV Status              available
  # open                 0
  LV Size                300.00 GiB
  Current LE             76800
  Segments               1
  Allocation             inherit
  Read ahead sectors     auto
  - currently set to     256
  Block device           254:0

Create guest configuration file /etc/xen/xcentos701.cfg
builder = "hvm"
name = "xcentos701"
memory = 8192
vcpus = 4
vif = [ 'mac=00:16:4f:02:02:15, ip=[your_ip], bridge=br0' ]
# Disk Devices
# A list of `diskspec' entries as described in
# docs/misc/xl-disk-configuration.txt
disk = [
  '/dev/volGroup1/xcentos701-disk,raw,xvda,rw',
  'file:/[your_home]/iso/centos7/centos7.iso,xvdc:cdrom,r'
  ]
boot = "dc"
vnc = 1
vnclisten = "[your_ip]"
vncdisplay = 0
vncpasswd = "password"

You need to use any vnc viewer to finish installation. At the end, set root password and reboot. 

If the reboot is stuck, destroy the instance.
# xl destroy xcentos701

You need to remove cdrom from configuration, edit /etc/xen/xcentos701.cfg 
builder = "hvm"
name = "xcentos701"
memory = 8192
vcpus = 4
vif = [ 'mac=00:16:4f:02:02:15, ip=[your_ip], bridge=br0' ]
# Disk Devices
# A list of `diskspec' entries as described in
# docs/misc/xl-disk-configuration.txt
disk = [
  '/dev/volGroup1/xcentos701-disk,raw,xvda,rw'
  ]
boot = "c"
We don't need vnc anymore, so we remove it (comment it out).

Start your guest
# xl create /etc/xen/xcentos701.cfg 
# xl list
Name                                        ID   Mem VCPUs      State   Time(s)
Domain-0                                     0 11815    24     r-----    5001.7
xcentos701                                   1 12288     4     -b----    9315.6

State:

  • r - running
  • b - blocked
  • p - paused
  • s - shutdown
  • c - crashed
  • d - dying


To connect to your guest
# xl console xencentos701

To make your guest start after boot/restart
# mkdir /etc/xen/auto
# ln -s /etc/xen/xcentos701.cfg /etc/xen/auto/xcentos701.cfg

Add user and allow su/sudo
# adduser [your_user]
# usermod -aG wheel [your_user]

References:

  1. http://blog.noviantech.com/2010/06/23/debian-kernels-and-tigon-tg3-firmware/
  2. https://wiki.debian.org/Firmware
  3. https://wiki.debian.org/LVM
  4. https://wiki.debian.org/LinuxRaidForAdmins
  5. https://ycnrg.org/xen-install-os-from-iso-pv/
  6. http://hwraid.le-vert.net/

No comments:

Post a Comment