How can I install Ubuntu on a device without a screen nor a keyboard?

The method mentioned in the comment above with installing Ubuntu on a different computer to just move the hard drive to the headless machine certainly is an elegant and probably the fastest method to get Ubuntu installed. In most cases hardware will be recognized and drivers will be provided on boot (not on installation). This makes installation of drivers unnecessary unless we do need proprietary drivers (e.g. for some very special network cards).

But there is another way we can install Ubuntu unattended by creating a custom CD-ROM, USB or from a network solution (Preseed). See this rather complete guide on the steps and tuning procedures involved:

  • Ubuntu Documentation: Preseed (amd64)

You may also find the following related questions helpful:

  • How do I create a completely unattended install of Ubuntu?
  • How can I install Ubuntu on a headless machine?

Another option, using Serial console:

  1. Add serial 0 9600 0×003 to isolinux.cfg for CD or syslinx.cfg for USB
  2. Add console=ttyS0,9600n8 to kernel append parameters in text.cfg that contains menus.
  3. Connect it to another PC, with serial port (or with USB/Serial adapter), use Putty or Minicom with same settings 9600n8, then boot
  4. Follow installation through serial console.
  5. If want to make it permanently boot to serial console, follow instructions here:

    https://help.ubuntu.com/community/SerialConsoleHowto

Reference: Ubuntu Server 10.10 headless installation via serial console


You could use a No Question Asked preseeded debian-installer which installs just the base server and ssh package. On reboot you will be able to ssh into the running system and further install and configure from there.

There is an example of a preseed file here: https://help.ubuntu.com/community/Cobbler/Preseed

You can follow the normal iso to usb instructions https://help.ubuntu.com/community/Installation/FromUSBStick and then edit the syslinux/txt.cfg file on the usb boot stick to point to your preseed file and copy your preseed file to the preseed directory on the usb boot stick:

label custom
  menu label ^Install Custom Ubuntu Server
  kernel /install/vmlinuz
  append  file=/cdrom/preseed/ubuntu-custom.seed initrd=/install/initrd.gz quiet ks=cdrom:/isolinux/ks-custom.cfg --

Notice the second to last line in the preseed file installs openssh server package:

d-i     pkgsel/include string byobu vim openssh-server

Check the logs on your DHCP server to get the IP address of the newly booted system and ssh to it as the ubuntu user. The password in the example preseed is also 'ubuntu' (without quotes).


I write a simple solution based on preseed.

https://github.com/mhf-ir/ubuntu-overssh-reinstallation

You need installed version of ubuntu that have ssh. another http server for serving preseed file. I tested so many times in many datacenters.