lost and found ( for me ? )

Fedora 16 64bit : build a VM image based on Fedora , RHEL and CentOS with boxgrinder

[ what’s boxgrinder ]

boxgrinder enables you to build a custom Virtual appliance based on Fedora , RHEL and CentOS for KVM , VMware etc.

- boxgrinder
http://boxgrinder.org/

[root@fc16 ~]# cat /etc/fedora-release
Fedora release 16 (Verne)
[root@fc16 ~]# uname -ri
3.3.5-2.fc16.x86_64 x86_64

[ installation ]

install boxgrinder and documentation via yum.
[root@fc16 ~]# yum install *boxgrinder*

[ build a VM image with boxgrinder ]

1. create an appliance definition file.

There are sample definition files under /usr/lib/ruby/gems/1.8/gems/boxgrinder-build-0.10.1/integ/appliances
directory.

I am going to build a VM using /usr/lib/ruby/gems/1.8/gems/boxgrinder-build-0.10.1/integ/appliances/jeos-f16.appl

make a working directory for boxgrinder and copy jeos-f16.appl to that directory.
[root@fc16 ~]# mkdir Boxgrinder_works
[root@fc16 ~]# cd Boxgrinder_works/
[root@fc16 Boxgrinder_works]# cp /usr/lib/ruby/gems/1.8/gems/boxgrinder-build-0.10.1/integ/appliances/jeos-f16.appl .

[root@fc16 Boxgrinder_works]# cat jeos-f16.appl
name: jeos-f16
os:
 name: fedora
 version: 16
repos:
 - name: "temp-fedora-updates-testing"
   mirrorlist: "https://mirrors.fedoraproject.org/metalink?repo=updates-testing-f#OS_VERSION#&arch=#BASE_ARCH#"
   ephemeral: true


There are some definition files under  /usr/lib/ruby/gems/1.8/gems/boxgrinder-build-0.10.1/integ/appliances/.
[root@fc16 Boxgrinder_works]# ls /usr/lib/ruby/gems/1.8/gems/boxgrinder-build-0.10.1/integ/appliances/*
/usr/lib/ruby/gems/1.8/gems/boxgrinder-build-0.10.1/integ/appliances/gnome-fedora.appl
/usr/lib/ruby/gems/1.8/gems/boxgrinder-build-0.10.1/integ/appliances/jeos-centos5-files.appl
/usr/lib/ruby/gems/1.8/gems/boxgrinder-build-0.10.1/integ/appliances/jeos-centos5.appl
/usr/lib/ruby/gems/1.8/gems/boxgrinder-build-0.10.1/integ/appliances/jeos-centos6.appl
/usr/lib/ruby/gems/1.8/gems/boxgrinder-build-0.10.1/integ/appliances/jeos-f15.appl
/usr/lib/ruby/gems/1.8/gems/boxgrinder-build-0.10.1/integ/appliances/jeos-f16-files.appl
/usr/lib/ruby/gems/1.8/gems/boxgrinder-build-0.10.1/integ/appliances/jeos-f16.appl

/usr/lib/ruby/gems/1.8/gems/boxgrinder-build-0.10.1/integ/appliances/modular:
_hardware_cpus.appl             _packages_squid.appl
_hardware_memory.appl           _packages_utils.appl
_hardware_partitions_home.appl  _repos_boxgrinder_permanent_noarch.appl
_hardware_partitions_root.appl  _repos_testlocal_ephemeral_noarch.appl
_os_password.appl               _test_base.appl
_packages_groups_base.appl      modular.appl
_packages_groups_core.appl


