Headless Ubuntu
From charlesreid1
Overview
This page covers how to download, modify, and install a Ubuntu installation on a headless server using a Mac OS X to prepare the disk image.
To install Ubuntu on the headless server, I modified a Ubuntu install image to be a "No Questions Asked" installation - that is, install a minimal version of the operating system, and an SSH daemon. Once that's done, we can log in to the headless server and configure everything from there.
Mounting the Disk Image
I downloaded a disk image from http://xubuntu.org, since xubuntu is my favorite distro. The disk image went onto my Mac OS X. This was a .iso file.
However, Ubuntu distributes iso files that make Macs choke, so we have to modify the iso file slightly to be able to mount it and modify it on a Mac.
Creating a device from the iso file
We will use Disk Utility to try and mount the iso file. While the mount will fail, it will create a device that we can use to extract the contents of the Ubuntu iso file.
First, locate the iso file you downloaded. Right click on the file and pick Open With > Disk Utility.
Now locate the iso file on the left hand side of the window. Right click the iso file and select "Open Disk Image".
This will attempt to mount the drive, and will throw an error. However, you will see that there is an unmounted disk called "disk1s1" (or some variant of that). What we're going to do is turn that unmounted disk into a new iso file, and that new iso file will then be mountable on a Mac.
The /dev/disk1s1 is now a device, even though it is not mounted. Now we can interact with the device.
Turn the disk device into an extracted iso file
Now we run a command to turn the disk1s1 device into a new iso file using the dd command. Assuming you have downloaded your iso file to ~/Downloads, you would execute the following command:
dd if=/dev/disk1s1 of=/Users/charles/Downloads/xubuntu-extracted.iso bs=1m
We are specifying an input file (if) that is the device we mounted, which contains the contents of the Ubuntu installation. We are also specifying an output file (of) that is the "extracted" iso image. This extracted iso image will be mountable by Mac.
You should see some output like this:
$ dd if=/dev/disk1s1 of=./xubuntu-extracted.iso bs=1m 969+1 records in 969+1 records out 1017085952 bytes transferred in 75.963258 secs (13389183 bytes/sec)
Mount the extracted iso file
Now you can mount the extracted iso file, by double clicking it. You should be able to see all of the folders contained in the Ubuntu installer iso:
Modifying the Disk Image
Copying the iso contents
Because iso files are designed to be read-only file systems, and we want to modify the iso, we will need to copy all the data off the iso file, then modify the contents, then create a new iso file.
We can start by making a new folder on the hard drive and copying the contents of the disk (that came from the iso we mounted) into the folder.
Modifying the iso contents
We now modify the iso contents to make the installation CD install xubuntu by default (following instructions from [here http://askubuntu.com/questions/409607/how-to-create-a-customized-ubuntu-server-iso]):
