This server provides smtp, pop3 and imap. It also provides the ssl versions of these protocols. The old server provided squirrelmail on apache, but I’m not going to impliment that on this server.
The physical server is still running sarge. The vm is running etch. With gopher that jump worked, but this is a much more complex host. I tried deploying gopher across versions and ran in to problems, so I upgraded the physical server and made sure everything works first. I will do it this way in the future as well.
After a PAINFUL experience because a courier directive changed…
LDAP_SERVER changed to LDAP_URL
This is a great URL for troubleshooting http://www.courier-mta.org/authlib/README.authdebug.html
# cd /xen
# mkdir gopher
# cd gopher/
# tar xjvf ../debian-4.0-20070801.tar.bz2
debian-4.0.img
debian-4.0.xen3.cfg
debian.swap
The sizes were 500M, 20M and 200M and they rounded up by lvcreate.
lvcreate -L512M -n gopher-usr VolGroup00 && \
lvcreate -L32M -n gopher-home VolGroup00 && \
lvcreate -L224M -n gopher-tmp VolGroup00 && \
lvcreate -L5G -n gopher-var VolGroup00
mkfs -t ext3 /dev/VolGroup00/gopher-usr
mkfs -t ext3 /dev/VolGroup00/gopher-var
mkfs -t ext3 /dev/VolGroup00/gopher-tmp
mkfs -t ext3 /dev/VolGroup00/gopher-home
Make the last 3 bytes of the MAC:
dd if=/dev/urandom bs=1 count=3 2>/dev/null | od -tx1 | head -1 | cut -d' ' -f2- | tr -d ' ' | tr '[a-f]' '[A-F]'
/vserver/gopher/gopher.cfg
kernel = "/boot/vmlinuz-2.6-xenU"
memory = 384
name = "gopher"
vif = [ 'bridge=xenbr0,mac=00:16:3e:CF:AA:21' ]
dhcp = "dhcp"
disk = ['file:/xen/gopher/debian-4.0.img,sda1,w'
, 'file:/xen/gopher/debian.swap,sda2,w'
, 'phy:VolGroup00/gopher-usr,sda5,w'
, 'phy:VolGroup00/gopher-home,sda6,w'
, 'phy:VolGroup00/gopher-tmp,sda7,w'
, 'phy:VolGroup00/gopher-var,sda8,w'
]
root = "/dev/sda1 ro"
ramdisk = "/boot/initrd-2.6-xenU.img"
I linked the config and restarted the server to test.
ln -s /xen/gopher/gopher.cfg /etc/xen/auto/gopher.cfg
xm create -c gopher.cfg
192.168.0.218
ssh’d to the VM, default password of “password”
Created flip script. vm flip filesystems
~/flip sda5 usr
mount /dev/sda6 /home
# ~/flip sda6 home
# home is empty so it just gives an error. just umount and then mount it to /home
# maybe I will fix this... or not.
~/flip sda7 tmp
~/flip sda8 var
Set the IP variable, imported /etc.
export IP='192.168.0.1'
mkdir ~/etc
cp /etc/mtab ~/etc/ && \
cp /etc/init.d/makedev ~/etc/init.d/ && \
rsync -e ssh -avz root@$IP:/etc/* /etc/ && \
cp -R ~/etc/* /etc/
Change hd? to sd?. Used nano and remarked out cd and floppy. Made note of swap, sda9.
I started a ~/etc/ so that if we need to resync etc we just copy it back to /etc.
mv /etc/fstab{,~} && sed 's#/hd#/sd#' /etc/fstab~ >/etc/fstab
nano /etc/fstab && cp /etc/fstab ~/etc/
I changed the IP to a temp address during the initial reboot. This can cause a little trouble, but less than having 2 machines with the same IP.
nano /etc/network/interfaces && cp /etc/network/interfaces ~/etc/network/
grep -i documentroot /etc/apache-ssl/httpd.conf
DocumentRoot /var/www/ssl
mkdir -p /var/spool
rsync -e ssh -avz root@$IP:/var/spool/* /var/spool/
mkdir -p /var/www
rsync -e ssh -avz root@$IP:/var/www/* /var/www/
mkdir -p /var/mail
rsync -e ssh -avz root@$IP:/var/mail/* /var/mail/
Fixed in the model, this is no longer needed.
As you may remember, I had to create a script to create /dev/urandom and start ssh. Debian 4.0 added rc.local and broke the link I made before.
There is an exit 0 that is required, but it needs to be at the bottom of the file. I started nano to remove exit 0 from the middle of the file and put it at the end.
cat /etc/init.d/local >>/etc/rc.local && nano /etc/rc.local
Next we are getting the package list from the running server and applying it to this one. In general, take the defaults to NOT change settings.
ssh $IP 'dpkg --get-selections' >~/selections.dpkg && \
dpkg --set-selections < ~/selections.dpkg && \
apt-get update && \
apt-get dselect-upgrade
If you get “4gb seg fixup” errors, this will probably fix it.
apt-get install libc6-xen
echo "hwcap 0 nosegneg" > /etc/ld.so.conf.d/nosegneg.conf
ldconfig -v -p 2>&1 | grep libc.so
ldconfig
I stopped postfix and ran this until there was nothing left to update.
rsync -e ssh -avz --delete root@$IP:/var/mail/* /var/mail/
restarted
restarting: shutdown -r now