середу, 21 січня 2015 р.

Mój szybki start z SUSE KIWI.


(w stylu tarantiniego)
Mnie więcej się podoba obrazy zebrane za pomocą libvirt.

Mnie był potrzebny obraz Xen wirtualnej maszyny z systemem openSUSE 13.2. Poradzili mi skorzystać z serwisu KIWI.

Wykonujemy trzy prostych komendy z interfejsu wiersza poleceń.

# cd /usr/share/doc/packages/kiwi/examples/suse-13.2/
# date && kiwi --prepare ./suse-xen-guest --root /var/lib/xen/images/myxen/ && date

Sun Jan 18 21:30:30 EET 2015
Jan-18 21:30:31 <1> : Description provides no MD5 hash, check
Jan-18 21:30:31 <1> : Reading image description [Prepare]...
Jan-18 21:30:32 <1> : Set root log: /var/lib/xen/images/myxen/.25254.screenrc.log...                                                done
8<- - - -8<- - - -8<- - - -8<- - - -8<- - - -
 Jan-18 21:51:56 <1> : Cleanup temporary copy of sysconfig/proxy                                                                     done
Jan-18 21:51:57 <1> : KIWI exited successfully
Jan-18 21:51:57 <1> : Complete logfile at: /var/lib/xen/images/myxen/.log                                                           done
Sun Jan 18 21:51:58 EET 2015



 # kiwi --create /var/lib/xen/images/myxen --type vmx -d /var/lib/libvirt/images/myxen-result

Jan-18 23:04:46 <1> : Description provides no MD5 hash, check
Jan-18 23:04:46 <1> : Reading image description [Create]...
Jan-18 23:04:46 <1> : Destination: /var/lib/libvirt/images/myxen-result doesn't exist
Jan-18 23:04:46 <1> : Would you like kiwi to create it [yes/no] ? yes
Jan-18 23:04:51 <1> : Image update:
Jan-18 23:04:51 <1> : --> Install/Update: kernel-xen
Jan-18 23:04:51 <1> : --> Remove: kernel-ec2
Jan-18 23:04:51 <1> : Description provides no MD5 hash, check
Jan-18 23:04:51 <1> : Reading image description [Upgrade]...
Jan-18 23:04:52 <1> : Set root log: /var/lib/xen/images/myxen.5238.screenrc.log...                                                  done
Jan-18 23:04:52 <1> : Setting up package manager: zypper                                                                            done
Jan-18 23:04:53 <1> : Mounting required file systems                                                                                done

8<- - - -8<- - - -8<- - - -8<- - - -8<- - - -
Jan-18 23:14:23 <1> : Creating image Xen configuration file...                                                                      skipped
Jan-18 23:14:23 <2> : No disk device setup found in machine section                                                                 skipped
Jan-18 23:14:24 <1> : Find build results at: /var/lib/libvirt/images/myxen-result                                                   done
Jan-18 23:14:24 <1> : KIWI exited successfully
Jan-18 23:14:24 <1> : Complete logfile at: /var/lib/xen/images/myxen.log             
                                               done

To już wszystko gotowe. :)

Uruchomiamy maszynę wirtualną za pomocą virt-manager, wybrawszy opcje <Import existing disk image>.



Pierwsze ładowanie
Start systemu zbudowanego za pomocą KIWI.


Stworzony obraz można wzięć dla testowania tutaj, dla logina root  hasło "Linux".

w rolach głównych:

CPU: AMD Athlon
OS: openSUSE Linux 13.1

 A teraz od początku.

Najpierw szukam potrzebnych pakietów.

# zypper se kiwi


S | Name | Summary | Type
--+---------------------------------------+------------------------------------------+-----------
| kiwi | openSUSE - KIWI Image System | package
| kiwi | openSUSE - KIWI Image System | srcpackage
| kiwi-config-openSUSE | KDE live CD | package
| kiwi-desc-isoboot | openSUSE - KIWI Image System ISO boot | package
| kiwi-desc-isoboot-requires | openSUSE - KIWI Image System ISO boot -> | package
| kiwi-desc-netboot | openSUSE - KIWI Image System PXE netwo-> | package
| kiwi-desc-netboot-requires | openSUSE - KIWI Image System NET boot -> | package
| kiwi-desc-oemboot | openSUSE - KIWI image descriptions | package
| kiwi-desc-oemboot-requires | openSUSE - KIWI Image System oem boot -> | package
| kiwi-desc-vmxboot | openSUSE - KIWI Image System Virtual M-> | package
| kiwi-desc-vmxboot-requires | openSUSE - KIWI Image System VMX boot -> | package
| kiwi-doc | openSUSE - KIWI Image System Documenta-> | package
| kiwi-instsource | Installation Source creation | package
| kiwi-instsource-plugins-openSUSE-12-1 | OpenSuSE - KIWI Image System | package
| kiwi-media-requires | openSUSE - packages which should be pa-> | package
| kiwi-pxeboot | openSUSE - KIWI Image System PXE boot -> | package
| kiwi-templates | openSUSE - KIWI JeOS system image temp-> | package
| kiwi-test | Unit tests for kiwi | package
| kiwi-tools | openSUSE - KIWI tools collection | package 
Wiele niezbędnych pakietów do budowy rożnych obrazów, ale niema dla Xena.

 Instaluje to wszystko, bo nie wiem co się potrzebne a co nie.
 

