Bruno TerkalyRicardo Villalobos
I never thought I would write a how-to article about Linux while working at Microsoft. But that adage “never say never” has proven true, and here I am letting you know that running cloud and Linux-based workloads offers some powerful capabilities.
Before we begin, let’s talk terminology. A virtual machine in Azure is a server in the cloud that you can control and manage. After you create a virtual machine in Azure, you can delete and recreate it whenever you need to, and you can access the virtual machine just as you do a server in your office. Virtual hard disk (VHD) files are used to create a virtual machine. In this month’s column, the server I’m creating is a Linux server. The virtual machine for the Linux Server is typically abbreviated VM.
Understanding the value proposition of being able to deploy Linux-based applications to the cloud is critical. It means you can now run almost any workload in the world in one of eight Microsoft global data centers. Microsoft has four data centers in the United States, two in Europe and two in Asia. Running Linux-based workloads in the cloud also provides scale on demand, allowing you to increase (or decrease) the number of deployed instances of your workload. You simple reuse the VM you previously created by using the portal to create another instance. You can automate this process with Windows PowerShell and other scripting tools.
Hosting persistent VMs in the cloud is the cornerstone of supporting Infrastructure as a Service (IaaS). This “branch” of cloud computing makes it possible for developers to deploy just about anything. This flexibility is almost limitless because developers can connect directly to a Linux-based VM and configure the machine exactly as they would do in an on-premises scenario.
Microsoft supports both Linux and Windows in its IaaS offering. Azure directly supports several flavors of Linux, such as CentOS, SUSE, openSUSE and Ubuntu, as you can see in Figure 1. You can also create your own custom images based on these distributions and reuse them when you need additional scale. You can also download these VMs and run them on premises if appropriate. They are portable and self-contained. Another advantage of running SUSE is that it can automatically update the deployed VMs with security patches, bug fixes and new features.
Figure 1 Linux distributions supported by Azure
Once deployed, these VMs are durable, meaning that you can add software and capabilities that remain after a reboot. This capability is crucial because it allows you to tweak and tune your Linux deployment and run it at scale, either on premises or in the cloud—or perhaps both. You’re free to add any open source software. For example, you could use JBoss for your middleware, or you could choose WordPress or Drupal if you need a contact management system. Maybe you currently support Tomcat (think servlets) or MySQL for your data store. I have documented the entire process of setting up Linux (openSUSE) on Azure, complete with Apache, MySQL and Drupal, on my blog.
You can log on to the VM after you create it. Open source packages like PuTTY allow you to telnet into your Linux server from a Windows or Mac device and perform any needed tasks. You can download PuTTY for Windows here. If you’re using a computer that’s running a Linux operating system, you might want to use an SSH (Secure Shell) client such as OpenSSH so that you can telnet into the machine at a Microsoft data center.
As a developer, you have more responsibility with IaaS because you must install all the necessary components, such as Web servers, databases, programming runtimes (Java, .NET) and so on. Although configuring the VMs that make up an IaaS installation (as compared to PaaS, or Platform as a Service, and SaaS, or Software as a Service) will take longer, you have more flexibility in how the VM is configured and deployed.
There are a few limitations. For example, the number of exposed endpoints is restricted to 25 and the number of VMs per cloud service is restricted to 20. When you first create the Linux installation, you have restricted connectivity to ports specified in the Management Portal. By default, the only allowed port is SSH. You can open up access to additional ports on the Linux VM by adding rules in the Management Portal.
The openSUSE distribution makes it easy to add a variety of features to the base OS. A built-in utility called YAST (Yet Another Setup Tool) offers a text-based UI that lets you deploy Apache, PHP (Hypertext Preprocessor), MySQL, Drupal and much more. There is even a command-line version of YAST if you want to script the whole procedure.
You can also choose from several types of hardware configurations, from a single-core 1-GHz CPU to an eight-way 1.6-GHz CPU with 14 GB of RAM. Naturally, pricing varies according to how much hardware capability you need. In general, horizontal scaling is preferable to vertical scaling—that is, you’re generally better off hosting several smaller VMs than a couple huge VMs. Your applications are much more fault tolerant when scaling horizontally. Azure promises almost unlimited scaling given that it allows you to host up to 20 VMs simultaneously.
Some of the Linux-based IDEs are starting to offer direct support for Azure. You can deploy to Azure directly from within the SUSE Studio IDE. Developers don’t need to worry about the machine image or working with the Azure Portal. Instead, you can enter your Azure ID into the SUSE Studio IDE before deploying your application to the Azure cloud and let the SUSE Studio IDE perform the deployment or upgrade.
For enterprises needing to bridge the gap between on-premises and cloud-based deployments, Hyper-V, the Windows-based hypervisor, now works amazingly well with Linux. Hyper-V is a VM manager (VMM) that allows multiple operating systems to run concurrently on the same hardware on premises or at a Microsoft data center.
Hyper-V dramatically simplifies the ability to connect all these different platforms and technologies, making Azure the best place to run your applications regardless of the platform or technology. As enterprise adoption of Azure and cloud computing grows, the need to solve interoperability issues is also increasing. Hyper-V is a boon to companies that run mixed-source IT environments.
If you want to learn more about using Azure with Linux systems, there are a lot of great resources. As I mentioned earlier, you can check out my blog post, where I provide detailed guidance on installing openSUSE, Apache, PHP, MySQL and Drupal.
I also recommend downloading the Azure Platform Training Kit, which you can find here. The training kit has many detailed instructions about working with Azure and Linux. For example, one of the training kit labs guides you through installing and configuring a MongoDB server in a Linux VM running on Azure. MongoDB is a document-oriented NoSQL database designed for ease of development and scalability, with particular emphasis on Internet applications and infrastructure. The lab also guides you through creating a Node.js Web application that connects to the MongoDB server running on the Linux VM. You can publish the Node.js Web application to the cloud using Git. Finally, GitHub, which you can find here, has a lot of great content that includes growing support for Linux and Mac desktops.
With Azure, Microsoft has the most comprehensive cloud offering available. The platform is evolving into something powerful, flexible and easy to use.
Bruno Terkaly works as a developer evangelist for Microsoft. His depth of knowledge comes from years of experience in the field, writing code using a multitude of platforms, languages, frameworks, SDKs, libraries and APIs. He spends time writing code, blogging and giving live presentations on building cloud-based applications, specifically using the Azure platform.
Ricardo Villalobos is a seasoned software architect with more than 15 years of experience designing and creating applications for companies in the supply chain management industry. He has numerous technical certifications as well as an MBA in supply chain management from the University of Dallas. He works as an Azure architect evangelist for Microsoft.
More MSDN Magazine Blog entries >
Browse All MSDN Magazines
Subscribe to MSDN Flash newsletter
Receive the MSDN Flash e-mail newsletter every other week, with news and information personalized to your interests and areas of focus.