Blog

Creating and Uploading a Virtual Hard Disk that Contains the Red Hat Linux 6.x Operating System on Azure Cloud

Windows Azure stores a virtual machine’s operating system in a virtual hard disk in VHD format (a .vhd file).

Prerequisites

For REHL 6.x select default configuration or add minimum packages for the installation.

With no swap file to be created on the same vhd.

Important: You need to register with RHEL or alternative download open source rpm. Since command like “yum” will not able to download and install the rpm on the VM.
You need to create a management certificate for the subscription for which you want to upload a VHD, and exported the certificate to a .cer / .pem file on Azure portal.
Certificate Creation and Installation on RHEL
Download opessl from the below url. I have used OpenSSL for this from yum command
http://rhn.redhat.com/errata/RHSA-2012-0060.html
http://olcentgbl.trafficmanager.net/openlogic/6/openlogic/x86_64/RPMS/
# yum install openssl
# openssl req -x509 -nodes -days 365 -newkey rsa:2048 -keyout myPrivateKey.key -out myCert.pem
# chmod 600 myPrivateKey.key
# openssl x509 -outform der -in myCert.pem -out myCert.cer
Install the drivers for the Linux Integration Services.
Obtain the .iso file that contains the drivers for the Linux Integration Services from Download Center.

b) In Hyper-V Manager, in the Actions pane, click Settings.
This task includes the following steps:

• Step 1: Prepare the image to be uploaded
• Step 2: Create a storage account in Windows Azure
• Step 3: Upload the image to Windows Azure

Step 1: Prepare the image to be uploaded
Prepare the RHEL 6. operating system installation.
You must complete specific configuration steps in the operating system for the virtual machine to run in Azure.
1. In the center pane of Hyper-V Manager, select the virtual machine
2. Click Connect to open the window for the virtual machine.
3. Uninstall NetworkManager by running the following command:
#rpm –e –noeps NetworkManager

4. Edit the file named network in the /etc/sysconfig/ directory that contains the following text:
# vi /etc/sysconfig/

5. Install the drivers for the Linux Integration Services.

a) Obtain the .iso file that contains the drivers for the Linux Integration Services from Download Center.
b) In Hyper-V Manager, in the Actions pane, click Settings.
c) In the Hardware pane, click IDE Controller 1.
d) In the IDE Controller box, click DVD Drive, and then click Add.
e) Select Image file, browse to Linux IC v3.2.iso, and then click Open.
f) In the Settings page, click OK.
g) Click Connect to open the window for the virtual machine.
h) In the terminal window, type the following commands:
# ./media/CDROM/RHEL63/install.sh
# init 0
6. SSH Server is included by default
7. Hyper-V Manager integration tools were installed.

Step 2: Create a storage account in Windows Azure
You need a storage account in Windows Azure to upload a .vhd file to Windows Azure that can be used for creating a virtual machine. You can create a storage account by using the Windows Azure Management Portal.
1.Sign in to the Windows Azure Management Portal.
2.On the command bar, click New.
3. Click Storage Account, and then click Quick Create and then fill out the fields as follows:
4.Click Create Storage Account.
The account is now listed under Storage Accounts

Step 3: Upload the image to Windows Azure
1. You are ready to upload the .vhd you can CloudXplorer v1 – Free Download tool to upload vhd from the url http://clumsyleaf.com/products/cloudxplorer
Just need to give credentials and drag and drop the vhd in a page block
2. Go to virtual machine -> Images
3. Click images, and then click Quick Create and then fill out the fields as follows:
4. The image is successfully completed.
5. Go to virtual machine create new virtual machine and upload the certificate for SSH key authentication.
6. Default ssh endpoint port is enable for Linux VM.
7. Download putty http://www.chiark.greenend.org.uk/~sgtatham/putty/download.html
8. And login to the public virtual ip with username and password.