build a Fedora 16’s JeOS image for KVM using a sample definition file ( jeos-f16.appl )
[root@fc16 Boxgrinder_works]# boxgrinder-build jeos-f16.appl --os-config format:qcow2
I, [2012-05-15T00:12:45.600999 #4575]  INFO -- : Validating appliance definition from jeos-f16.appl file...
I, [2012-05-15T00:12:45.603516 #4575]  INFO -- : Appliance definition is valid.
I, [2012-05-15T00:12:45.613775 #4575]  INFO -- : Building 'jeos-f16' appliance for x86_64 architecture.
I, [2012-05-15T00:12:45.622250 #4575]  INFO -- : Resolving packages added to jeos-f16 appliance definition file...
I, [2012-05-15T00:13:21.232120 #4575]  INFO -- : All additional packages for jeos-f16 appliance successfully resolved.
I, [2012-05-15T00:13:21.232524 #4575]  INFO -- : Building jeos-f16 appliance...
supermin helper [00000ms] whitelist = (not specified), host_cpu = x86_64, kernel = (null), initrd = (null), appliance = (null)
supermin helper [00000ms] inputs[0] = /usr/lib64/guestfs/supermin.d
checking modpath /lib/modules/3.3.4-1.fc16.x86_64 is a directory
picked vmlinuz-3.3.4-1.fc16.x86_64 because modpath /lib/modules/3.3.4-1.fc16.x86_64 exists
checking modpath /lib/modules/3.3.4-3.fc16.x86_64 is a directory
picked vmlinuz-3.3.4-3.fc16.x86_64 because modpath /lib/modules/3.3.4-3.fc16.x86_64 exists
checking modpath /lib/modules/3.3.5-2.fc16.x86_64 is a directory
picked vmlinuz-3.3.5-2.fc16.x86_64 because modpath /lib/modules/3.3.5-2.fc16.x86_64 exists
supermin helper [00000ms] finished creating kernel
supermin helper [00001ms] visiting /usr/lib64/guestfs/supermin.d
supermin helper [00073ms] visiting /usr/lib64/guestfs/supermin.d/base.img
supermin helper [00080ms] visiting /usr/lib64/guestfs/supermin.d/daemon.img
supermin helper [00098ms] visiting /usr/lib64/guestfs/supermin.d/hostfiles
supermin helper [03203ms] visiting /usr/lib64/guestfs/supermin.d/init.img
supermin helper [03605ms] finished creating appliance
supermin helper [00000ms] whitelist = (not specified), host_cpu = x86_64, kernel = /tmp/guestfs.qPBEet/kernel, initrd = /tmp/guestfs.qPBEet/initrd, appliance = /tmp/guestfs.qPBEet/root
supermin helper [00000ms] inputs[0] = /usr/lib64/guestfs/supermin.d
checking modpath /lib/modules/3.3.4-1.fc16.x86_64 is a directory
picked vmlinuz-3.3.4-1.fc16.x86_64 because modpath /lib/modules/3.3.4-1.fc16.x86_64 exists
checking modpath /lib/modules/3.3.4-3.fc16.x86_64 is a directory
picked vmlinuz-3.3.4-3.fc16.x86_64 because modpath /lib/modules/3.3.4-3.fc16.x86_64 exists
checking modpath /lib/modules/3.3.5-2.fc16.x86_64 is a directory
picked vmlinuz-3.3.5-2.fc16.x86_64 because modpath /lib/modules/3.3.5-2.fc16.x86_64 exists
supermin helper [00000ms] finished creating kernel
supermin helper [02620ms] finished mke2fs
supermin helper [02621ms] visiting /usr/lib64/guestfs/supermin.d
supermin helper [02621ms] visiting /usr/lib64/guestfs/supermin.d/base.img
supermin helper [06528ms] visiting /usr/lib64/guestfs/supermin.d/daemon.img
supermin helper [06576ms] visiting /usr/lib64/guestfs/supermin.d/hostfiles
supermin helper [18756ms] visiting /usr/lib64/guestfs/supermin.d/init.img
supermin helper [29206ms] finished creating appliance
W, [2012-05-15T00:19:50.063980 #4575]  WARN -- : Loading SELinux policy failed. SELinux may be not fully initialized.
I, [2012-05-15T00:22:32.786026 #4575]  INFO -- : Executing post operations after build...
I, [2012-05-15T00:22:35.250434 #4575]  INFO -- : Base image for jeos-f16 appliance was built successfully.

It took around 15 minutes to build the VM in my environment.

the VM image will be built under the working directory where you issue boxgrinder-build command.
[root@fc16 fedora-plugin]# pwd
/root/Boxgrinder_works/build/appliances/x86_64/fedora/16/jeos-f16/1.0/fedora-plugin

[root@fc16 fedora-plugin]# ls
jeos-f16-sda.qcow2  jeos-f16.xml

[root@fc16 fedora-plugin]# file *.qcow2
jeos-f16-sda.qcow2: QEMU QCOW Image (v2), 1078984704 bytes

[root@fc16 fedora-plugin]# cat jeos-f16.xml
<image>
 <name>jeos-f16</name>
 <domain>
   <boot type='hvm'>
     <guest>
       <arch>x86_64</arch>
     </guest>
     <os>
       <loader dev='hd'/>
     </os>
     <drive disk='jeos-f16-sda.qcow2' target='hda'/>
   </boot>
   <devices>
     <vcpu>1</vcpu>
     <memory>262144</memory>
     <interface/>
     <graphics/>
   </devices>
 </domain>
 <storage>
   <disk file='jeos-f16-sda.qcow2' use='system' format='qcow2'/>
 </storage>
</image>


start the VM
[root@fc16 fedora-plugin]# qemu-kvm jeos-f16-sda.qcow2 -m 256


well ,,, what’s root user’s credential ???


it seems that root user’s credentials are “boxgrinder-pw”.

[root@fc16 modular]# pwd
/usr/lib/ruby/gems/1.8/gems/boxgrinder-build-0.10.1/integ/appliances/modular
[root@fc16 modular]# cat _os_password.appl
name: os-password
summary: create password
os:
 name: dummy-os
 version: 14
 password: boxgrinder-pw
post:
 base:
   - "/bin/echo 'true' > /os-password-boxgrinder-test"
 ec2:
   - "/bin/echo 'true' > /os-password-ec2-boxgrinder-test"
 vmware:
   - "/bin/echo 'true' > /os-password-vmware-boxgrinder-test"
 virtualbox:
   - "/bin/echo 'true' > /os-password-virtualbox-boxgrinder-test"



user : root
pass : boxgrinder-pw




nice tool !
You could build your custom virtual appliances easily with boxgrinder.

No comments:

Post a Comment

Note: Only a member of this blog may post a comment.