Prepare Fedora Server for use on Azure.

I am invested in the Microsoft ecosystem so my personal computers run Windows 10. For the purpose of data science though, life becomes markedly simpler with a UNIX derivative. A lot of important software assumes that environment variables are set up a certain way, or that directory structures are a certain way, or that POSIX and GNU tools are available. All of this can be arranged in Windows, of course, but given how rapidly data science software is evolving, it’s just easier to cross off one source of trouble from the start.
For production environments Red Hat Enterprise Linux would be a good choice given it’s interoperability and support options. It’s software is always irritatingly old though, so I’ll use Fedora Server instead, which is what RHEL will look like in a few years anyway.

  • Go to “Turn Windows Features on or off” on your local computer, activate Hyper-V, and reboot.
  • Download the latest 64-bit ISO: Fedora Server 23
    Fedora_logo_and_wordmark

 
Start the Hyper-V manager and create a new VM.

  • Give it a name with a number like ltlabs01 since you might want it to be part of a cluster later
  • Choose “Generation 1”
  • Choose to attach a disk later.

Now the VM is created. Select it and click settings.

  • Give your VM as much memory and CPU cores as you want
  • Select the DVD Drive and add the ISO you just downloaded
  • Select IDE Controller 0 and Add Hard Drive.
    • Create a new Virtual hard disk.
    • Select VHD format
    • Choose a clever name like ltlabs01osdisk01.vhd
    • Keep it small like 32GB
Start your virtual machine and install Fedora.
  • Software Selection: Minimal Install with Add-Ons Standard, Guest Agents, and Editors
  • Installation Destination
    • Choose the disk, select “I will configure partitioning”. Done.
    • Change LVM to Standard Partition, then “create them automatically”
    • Select the swap space and remove it
    • Select the / partition and change the capacity to fill the available space
      • You should have a / partition in XFS, and /boot in EXT4
    • Done. Done.
  • Begin Installation
    • Set a root password and add a user (make administrator)
  • When the installation is finished, choose Media and eject the DVD.
Prep your new VM
If you’re not acquainted with Fedora then read their excellent documentation.
  • Check that sshd is running
    • Log in to the vm with the user you created before
    • Type: ifconfig
    • Note the IP address and connect to the VM with Putty
  • Upgrade the system
    • Type sudo dnf upgrade
    • Reboot: halt -r
  • Install Windows Azure Agent
    • Type: sudo dnf install rpm-python WALinuxAgent
    • Type: sudo waagent -install -verbose
    • Type: sudo vi /etc/waagent.conf OR sudo nano /etc/waagent.conf
      • Edit the following
        ResourceDisk.Filesystem=xfs
        ResourceDisk.MountPoint=/mnt/resource
        ResourceDisk.EnableSwap=y
        ResourceDisk.SwapSizeMB=16384
      • Save
  • Configure Grub2
    • Type: sudo vi /etc/default/grub
    • Edit the following
      GRUB_CMDLINE_LINUX="console=ttyS0 earlyprintk=ttyS0 rootdelay=5"
    • Make it official: sudo grub2-mkconfig -o /boot/grub2/grub.cfg
  • Deprovision the machine
    • Reboot
    • Confirm the boot process was not “graphical” this time
    • Confirm the network is up with ifconfig
    • Confirm the Azure agent is running with ps aux | grep waagent
    • Type: sudo waagent -force -deprovision
  • Shut Down: halt -p
Now your image is ready to be uploaded to Azure!