Thursday, June 4, 2009

New Debian/Ubuntu image install howto

Some old note I gathered for installing a new debian/ubuntu image. This may be somewhat general and a better versionmay be available somewhere :). Do check it out.

apt-get install debootstrap
debootstrap --arch i386 [ubuntu version] /vz/private/1??
vzctl set 1?? --applyconfig vps.basic --save

Set the name of the template:
echo "OSTEMPLATE=ubuntu-?.?" >> /etc/vz/1??.conf

# Ignore this if it shows - Warning: configuration file for distribution ubuntu-?-? not found default used

vzctl set 1?? --ipadd 192.168.x.y --save
vzctl set 1?? --nameserver 192.168.x.z --save

Update the sources list in /vz/private/1??/etc/apt/sources.list if needed

vzctl start 1??

vzctl exec 1?? apt-get update
vzctl exec 1?? apt-get -u upgrade
vzctl exec 1?? apt-get install ssh libedit2 openssh-client openssh-server

vzctl exec 1?? sed -i -e '/getty/d' /etc/inittab

vzctl exec 1?? rm -f /etc/mtab
vzctl exec 1?? ln -s /proc/mounts /etc/mtab

### Now the vps is ready to either run or to create a template

vzctl set 1?? --ipdel all --save
vzctl stop 1??

cd /vz/private/1??
tar czf /vz/template/cache/ubuntu-?.?-minimal.tar.gz .

# now cleanup
vzctl destroy 1??

To deploy use -
vzctl create 10? --ostemplate ubuntu-?.?-minimal --config vps.basic

Readers who read this page, also read:

Bookmark and Share My Zimbio