3.7. Appendix - Creating a Custom Disk Image from ISO Instances within Microsoft Azure are created from disk images. Gluster Storage requires a custom image, rather than one of the default Microsoft Azure-supplied images. Building custom virtual machine images is typically done with Hyper-V, but custom images for Microsoft Azure can also be built using native Linux tools. The overall process to configure a custom image takes about 30 minutes. Download the latest ISO for Gluster Storage from here: https://access.redhat.com/downloads/content/186/ver=3.1/rhel---7/3.1/x86_64/product-software Using virt-manager , create a qcow2 image with two cores, 4 GB RAM, 20 GB virtio HDD, and a single NIC. Boot the instance from the ISO image and complete the installation of Gluster Storage. Do not allocate swap space since the Windows Azure agent sets up an ephemeral disk at runtime for swap space. Reboot the instance and log in. Set a generic hostname. On Red Hat Enterprise Linux 7: On Red Hat Enterprise Linux 6: Confirm that DHCP is configured in /etc/sysconfig/network-scripts/ifcfg-eth0. Update the udev rules to avoid conflicts with Microsoft Azure and Hyper-V. On Red Hat Enterprise Linux 7, apply the default firewall rules for Gluster Storage. These rulesets are used for inter-node communication, the GlusterFS client, and NFS. Register the virtual machine. Enable the Extras and Gluster Storage repositories. This is either rhel-6- or rhel-7-. Update the system and install the Microsoft Azure Linux agent. Disable any swap space defined during the Gluster Storage installation. This is required on Red Hat Enterprise Linux 7. Microsoft Azure allocates ephemeral storage at runtime, which is used for swap, so swap space does not need to be explicitly defined. On Red Hat Enterprise Linux 6, the installer enables disk configuration to be changed, so the swap is not defined. However, if a logical volume was created, then remove the configuration as on RHEL 7. Red Hat Enterprise Linux 7 only . A Linux virtual machine running in Azure requires the hv_storvsc and hv_vmbus drivers within the initramfs image. The Red Hat Enterprise Linux 6 installer includes these drivers automatically, but under Red Hat Enterprise Linux 7, the installer only adds these drivers if Hyper-V devices are detected at installation time. When building a virtual machine image using virt-manager, add these Hyper-V drivers manually. Add the following content to /etc/dracut.conf. . Regenerate initramfs. Update the kernel boot settings. On Red Hat Enterprise Linux 7: Set the GRUB_CMDLINE_LINUX variable in /etc/default/grub. Refresh the grub2 configuration. Remove the rhqb, quiet, or crashkernel=auto parameters. On Red Hat Enterprise Linux 6: Update the kernel boot line in /boot/grub/menu.lst: Remove the rhqb, quiet, or crashkernel=auto parameters. Enable the Windows Azure agent to start at boot. On Red Hat Enterprise Linux 7:. On Red Hat Enterprise Linux 6:. Unregister the virtual machine using Red Hat Subscription Manager. De-provision the instance to remove the local settings; this allows the instance to be used as a disk image within Microsoft Azure. Dump the XML of the instance to find the filename of the virtual disk that was created, and convert it to a Microsoft Azure compatible VHD file. In this example, the instance was initially created using the qcow2 disk format.

Commands:
hostnamectl set-hostname localhost.localdomain
vim /etc/sysconfig/network NETWORKING=yes HOSTNAME=localhost.localdomain
DEVICE=eth0 ONBOOT=yes BOOTPROTO=dhcp IPV6INIT=no TYPE=Ethernet USERCTL=no PEERDNS=yes
rm -f /etc/udev/rules.d/70-persistent-net.rules rm -f /lib/udev/rules.d/75-persistent-net-generator.rules
firewall-cmd --zone=public --add-service=glusterfs --permanent firewall-cmd --zone=public --add-service=nfs --add-service=rpc-bind --permanent
subscription-manager register --auto-attach subscription-manager repos --disable=*
subscription-manager repos --enable rhel-7-server-rpms --enable rhel-7-server-extras-rpms --enable rh-gluster-3-for-rhel-7-server-rpms
yum update -y yum -y install WALinuxAgent
swapoff -v /dev/rhgs/swap sed -i '/.* swap/d' /etc/fstab
dracut -f -v
``rd.lvm.lv=rhgs/root console=ttyS0 earlyprintk=ttyS0 rootdelay=300
grub2-mkconfig -o /boot/grub2/grub.cfg
console=ttyS0 earlyprintk=ttyS0 rootdelay=300 numa=off
systemctl enable waagent
chkconfig waagent on
subscription-manager unregister
yum clean all waagent -force -deprovision export HISTSIZE=0 poweroff
virsh dumpxml image-name qemu-img convert -f qcow2 -O vpc -o subformat=fixed -O vpc rhgs313.qcow2 rhgs313.vhd