# zypper in kiwi kiwi-desc-netboot \
kiwi-desc-oemboot kiwi-desc-netboot-requires \
kiwi-desc-vmxboot kiwi-desc-oemboot-requires \
kiwi-desc-vmxboot-requires  kiwi-instsource \
kiwi-doc  kiwi-instsource-plugins-openSUSE-12-1 \
kiwi-media-requires kiwi-templates kiwi-tools \
kiwi-test


Wchodzimy w dyrektorium /example jak to rekomendowano w oficjalnym "openSUSE-KIWI Image System.Cookbook”. Patrzymy.


/usr/share/doc/packages/kiwi/examples # ls


README  extras  suse-12.1  suse-12.2  suse-12.3  suse-13.1
Ne gęsto :( potrzebnej 13.2 nie ma.
Szukamy konfiguracja dla Xena.



# find /usr/share/doc/packages/kiwi/examples | grep xen

./suse-12.1/suse-xen-guest/config.xml
8<- - - -
8<- - - -8<- - - -8<- - - -8<- - - -
./suse-12.2/suse-xen-guest/config.xml 
8<- - - -8<- - - -8<- - - -8<- - - -8<- - - -
./suse-12.3/suse-xen-guest/config.xml 
8<- - - -8<- - - -8<- - - -8<- - - -8<- - - -
 
Jeszce gorzej, konfiguracji dla SUSE 13 z Xen4 nie ma, jest tylko dla 12 z Xen3 a u nich rożne skrypty pygrub.
 Dalej robi takie fokusy, kopiuje dyrektorium suse-12.3 w suse-13.2PK

# cp -aR suse-12.3 suse-13.2PK

Wchodzę w stworzony dyrektorium suse-13.2PK i we wszystkich plikach zamieniam cyfry 12.3 na 13.2 za pomocą niżej podanego skryptu.

#!/bin/sh
 for i in  \
 `grep -H 12.3 ./*/* 2>/dev/null | cut -f1 -d: | sort -u | tr "\12" " "`;
  do cat $i | sed 's/12.3/13.2/g' >| $i.tmp && cat $i.tmp > $i && rm -f $i.tmp;
 done


Myślę, że tego wystarczy już, żeby zregenerować potrzebny obrazek, ale założy się, że inżynierowie SUSE nie przewidzieli w swoich skryptach takiej dystrybucji jak 13.2PK, dla tego tworze dowiązania symboliczne o prawidłowej nazwę:


# ln -s suse-13.2PK/ suse-13.2

Zapomniałem, jeszcze niewielki kresek, prawie dyrektorium dla szablonów obrazów.Tam też nie ma szablonu dla suse-13.2.


# cd /usr/share/kiwi/image/vmxboot
# ln -s suse-13.1 suse-13.2

пʼятницю, 16 січня 2015 р.

Xen PV guest OpenSUSE 13.2 (x86_64)


As I needed a PostgreSQL 9.3 database for my phpBB3 forum installation, I decided to use an OpenSUSE 13.2 distribution. 

The virtual machine PV Xen is located on logical volumes LVM2, so that the creation of  snapshot backups on the fly is possible. The kernel, initram and grub2 loader are located on a common ext2 partition. Minimal miscellaneous server is installed (without Xorg). PostgreSQL wasn’t installed in order to make the image maximally generic. The size of the disk is 10 GB, which is rather generous. Second disk can be added to the volume group, if more space is needed.

The image can be found here with configuration files for Xen3 (SLES11 SP3 I CentOS5.11) included.
Properties “name” and “vif” have to be configured according to your needs. The rest can be used as is, or adjusted to your environment or taste.

Xen4 (OpenSUSE 13.1) configuration files are needless as I raised the image with VM-Manager by means of <Import existing disk image>.

SSHD is enabled and activated, so it is possible to connect either via VNC or via SSH.
Login: poltawer
Password: Linux (the same for root)
Don’t forget to change the credentials after the first run ;)
I hope somebody could need it.

Any feedback is welcome!
CentOS 5.11
OpenSUSE 13.1