OK, My answer assumes you can, and have backed up your user directory, and everything you want to save. which reduces your question to how do I install Ubuntu on a remote server? To which there are many solutions.
For this, you could use DRBL, to remotely deploy an operating system, with a variety of options for booting. You can look into it here: http://drbl.org/installation/
There is Clobber:
There is cloneZilla, which can back up and restore over a network.
The link is for windows, but the same methods apply for linux. Alternatively, you could make an ubuntu boot image locally, and install it using clonezilla.
Alternatively, you could try using dd_rescue, or netcat
A useful search term might be "Server Provisioning". There are more options then these.
There are bruteforce methods too.
$ ls /
bin boot cdrom dev etc home initrd.img initrd.img.old lib lib64 lost+found media mnt opt proc root run sbin srv sys tmp usr var vmlinuz vmlinuz.old
and your PATH were like this:
if your root directory were something like this, if you over wrote /etc, and /usr with "clean" versions, you would be overwriting, pretty much every piece of installed software, and the config files for it. That would be hackerish to say the least, if not a completely horrible idea. Running
apt-get purge would be much safer, Or perhaps you could fine tune the process a little bit. You might then also want to include a clone of your old ssh config file in /etc/ssh/ before trying to restart the services with new config files.
There is also a tool that lets you dump a running kernel and upgrade without rebooting. For that you could check out Kslpice, or kGraft
If all you are having trouble with is repos and package management, I'm not sure why you would want to dump the kernel, mbr, boot partition etc..
So any how, I hope Ive given you some ideas to look into. There are many ways to depoly a server remotely.