Adding an OpenVZ container

Create a new CT or template

Create CT

Add a users do not forget backup user
adduser username
Change user UID and GID to match those on the hypervisor
vi /etc/group
change the GID to the correct value i know this is not ideal but it works
usermod -u 3000 -g 3000 username
Put privliged users into sudo
sudo adduser username sudo

Open a port(s) in firewall on hypervisor
Add an entry in putty

Set Time
dpkg-reconfigure tzdata

Upload sshd key login as username
mkdir .ssh
vi .ssh authorized_keys

copy key from putty-gen or where ever you create your keys

Do updates
aptitude update
aptitude upgrade

Add some programs vim is needed for debian squeeze
aptitude install vim

reconfigure postfix see this post

dpkg-reconfigure postfix

Note you should have added and modified the backuppc user above
aptitude install sudo rsync
echo "backuppc ALL=NOPASSWD: /usr/bin/rsync" >> /etc/sudoers

On server

sudo -i
su backuppc
ssh-copy-id backuppc@hapkido

An example bind mount
Note sometimes rbind is needed


source /etc/vz/vz.conf
echo "Starting 209.mount..."
mount --bind /var/lib/vz/solar/pluto /var/lib/vz/root/209/home/solar/Downloads
echo "...209.mount complete"


source /etc/vz/vz.conf
echo "Starting 209.umount..."
umount /var/lib/vz/root/209/home/solar/Downloads
echo "...209.umount done"

This is older should be somewhere else
on host mount –bind /usr/local/backups/backuppc/ /var/lib/vz/root/202/mnt

on guest cp -dpR /var/lib/backuppc/. /mnt
on guest mv /var/lib/backuppc/ /var/lib/backuppc.orig
on guest mkdir /var/lib/backuppc

on host umount /var/lib/vz/root/202/mnt
on host mount –bind /usr/local/backups/backuppc/ /var/lib/vz/root/202/var/lib/backuppc

on guest /etc/init.d/backuppc restart
on guest rm -r /var/lib/backuppc.orig

Properly/permently mounting to an openvz container
coming soon

Leave a comment

Your email address will not be published. Required fields are marked *

This site uses Akismet to reduce spam. Learn how your comment data is processed.