1

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!

5
  • Is there a PXE environment already set up on the network? Can the IT staff throw in an install CD for you and start up openssh? If the answer to both of those is "no", then you're out of luck.
    – EEAA
    Jan 25, 2013 at 13:28
  • CD - no. I think I should be able to install PXE on the Linux server I have access to, but all of the PXE installation guides I've seen require the user to be at the physical machine to go through the installation process. Jan 25, 2013 at 13:32
  • There is that, yes, and you will also need to modify the DHCP setup on that network to get PXE working.
    – EEAA
    Jan 25, 2013 at 13:33
  • Check if the hardware supports Intel VPro or similar tech. Many desktop PCs, (even my laptop does) support it nowdays. It allows for remote KVM over network using just a browser or a light client.
    – sivann
    Jan 25, 2013 at 18:00
  • This sounds interesting - it seems that the 3770 supports it but the H77 chipset doesn't - so I'm out of luck. Unfortunately this requires someone actually configuring Intel AMT on the host computer. Jan 25, 2013 at 18:19

3 Answers 3

5

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.

3
  • I have to say, that is a hacky, really really COOL way to do it! Very clever!
    – Matthew
    Jan 25, 2013 at 17:02
  • I love the netcat idea! I think it would be better though to open a SSHd on the target machine rather than listen. Only thing left is to roll a small LFS distro with openssh and make a small tutorial for the guys at the remote site on how to prepare the USB stick (they are using iMacs so I could basically SSH into one of them and prepare the stick myself). I guess I should install the OS in a VM and dd of its drive - this will be my image. Will the OS boot properly, as I am afraid the installation is doing some hardware specific stuff (imagine moving a Windows install to another PC)? Jan 25, 2013 at 17:22
  • Although I solved the problem with a mix of all the above solutions (SSH -> PXE -> WOL -> netcat -> X11/SSH), I think your answer gave me a good idea of the steps I had to take. Feb 13, 2013 at 20:52
2

This is a tough problem. I think the easiest method would be to prepare a hard disk with a completely configured OS and just ship it to the remote location and have them install it into this machine. After all, this is not rocket science and can be done by untrained people with proper directions.

If that's not possible, you will need at least the possibility to add some statements to the DHCP server (next-server and filename) for this machine to allow booting via PXE from the linux server, and a static IP address for the machine from the DHCP.

After that, I would try to boot a live system via PXE and use it to download an image of an installed system and drop it onto the disk with dd or something similar.

It should also be possible to prepare a kickstart file for CentOS (or Fedora) that allows to completely install a system without any interaction (via PXE), but getting this right will take a lot of time.

3
  • I just opened a SSH proxy tunnel to the local network and played around with the router's web config - it seems I can temporarily disable the DHCP on it. Can this in combination of starting a DHCP server on the existing Linux machine, while the new one booting be of help? Jan 25, 2013 at 13:57
  • Yes, but you shouldn't just disable the DHCP server, at least not without discussing this with the remote site beforehand. Switching DHCP servers can be very disruptive.
    – Sven
    Jan 25, 2013 at 14:00
  • I could do that at night, when there isn't anyone at the office. That particular local network isn't running any mission-critical hardware that has to be visible to the WAN and all machines except the Linux server are turned off. The server has it's network configuration set manually, so temporarily disabling the router's DHCP won't interrupt it's connection. The main hurdle I'm facing is the specific PXE configuration and hijacking the TTY running the installation over (x+)SSH. Jan 25, 2013 at 14:08
0

Confirm your workstation supports PXE boot first.

Setup a PXE server on your linux server. Hopefully, it has more than one NIC so you can use one interface to connect to your server and setup a new DHCP-Build network on the other interface.

Take a look at Cobbler, Razor, or similar projects.

After PXE, you'll need installation media/repositories for a new OS install. Again, follow the instructions above.

Once you have all that, you need to physically network your new workstation to the DHCP-Build network port on your server. You can do this with a single ethernet cable or add a switch in the middle as you like.

Finally, you need remote hands to power up the new desktop and boot it into PXE boot mode.

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .