Ubuntu – Most simple way to create a bootable USB stick for headless installation with SSH enabled

live-usbsshsystem-installation

What is the most simple way to create a bootable Ubuntu USB Stick that either does a standard Ubuntu server install with SSH enabled or allows to do the installation over ssh. (IP can be obtained via dhcp).

Edit: The device (installation target) has no Display or Keyboard attached.

I'm looking for something straight forward that is easily reproduceable and does not require significant time and effort to create.

I'd think with all the raspis, NUCs etc. out there this is a common problem and already well solved?

Best Answer

Install the OS on the stick just as you would a normal hard drive.

Use the install option to use the whole drive for Ubuntu.dapo

  • Download the Live iso Installer from http://www.ubuntu.com/download/desktop.

  • Burn the iso to media (USB or DVD)

  • Boot to the media and select Try Ubuntu without Installing.

  • Run the Install Ubuntu app that's on the desktop.

  • Follow the install prompts' default by clicking on continue until you get to the Install type

  • Install Type: Select Erase disk and install Ubuntu (since this is a USB, presuming there's nothing of value on it). The system will warn you that this will delete all your programs, documents, photos, music, and any other file and operating systems from the chosen drive (the next step will be to choose the drive).

  • Select Drive Use the drop-down to select the drive which is the USB stick. Be careful not to choose the wrong drive. You can identify the USB stick by cues such as the size, the /dev/sdX (X is the drive letter specification), and the Pen drive manufacturer. The letter should be higher than /dev/sda, wheres /dev/sda is most likely your default boot disk internal to your computer.

  • Click Install Now. Ubuntu will give a couple more warning advising you what it's going to do as far as removing partitions. It'll show you the specific drive that is about to be processed.

  • Answer the screen for your username and password and click continue.

  • After the install process completes which can be done in 10 minutes including the steps above reboot and run the commands below.

Boot to the stick after the installation. Run these commands:

$ sudo apt update
$ sudo apt upgrade
$ sudo apt install openssh-server

That's it. You now have your bootable USB stick with SSH enabled.