Sure! In fact, that was in a blog post that never got released on our side
:S I also have the host build piece documented. Where it would be the best
to drop that? In the LXC section of the doc or as an annexe or in the wiki?

Francois


On Sat, Apr 5, 2014 at 4:16 PM, David Nalley <da...@gnsa.us> wrote:

> Would you consider adding this as part of the documentation? Or at
> least as a blog post?
>
> --David
>
> On Wed, Apr 2, 2014 at 11:07 AM, Francois Gaudreault
> <fgaudrea...@cloudops.com> wrote:
> > On 2014-04-02, 1:34 AM, Chinu wrote:
> >>
> >> Hello all,
> >>
> >>      Please can someone advice how to create an LXC template image  in
> tar
> >> format to spawn containers in KVM for Cloudstack version 4.2 or 4.3
> >> Regards,
> >> Chinu
> >>
> >>
> >>
> > I have that. This is for a CentOS image. I apologize for the formatting,
> I
> > am using text emails ;)
> >
> > On your *HOST* run:
> >
> > |mkdir||/var/lib/libvirt/lxc/centos-6-x86_64/etc/yum||.repos.d/ -p |
> > |cat||/etc/yum||.repos.d||/CentOS-Base||.repo
> >
> |||sed||s/||'$releasever'||/6/g||>||/var/lib/libvirt/lxc/centos-6-x86_64/etc/yum||.repos.d||/CentOS-Base||.repo|
> > |yum groupinstall core
> > --installroot=||/var/lib/libvirt/lxc/centos-6-x86_64/||--nogpgcheck -y|
> > |yum||install||plymouth libselinux-python
> > --installroot=||/var/lib/libvirt/lxc/centos-6-x86_64/||--nogpgcheck -y|
> >
> > On your *CHROOTED* container:
> > |chroot||/var/lib/libvirt/lxc/centos-6-x86_64/|
> > |echo||password |||passwd||root --stdin|
> > |#Fix root login on console|
> > |echo||"pts/0"||>>||/etc/securetty|
> > |sed||-i s/||"session required     pam_selinux.so close"||/||"#session
> > required     pam_selinux.so close"||/g||/etc/pam||.d||/login|
> > |sed||-i s/||"session required     pam_selinux.so open"||/||"#session
> > required     pam_selinux.so open"||/g||/etc/pam||.d||/login|
> > |sed||-i s/||"session required     pam_loginuid.so"||/||"#session
> required
> > pam_loginuid.so"||/g||/etc/pam||.d||/login|
> > |#Configuring basic networking|
> > |cat||>||/etc/sysconfig/network||<< EOF|
> > |NETWORKING=||yes|
> > |HOSTNAME=lxc1.||test||.centos.org|
> > |EOF|
> > |cat||>||/etc/sysconfig/network-scripts/ifcfg-eth0||<< EOF|
> > |DEVICE=eth0|
> > |BOOTPROTO=dhcp|
> > |ONBOOT=||yes|
> > |EOF|
> > |#Enabling sshd|
> > |chkconfig sshd on|
> > |# Fixing root login for sshd|
> > |sed||-i s/||"session required     pam_selinux.so close"||/||"#session
> > required     pam_selinux.so close"||/g||/etc/pam||.d||/sshd|
> > |sed||-i s/||"session required     pam_loginuid.so"||/||"#session
> required
> > pam_loginuid.so"||/g||/etc/pam||.d||/sshd|
> > |sed||-i s/||"session required     pam_selinux.so open
> > env_params"||/||"#session required     pam_selinux.so open
> > env_params"||/g||/etc/pam||.d||/sshd|
> > ||
> > |cat||>||/etc/fstab||<< END|
> > |/dev/root| |/ rootfs   defaults        0 0|
> > |none ||/dev/shm| |tmpfs nosuid,nodev    0 0|
> > |END|
> > ||
> > |cat||>||/etc/init/lxc-sysinit||.conf << END|
> > |start on startup|
> > |env||container|
> > |pre-start script|
> >
> |||if||[||"x$container"||!=||"xlxc"||-a||"x$container"||!=||"xlibvirt"||];||then|
> > |||stop;|
> > |||fi|
> > |||initctl start||tty||TTY=console|
> > |||rm||-f||/var/lock/subsys/||*|
> > |||rm||-f||/var/run/||*.pid|
> > |||telinit 3|
> > |||exit||0;|
> > |end script|
> > |END|
> > ||
> > |#Exit the chroot|
> > |exit|
> >
> > Tar it:
> > |cd||/var/lib/libvirt/lxc/centos-6-x86_64|
> > |tar||cvf centos-6-x86_64_lxc.||tar||.
> >
> > Upload to CloudStack and enjoy!
> > |
> >
> >
> > --
> > Francois Gaudreault
> > Architecte de Solution Cloud | Cloud Solutions Architect
> > fgaudrea...@cloudops.com
> > 514-629-6775
> > - - -
> > CloudOps
> > 420 rue Guy
> > Montréal QC  H3J 1S6
> > www.cloudops.com
> > @CloudOps_
> >
>

Reply via email to