Fedora 26 was
released earlier this week. I wanted to test how it works on Azure, and since Fedora is not currently available from Azure Marketplace I had to create my own VM image.
 |
Connected to Fedora 26 server running on Azure
|
Here is a small how to document I wrote during the exercise, feel free to try it out yourself!
Download the installation ISO
I used the Server edition since there's not much use for the graphical tools on Azure.
Create a local VM
I used a Windows 10 laptop running Hyper-V to create a local VM with the following details:
- generation 1 VM type (Hyper-V specific)
- 8GB disk (note: larger the file longer it takes to upload to Azure!)
- 1024 RAM startup memory (depending on your laptop's RAM size)
NOTE! do not make snapshots/checkpoints during VM creation. Otherwise exporting the image becomes difficult at least in Hyper-V.
Fedora 26 installation
- Standard partition (not LVM since Azure can't handle LVM booting well currently)
- XFS filesystem
- remove swap (Azure will add it later automatically)
- add only root password, no users
After installation is complete turn off the VM and remove the installation DVD ISO drive if needed.
Modify the VM
Linux VMs need to be modified a bit to be Azure compatible.
Start your new Fedora VM, log in and verify your networking works at this point:
ip addr show
Update the system:
dnf -y update
Edit network configuration to disallow Network Manager to mangle with the main interface:
/etc/sysconfig/network:
NETWORKING=yes
HOSTNAME=localhost.localdomain
/etc/sysconfig/network-scripts/ifcfg-eth0:
# add/edit these lines, remove all others including IPv6:
DEVICE=eth0
ONBOOT=yes
BOOTPROTO=dhcp
TYPE=Ethernet
USERCTL=no
PEERDNS=yes
IPV6INIT=no
NM_CONTROLLED=no
Turn of static udev rules for network devices, could break when cloning VMs:
ln -s /dev/null /etc/udev/rules.d/75-persistent-net-generator.rules
Ensure networking is started on boot:
systemctl enable network
Reboot and verify you still get an IP address. Much easier to fix at this point if you broke something.
Modify some boot options. Note the two
console= parameters to allow messages also on local console for debugging, remove other parameters if needed)
/etc/default/grub:
GRUB_CMDLINE_LINUX="rootdelay=300 console=tty0 console=ttyS0 earlyprintk=ttyS0 net.ifnames=0"
Generate new grub files:
grub2-mkconfig -o /boot/grub2/grub.cfg
Ensure the Hyper-V drivers are included in the image:
/etc/dracut.conf:
add_drivers+=" hv_vmbus "
add_drivers+=" hv_netvsc "
add_drivers+=" hv_storvsc "
dracut –f -v
Install Azure Linux Agent from Fedora repository:
dnf -y install WALinuxAgent python
systemctl enable waagent
dnf clean all
/etc/waagent.conf:
ResourceDisk.Format=y
ResourceDisk.Filesystem=ext4
ResourceDisk.MountPoint=/mnt/resource
ResourceDisk.EnableSwap=y
ResourceDisk.SwapSizeMB=4096
Apply the Azure agent settings:
waagent -force -deprovision
export HISTSIZE=0
logout
On your virtualization manager convert the disk to .vhd + fixed size file fedora26.vhd. The exact procedure depends on your hypervisor technology.
Create managed disk and VM
Upload the fedora26.vhd to Azure as "page blob" via Azure cli or portal. In this example I used "rg1" and "container1".
Create a managed disk, using Azure CLI 2.0 in this example:
az disk create --resource-group rg1 --name fedora26managed --source https://username.blob.core.windows.net/container1/fedora26.vhd
Verify its really there:
az disk list -g resourcegroup1 --output=table
Create your vm with 5GB (or more) additional data disk:
az vm create --resource-group rg1 --location westeurope --name fedora26 --os-type linux \
--admin-username username --ssh-key-value ~/.ssh/id_rsa.pub --attach-os-disk fedora26managed \
--size Standard_DS1 --data-disk-sizes-gb 5
At this point your new Fedora 26 server VM should be created, up and running happily.
 |
Azure portal |
Disclaimer: I work for Microsoft as Cloud Solution Architect since 2017/06.