Monthly Archive for December, 2011

migrate to a new linux server

i’m upgrad­ing my home server. a faith­ful 1GHz PIII with 512MB has served(!) me well for 4 years but i though it was time to expand. got a rather nice box with a 1.6GHz pro­cessor (quad core atom d510), 4GB of RAM and a 500GB SATA disk (room for another 2 disks also).

the old machine runs debian 6.0.3 and deals with a few chores…apache, postfix, remote ssh tun­nel­ling, sub­sonic and a couple of samba shares. the old install is obvi­ously 32 bit…the new one will be 64 bit (also running debian 6.0.3…i haven’t found a more stable server os) so that pre­vents a straight rsync as many of the pack­ages will be incom­pat­ible with the dif­fer­ent archi­tec­ture. a chum got me thinking…a simple way to get a new box running the same apps as the old one is to rep­lic­ate the pack­ages that are installed. this can be done simply with the following…on the old box issue the fol­low­ing in a terminal…doesn’t need to be as root…

dpkg –get-selections > installedpackages

this creates a file called ‘installed­pack­ages’ that con­tains all the applic­a­tions that have been installed on the old system. if you have the new server up and running and access­ible via ssh you can then copy the file over with scp…if not use USB

scp installed­pack­ages username@newserver:/home/username

this will plonk it into your home folder on the new machine. so now log into your new machine and as root issue the command

dpkg –set-selections < installedpackages

and then

apt-get dselect-upgrade

this will install all the pack­ages that ran on the old box…to the new one.

NB that this, obvi­ously, doesn’t move your /home dir­ect­or­ies, email, web sites or any con­fig­ur­a­tion files. you can do this via USB or using the scp method detailed above. lots of the con­fig­ur­a­tion files are stored in /etc, web sites are gen­er­ally in /var/www. i’m not dealing with things like mysql now but here’s some info on that.

Post to Twitter


Bear