Linux – Remote Linux installation over the network

installationlinuxremote-access

Long story short – I have to remotely install an arbitrary Linux distro on a PC over the network. This is not a server and I will be installing a desktop environment.

The problem is I don't have physical access to the machine and it doesn't have a monitor, keyboard or a mouse – so the only help I can get from the guys where the machine is to plug it to the network and turn it on. On top of that the PC is brand new so it doesn't have an existing OS.

On the bright side I have root SSH access to a Linux server in the same local network as the PC…

How would I go about installing the OS, while doing the whole process remotely?

Thanks in advance!

Best Answer

You need a physical intervention on site anyway, so why not ask one of the people on-site to plug a USB key (prepared by you, or written with a ISO made by you) in the machine before booting it ? If you prepare this key with a listening netcat then you can directly write the HD from the network.

Once the live OS is booted, it should automatically launch

nc -l 3000 | dd bs=1M of=/dev/sda

and it should also ping your local machine so you can guess it's IP.

Once you have the IP you run from your local machine:

dd bs=1M if=/images/myimage | nc remoteIP 3000; end command

This will dump /images/myimage directly to the remote /dev/sda. "end command" is a sendmail command or anything that will confirm to you that the operation is finished.

You can also do the opposite and run netcat as a server on your local machine and dump the image from the remote machine, it should make the firewall bypassing easier.

It require a DHCP server and a person to plug the USB key, that's it. No PXE, no (or very few) surprise.

Related Topic