<?xml version="1.0" encoding="UTF-8"?>
<rss version="2.0"
	xmlns:content="http://purl.org/rss/1.0/modules/content/"
	xmlns:wfw="http://wellformedweb.org/CommentAPI/"
	xmlns:dc="http://purl.org/dc/elements/1.1/"
	xmlns:atom="http://www.w3.org/2005/Atom"
	xmlns:sy="http://purl.org/rss/1.0/modules/syndication/"
	xmlns:slash="http://purl.org/rss/1.0/modules/slash/"
	>

<channel>
	<title>ModernAdmin &#187; Jaunty</title>
	<atom:link href="http://modernadmin.com/tag/jaunty/feed/" rel="self" type="application/rss+xml" />
	<link>http://modernadmin.com</link>
	<description>Everyday admin tasks made easy</description>
	<lastBuildDate>Fri, 23 Sep 2011 06:54:58 +0000</lastBuildDate>
	<language>en</language>
	<sy:updatePeriod>hourly</sy:updatePeriod>
	<sy:updateFrequency>1</sy:updateFrequency>
	
		<item>
		<title>Creating HyperVM Xen templates for Ubuntu 9.04 Jaunty</title>
		<link>http://modernadmin.com/2009/04/28/creating-hypervm-xen-templates-for-ubuntu-904-jaunty/</link>
		<comments>http://modernadmin.com/2009/04/28/creating-hypervm-xen-templates-for-ubuntu-904-jaunty/#comments</comments>
		<pubDate>Tue, 28 Apr 2009 22:12:23 +0000</pubDate>
		<dc:creator>admin</dc:creator>
				<category><![CDATA[HyperVM]]></category>
		<category><![CDATA[Virtualisation]]></category>
		<category><![CDATA[Xen]]></category>
		<category><![CDATA[Jaunty]]></category>
		<category><![CDATA[Ubuntu]]></category>

		<guid isPermaLink="false">http://modernadmin.com/?p=23</guid>
		<description><![CDATA[Before reading this post it may be useful to know you can download our own created Ubuntu 9.04 Jaunty image created using these instructions from our OpenVZ and Xen VPS OS templates for HyperVM page. [...]]]></description>
			<content:encoded><![CDATA[<p>Before reading this post it may be useful to know you can download our own created Ubuntu 9.04 Jaunty image created using these instructions from our <a href="http://modernadmin.com/downloads/?d=ostemplates">OpenVZ and Xen VPS OS templates for HyperVM</a> page.</p>
<p>As always, instructions will be brief. If you feel I have missed out some important detail, feel free to comment and I *may* update the article.</p>
<p>First create and mount a 10GB ext3 filesystem for our image:</p>
<blockquote><p>sudo lvcreate -L 10G -n template.modernadmin.com-disk VolGroup00<br />
sudo mkfs.ext3 /dev/VolGroup00/template.modernadmin.com-disk<br />
sudo mkdir /mnt/tmp<br />
sudo mount /dev/VolGroup00/template.modernadmin.com-disk /mnt/tmp</p></blockquote>
<p>Next, we install debootstrap. Since version 1.0.10-2.fc11+ has dependency problems on CentOS 5.3, we&#8217;ll use an older version I have mirrored here:</p>
<blockquote><p>wget http://www.modernadmin.com/downloads/ostemplates/debootstrap-1.0.10-1.fc10.noarch.rpm<br />
sudo rpm -Uvh debootstrap-1.0.10-1.fc10.noarch.rpm</p></blockquote>
<p>Since jaunty specific scripts are not in this release of debootstrap, lets copy from gutsy:</p>
<blockquote><p>sudo cp /usr/share/debootstrap/scripts/gutsy /usr/share/debootstrap/scripts/jaunty</p></blockquote>
<p>Now install jaunty into /mnt/tmp using debootstrap:</p>
<blockquote><p>sudo debootstrap &#45;&#45;include=udev,ssh,quota &#45;&#45;arch amd64 jaunty /mnt/tmp http://uk.archive.ubuntu.com/ubuntu/</p></blockquote>
<p>We need to copy modules into the template &#8211; these will be specific to your Xen host node(s). In our case we have a few custom sets, but for now we only want the latest version:</p>
<blockquote><p>sudo cp -dpR /lib/modules/2.6.18-128.1.6.el5xen /mnt/tmp/lib/modules/</p></blockquote>
<p>Populate the sources.list file for apt-get:</p>
<blockquote><p>sudo cat &lt;&lt;EOF &gt; /mnt/tmp/etc/apt/sources.list<br />
deb     http://gb.archive.ubuntu.com/ubuntu/     jaunty main restricted universe multiverse<br />
deb-src http://gb.archive.ubuntu.com/ubuntu/     jaunty main restricted universe<br />
deb     http://gb.archive.ubuntu.com/ubuntu/     jaunty-updates main restricted universe multiverse<br />
deb-src http://gb.archive.ubuntu.com/ubuntu/     jaunty-updates main restricted universe<br />
deb http://security.ubuntu.com/ubuntu jaunty-security main restricted universe<br />
deb-src http://security.ubuntu.com/ubuntu jaunty-security main restricted universe<br />
EOF</p></blockquote>
<p>Create a temporary interface which will be removed later on. Also populate some other required files:</p>
<blockquote><p>sudo cat &lt;&lt;EOF &gt; /mnt/tmp/etc/network/interfaces<br />
auto eth0 lo<br />
iface eth0 inet static<br />
address 95.154.208.250<br />
netmask 255.255.255.0<br />
up route add -net 95.154.208.0 netmask 255.255.255.0 dev eth0<br />
up route add default gw 95.154.208.1<br />
iface lo inet loopback<br />
EOF<br />
sudo cat &lt;&lt;EOF &gt; /mnt/tmp/etc/hosts<br />
127.0.0.1       localhost template.modernadmin.com<br />
EOF<br />
sudo cat &lt;&lt;EOF &gt; /mnt/tmp/etc/hostname<br />
template.modernadmin.com<br />
EOF<br />
sudo cat &lt;&lt;EOF &gt; /mnt/tmp/etc/fstab<br />
proc            /proc           proc    defaults        0       0<br />
devpts          /dev/pts        devpts  defaults        0       1<br />
/dev/sda2      none            swap    sw                      0       1<br />
/dev/sda1      /       ext3    errors=remount-ro       0       1<br />
EOF<br />
sudo cat &lt;&lt;EOF &gt; /mnt/tmp/etc/event.d/xvc0<br />
start on stopped rc2<br />
start on stopped rc3<br />
start on stopped rc4<br />
start on stopped rc5</p>
<p>stop on runlevel 0<br />
stop on runlevel 1<br />
stop on runlevel 6</p>
<p>respawn<br />
exec /sbin/getty 38400 xvc0<br />
EOF<br />
sudo rm -rf /mnt/tmp/etc/event.d/tty1<br />
sudo echo &#8220;alias eth0 xennet&#8221; &gt; /mnt/tmp/etc/modprobe.d/xen<br />
#echo &#8220;xvc0&#8243; &gt;&gt; /mnt/tmp/etc/securetty<br />
sudo cat /dev/null &gt; /mnt/tmp/etc/udev/rules.d/70-persistent-net.rules</p></blockquote>
<p>This next section is completely optional. We will install DenyHosts and any other custom packages to further secure the virtual machines by default.</p>
<p>First, chroot to the new template and set a root password:</p>
<blockquote><p>sudo chroot /mnt/tmp</p>
<p>passwd root</p></blockquote>
<p>Exit the chroot and unmount the template from the host node:</p>
<blockquote><p>exit<br />
sudo umount /mnt/tmp</p></blockquote>
<p>Start the VM:</p>
<blockquote><p>sudo xm create template.modernadmin.com.cfg -c</p></blockquote>
<p>Inside the Xen domU you have just started, install denyhosts, configure as required and then shutdown:</p>
<blockquote><p>apt-get -y update<br />
apt-get -y upgrade<br />
apt-get -y install denyhosts<br />
apt-get -y clean<br />
shutdown -h now</p></blockquote>
<p>This step is also optional and only applies if you started the VPS as above and is simply a cleanup step:</p>
<blockquote><p>sudo mount /dev/VolGroup00/template.modernadmin.com-disk /mnt/tmp<br />
sudo rm -f /mnt/tmp/etc/ssh/ssh_host_*<br />
sudo cat &lt;&lt; EOF &gt; /mnt/tmp/etc/rc2.d/S15ssh_gen_host_keys<br />
#!/bin/bash<br />
ssh-keygen -f /etc/ssh/ssh_host_rsa_key -t rsa -N &#8221;<br />
ssh-keygen -f /etc/ssh/ssh_host_dsa_key -t dsa -N &#8221;<br />
rm -f \$0<br />
EOF<br />
sudo chmod a+x /mnt/tmp/etc/rc2.d/S15ssh_gen_host_keys<br />
sudo cat &lt;&lt;EOF &gt; /mnt/tmp/etc/network/interfaces<br />
# loopback interface<br />
auto lo<br />
iface lo inet loopback<br />
EOF</p>
<p>sudo cat /dev/null &gt; /mnt/tmp/var/log/apt/term.log<br />
sudo cat /dev/null &gt; /mnt/tmp/var/log/auth.log<br />
sudo cat /dev/null &gt; /mnt/tmp/var/log/boot<br />
sudo cat /dev/null &gt; /mnt/tmp/var/log/bootstrap.log<br />
sudo cat /dev/null &gt; /mnt/tmp/var/log/btmp<br />
sudo cat /dev/null &gt; /mnt/tmp/var/log/daemon.log<br />
sudo cat /dev/null &gt; /mnt/tmp/var/log/debug<br />
sudo cat /dev/null &gt; /mnt/tmp/var/log/denyhosts<br />
sudo cat /dev/null &gt; /mnt/tmp/var/log/dmesg<br />
sudo rm -rf /mnt/tmp/var/log/dmesg.*<br />
sudo cat /dev/null &gt; /mnt/tmp/var/log/dpkg.log<br />
sudo cat /dev/null &gt; /mnt/tmp/var/log/faillog<br />
sudo rm -rf /mnt/tmp/var/log/fsck/*<br />
sudo cat /dev/null &gt; /mnt/tmp/var/log/kern.log<br />
sudo cat /dev/null &gt; /mnt/tmp/var/log/lastlog<br />
sudo cat /dev/null &gt; /mnt/tmp/var/log/lpr.log<br />
sudo cat /dev/null &gt; /mnt/tmp/var/log/mail.err<br />
sudo cat /dev/null &gt; /mnt/tmp/var/log/mail.info<br />
sudo cat /dev/null &gt; /mnt/tmp/var/log/mail.log<br />
sudo cat /dev/null &gt; /mnt/tmp/var/log/mail.warn<br />
sudo cat /dev/null &gt; /mnt/tmp/var/log/messages<br />
sudo cat /dev/null &gt; /mnt/tmp/var/log/pycentral.log<br />
sudo cat /dev/null &gt; /mnt/tmp/var/log/syslog<br />
sudo cat /dev/null &gt; /mnt/tmp/var/log/udev<br />
sudo cat /dev/null &gt; /mnt/tmp/var/log/user.log<br />
sudo cat /dev/null &gt; /mnt/tmp/var/log/wtmp<br />
sudo cat /dev/null &gt; /mnt/tmp/root/.bash_history<br />
sudo cat /dev/null &gt; /mnt/tmp/etc/udev/rules.d/70-persistent-net.rules</p></blockquote>
<p>Finally, package the system into a .tar.gz and you are good to go!</p>
<blockquote><p>cd /mnt/tmp<br />
sudo tar czf /home/hypervm/xen/template/ubuntu-9.04-x86_64-modernadmin.tar.gz .<br />
sudo chmod 755 /home/hypervm/xen/template/ubuntu-9.04-x86_64-modernadmin.tar.gz</p></blockquote>
<p>Feel free to reproduce this article elsewhere but please give ModernAdmin.com credit where possible. A link back to our site goes a long way and would be greatly appreciated!</p>
]]></content:encoded>
			<wfw:commentRss>http://modernadmin.com/2009/04/28/creating-hypervm-xen-templates-for-ubuntu-904-jaunty/feed/</wfw:commentRss>
		<slash:comments>4</slash:comments>
		</item>
	</channel>
</rss>

