59
edits
Changes
upgrade to an easier install process with chroot
Run debootstrap to install a minimal Ubunty Gutsy system into that directory:
# debootstrap [--arch ''ARCH'' ] gutsy gutsy-chroot
==== Moving installation to VE private area =chrooting ===
[VE0]# mkdir /vz/private/777 # mv cd gutsy-chroot; chroot ./ /vz/private/777
Some packages does not make sense in a VE. Remove those:
[VE]# rm -fr /lib/udev
On a usual Linux system, getty is running on a virtual terminals, which a VE does not have.
First way:
[VE]# rm /etc/event.d/tty*
Second way:
[VE]# dpkg -P system-services
Second way can be dangerous for future versions of system-services, but it's OK for now since the only service they carry is running gettys.
[VE]# chmod 700 /root
[VE]# usermod -L root
[VE]# apt-get update && apt-get upgrade
<small>This didn't show anything for me, but might do something in the future.</small>
[VE]# apt-get install ssh quota
Feel free to add packages which you want to have in a default template to this command.
This is only useful if you installed SSH above. Each individual [[VE]] should have its own pair of SSH host keys. The code below will wipe out the existing SSH keys and instruct the newly-created [[VE]] to create new SSH keys on first boot.
Turn off doing <tt>sync()</tt> on every write for <code>syslog</code>'s log files, to improve overall I/O performance.
<pre>[VE]# sed -i -e 's@\([[:space:]]\)\(/var/log/\)@\1-\2@' /etc/syslog.conf</pre>
Link <code>/etc/mtab</code> to <code>/proc/mounts</code>, so <code>df</code> and friends will work:
[VE]# rm -f /etc/mtab
[VE]# update-rc.d -f mtab.sh remove
[VE]# sed -ie '/tmpfs/d' /etc/init.d/mountkernfs.sh
In most of the cases you don't want klogd to run -- the only exception is if you configure iptables to log some events -- so you can disable it:
[VE]# update-rc.d -f klogd remove
After installing packages, you'll have some junk packages laying around in your cache. Since you don't want your template to have those, this command will wipe them out.
[VE]# apt-get clean
Set propper hostname and file /etc/hosts
[VE]# echo "localhost" > /etc/hostname
[VE]# echo "127.0.0.1 localhost.localdomain localhost" > /etc/hosts
Now everything is done. Exit from the template and go back to the hardware node.
[VE]# umount /proc
[VE]# exit
== Build precreated VZ OS Template == [VE0]# tar -xzf /var/lib/vz/template/cache/ubuntu-7.10-<bigarch>-minimal.tar.gz ./ == Update a VE OS Template == Chroot to your debstrapped system [VE0]# cd <bigdir>To be continued; chroot ./ Update and Install updates [VE] # apt-get update && apt-get upgrade Cleanup [VE] # apt-get clean Clean unused log files, .bash_history etc. [VE] # exit Build your updated VE OS Template [VE0]# tar -xzf /var/lib/vz/template/cache/ubuntu-7.10-</bigarch><-minimal.tar.gz ./big>