Tags

, , , , , ,

In this post I am going to walk through how to setup a Linux server on Windows Azure. In this post (part 1 of this article), I will be point out settings and configuration that I got wrong the first time around that caused me quite a bit of lost time and increased frustration that I hope I can help you avoid. In part 2 I will be outlining the steps to connect to and utilize the Linux server from a Windows client using ssh via a username & password. In part 3 I will be describing the steps involved in using certificates for ‘password-less’ authentication.

Deploy the Server

  1. log into your Windows Azure Portal

  2. At the bottom left corner of the Portal select “Compute” > “Virtual machine” > “From Gallery”

  3. In the “Choose an Image” view select the Linux distro that you want to use. In this post I will be using “Ubuntu”.

  4. Next select the distro version you wish to use. At the time of this post the latest version of Ubuntu available on Azure is “14.04 LTS”, which I will be using. Then proceed to the next view.
    setup-ubuntu-01

  5. On the “Virtual machine configuration” view you have the opportunity to setup how many resources you want to allocate to this image.

    • note that there might be multiple versions release dates for the distro you have selected. See the “version release date” drop down for the options, I’ll be using the “most recent” version at the time of this post which happens to be “4/17/2014”.
      setup-ubuntu-02
    • The next few options are completely dependent on your needs. Select the “Tier” & “Size” for your VM that works for you.
  6. Before moving onto the next view, you will need to setup your authentication method. This step is extremely important. In this post I will be using the basic username & password authentication. I will be doing another post describing how to setup certificates. This is my preferred method as it means you don’t need to setup, remember or enter a password when connecting to your VM. That said it is quite a bit more complicated to setup and has several steps.
    • First, choose a username that you want to connect to your VM with, I will stay with the default ‘azureuser’ for this post but you should pick something more meaningful to you.
    • Second, enter in your desired password and move on to the next step
      setup-ubuntu-03-password
  7. On the “Virtual machine configuration” view you need to give Azure the details for your VM.
    • You can choose to create a new cloud service to host your VM or use an existing one. The cloud service can host one or many VMs and can be utilized to load balance multiple VMs. If you choose to use an existing one, remember that if you need to recycle your service it will effect all VMs or services associated with it.
    • For the “region, affinity group, or virtual network” choose a location that is the closest to where the majority of traffic will originate from. This will not necessarily be the closest location to your location, but the closest location to where the users of the VM are from. Of course the two ‘groups’ might be one and the same.
    • The ‘availability set’ is for fault tolerance and up-time and is beyond the scope of this tutorial.
    • The last section of this view is to setup the firewall to open ports and allow access from the internet to your VM. By default, the default SSH port has been opened. If you want to be able to SSH into your server, do not remove this. This is my primary (and generally only) method I use to administer my server. You can also open more ports at this time if you know what they are (such as ftp). You will be able to modify this list in the Azure later as well.
      setup-ubuntu-04
      Once you have made your choices, move on to the next and final view.
  8. On this view you have the option to install the VM Agent. This will be installed by default and is generally a good idea to leave on. You might also have some optional extensions that you can enable. At the time of this post there are none for Ubuntu. For more information on these options see the Azure docs.
    setup-ubuntu-05

Once your satisfied, go ahead and select the ‘complete’ check-mark button to stand-up your VM.

At this point you will see Azure processing the request.
setup-ubuntu-06

Once complete you will hopefully see the success messages.
setup-ubuntu-07

At this point you now have a linux server up and running on Azure. It’s time to connect to it over SSH and utilizing it!

Setup Cygwin

I will be using cygwin as my tool of choice to connect to and use Linux remotely. There are other choices, such as (but not limited to) msysgit and GitHub for Windows, but they are outside the scope of this article.

  • Using Chocolatey , install cygwin. If you are unfamiliar with Chocolatey I wrote a previous post that describes how to get up and running with it, feel free to check it out.
cinst cygwin
  • This will run the command line script to install cygwin as well as launch and run the cygwin installer with the default installation options
    InstallCygwin
  • We will also need to install the cygwin OpenSsh & OpenSsl options. To do this, navigate to the cygwin installation directory (normally c:\cygwin) and execute the cygwinsetup.exe
  • Move through the setup setups leaving the default options until you land on the “Select Packages” view. On this view, navigate down the list of packages until you find the “Net” option and expand it with the plus sign.
    Cygwin-Installer-01
  • Now scroll through this list until you find the “openssh” & “openssl” items. You just need to click once on the word “skip” beside each of these options and the text will change to a version number of the product that will be installed.
    Cygwin-Installer-02
  • Continue through the rest of the installer with the default options.

SSH into your Server

cygwin
  • Connect to your Linux server over ssh
ssh [username]@[host].cloudapp.net -p22

Cygwin-Ssh-Server

Now you are connected to your Linux server.
Have fun!

Advertisements