API Quickies – Bring Your Own Windows
What if you’ve already purchased a Windows license? Or, what if you want to run a version of Windows other than those we offer? In either case, you might elect to bring your own OS.
I’m going to demonstrate how to upload an ISO and install from it. For this example, I’m going to use Windows 7. But, these instructions should get you through the installation of any OS. They are, in fact, how we upload our pre-installed images.
While we have decent selection of Linux and Windows pre-installed servers available, there are enough Linux builds to fill a Panamax freighter with DVDs. And, while we have Windows servers, we’ve only a few and they require that you pay the licensing costs through us.
I’m going to upload an ISO, from which I’ll install Windows 7 on a blank disk in my account at Open Hosting. The computer I’m using for this demo is a Mac. The steps are the same for Linux. But, Windows users should first install Cygwin.
Install the Open Hosting API Scripts*
Download the Open Hosting API download script: openhosting-download.sh
Make the script executable by typing:
chmod +x openhosting-download.sh
Next download the drive upload tool and make it executable: openhosting-upload.sh
chmod +x openhosting-download.sh
Set the Session Variables
In order to interact with the platform by the API, two session variables need be set. The first is the API’s URI:
(Don't forget the trailing slash!)
The second variable holds your authentication credentials, which are specific to your account and found on your account profile page: https://east1.openhosting.com/accounts/profile/
export OHAUTH=[user UUID]:[secret API key]
(don’t forget the colon between the UUID and API values!)
Upload the ISO
With the API scripts installed and my session variables set, I’m now ready to upload the ISO into my account. The upload script takes one argument, which is the name of the file to upload. In my home directory, I have a Windows 7 ISO, copied from a DVD, which I’ve renamed “Win_Pro_7.ISO”.Again, in my case, that’s “Win_Pro_7.ISO”.
Depending on your ISP and the overall mood of the Internet, this might take several hours, days, or a measure of time extending beyond the heat death of the universe. My Windows ISO is about 3GB and will take overnight to upload.
From the control panel, confirm that ISO is present.
With ISO successfully uploaded, it is time to build a server, boot the ISO, and install the OS.
Build A Server
Using the “Add Server or Drive” widget:
- Give your server a name, which is in my case “Win7″
- Select “Custom”
Before starting the server, create a blank drive and add it to your server. This blank drive is the destination of the installation — the place where Windows will actually be installed.
- Select “Drive only”
- Enter a name, for instance “win7-target”
- Leave the image set to “Blank”
- And, specify a size, which for Windows 7 should be at least 12GB
Next, configure the server by clicking on the icon with the two blue gears.
- For CPU, set at least 2000 core-MHz
- For memory, set at least 2000 MB
- It is recommended that you buy and enable a firewall. To allow Windows Remote Desktop, set open port =tcp/3389
- Set ide:0:0 to media=”cdrom” and drive= “Win_7_Pro.ISO” and set it as boot
- Set ide:0:1 to media=”disk” and drive= “win_7_target”
And click “save” in the upper-right.
At this point, you should have a server that’s configured to mount two drives, one of which is an ISO and the other a blank drive. In my case, they look like this (notice a check-mark by ISO drive, which indicates it is to be booted):
Boot the Server and Run the Windows Installer
Now, I’ll boot the ISO, connect by VNC ** , and run the Windows installer. (Watch this video for an introduction on connecting by VNC.)
After installing Windows, shutdown the server, return to the server configuration page, remove the ISO, and mark the “win_7_target” as the boot-able drive.
If you’ve followed these instructions and installed a Windows desktop or server, you’ll probably want to enable Remote Desktop. In the case of the Windows 7 desktop I’ve installed:
- Click the Start Menu
- Type “remote”
- Click “allow remote access to your computer”
- Under Remote Desktop, click “Allow connections from computers running any version of Remote Desktop”
- Click “ok”
* Why not use FTP and skip the API?” Excellent question. Because it is slower, not secure, and less reliable than uploading through the API.
**VNC access requires a client supporting a recent version of the VNC protocol: TightVNC on Windows, Vinagre (or others built on gtk-vnc) on Linux and RealVNC on MacOS (where none of Apple Remote Desktop, Chicken of the VNC or JollysFastVNC work). RealVNC works on Windows, Linux and MacOS if you select “Always use best available color quality” – the Linux and MacOS versions are available as free downloads under Enterprise Edition Viewer.