Remote reinstall of linux over ssh

Solution 1:

The way to achieve your goal, without having the ability to boot from cd/network/external device, is to use the existing installation to install a fresh OS to another filesystem and then, once you're done, tell the bootloader to boot to the new filesystem. This was much more common in times past (perhaps 10 years or more ago) than it is now, and if you search you will find discussion of exactly this. I have done this in the distant past with slackware, gentoo, linuxfromscratch and others, but I think it can be done, without too much effort, with most modern linux/BSD distributions.

For example, in Slackware's setup you can specify a 'target' which by default is /, but you would set it to where you had mounted your secondary filesystem.

Gentoo's installation handbook makes it quite clear; all you would need to think about would be the sections on 'preparing your disks' and 'configuring your bootloader'.

Having said all that, this is not trivial and if you don't have a good understanding of how things work, you're unlikely to get it right the first time. It will be an interesting educational experience, but since you have physical access, you'll probably get a quicker, better result by working out how to remove the constraint that means you can't use a more typical installation process. In other words, add a cd drive or something.

Solution 2:

Even though this article talks about Suse instead of Debian, the process is much the same. It seems that the author is installing linux remotely through SSH much like you are talking about. Take a look at the screen shots and you should be able to work through this.

Good luck and hope this helps some.

Solution 3:

look in to link what we do with redhat or centos to install on remote http://kbase.redhat.com/faq/docs/DOC-10526 if can help you

Solution 4:

You can use debootstrap to install to another partition (aside: hopefully you already use lvm for partitioning flexibility), and reboot to that partition. A neat trick trick to reboot without changing your bootloader is kexec.

Once your system is stable, you'll have to tell the bootloader about the new partition; you can use grub-reboot to boot the new entry and grub-set-default for a permanent change to the new entry.