Вчера Microsoft Open Technologies анонсировала дополнительный сервис для виртуальных машин Windows Azure — хранилище виртуальных машин . Депо — это управляемый сообществом каталог образов ВМ с открытым исходным кодом. Это позволяет создавать виртуальные машины и совместно использовать их с пользовательскими конфигурациями или установленными стеками программного обеспечения.
Даг Махью также опубликовал статью о том, как начать пользоваться сервисом.
Я провел некоторое время, работая с депо прошлой ночью, и вот что я узнал.
Требования
Вы можете догадаться, что вам понадобится подписка на Windows Azure, но есть еще несколько вещей, которые вам нужно сделать.
-
Убедитесь, что функция предварительного просмотра виртуальной машины включена для вашей службы. Вы можете сделать это, войдя в свою подписку и перейдя по адресу https://account.windowsazure.com/PreviewFeatures . Оказавшись здесь, зарегистрируйтесь для опции Виртуальные машины и виртуальные сети, если она еще не активна.
-
Убедитесь, что у вас установлена последняя версия инструментов командной строки Windows Azure, поскольку депо создает сценарий развертывания, в котором используется новый параметр (-o). Вы можете обновить инструменты командной строки, выполнив одно из следующих действий:
-
Используйте команду npm install azure-cli -g для установки последних битов командной строки Azure.
ИЛИ ЖЕ
-
Installing the SDK download for your platform from https://www.windowsazure.com/en-us/develop/downloads/.
-
-
You’ll also need to import your account settings if you haven’t already. You can find the steps for this in the How to download and import publish settings section of this article.
Using a community image
If you want to create a new VM using a community image, the process is pretty simple:
-
Open http://vmdepot.msopentech.com/List/Index in your browser.
-
Find an image you want from the list. You can either scroll through the list or use the search bar at the top. The following image illustrates using the search field to find a VM that has Riak.
-
At this point you can either click the Deployment Script link to the far right of the VM entry you want to use or the Deployment Script icon at the top to retrieve a deployment script. You’ll need to agree to the terms of use and select a region, and then you’ll be given a command similar to the following:
azure vm create DNS_PREFIX -o vmdepot-66-2-2 -l "East US" USER_NAME [PASSWORD] [--ssh] [other_options]
-
You will need to replace the fields such as USER_NAME with actual values. Here’s what each should go in each of these fields:
-
DNS_PREFIX should be replaced with whatever you want this machine to be called. I’m going to use myawesomevm.
-
USER_NAME should be replaced with the user name you want to login to the machine as.
-
[PASSWORD] should be the password you want to use for this user (don’t include the [] characters around the password).
-
[—ssh] should be changed to just —ssh if you want to enable SSH (and you probably do, otherwise how are you connecting to the machine?)
-
[other_options] should be replaced with any other options available for the azure vm create command. For example, —vm-size small.
A final command line should look something like:
-
azure vm create larryriak -o vmdepot-66-2-2 -l "East US" larry secretpassword --ssh
-
Run this command from a command-line. It will copy the disk image from the VM Depot to storage in your subscription, and then provision a VM that uses this disk image.
-
At this point, the new VM should show up in the Windows Azure portal.
After the VM status changes to running, you should be able to use SSH to connect to the VM and use it as you normally would.
Publishing a VM
Doug Mahugh’s article provides information on publishing an image to the VM Depot. I didn’t go through the entire process of publishing a VM because I didn’t want to clutter up the VM Depot with «Larry’s great generic Linux VM for testing purposes». The steps seem relatively straight forward though.
Create a custom VM and publish a VHD to the VM Deopot
-
Create a VM. You can find a walk through of this process in the Create a virtual machine running Linux tutorial.
-
Once it’s been created, SSH to the VM and install things people might find useful.
-
Capture an image of the VM to a VHD. You can find these steps in the How to capture an image of a virtual machine running Linux article.
-
Set the storage container that contains the .VHD to public. You can do this in the Windows Azure Portal by:
Publishing the VHD to the VM Depot
You’ll need to create an account on the VM Depot for this step. It allows you to use a Windows LiveID, Google ID, or Yahoo! ID. To create an account, just click on the Sign In link in the upper right to set this up.
After you’ve created an account and signed in, perform the following steps to share your VM with the community:
-
Click the Publish icon at the top of the page.
-
Enter information about the VM image: name, description, what packages are installed, legal terms, etc.
-
The URL of the VHD to publish is the full URL to the VHD in your public container. You can get this by performing the following steps:
-
Go to the Windows Azure Portal.
-
Go to the storage account that contains this VHD.
-
Select Containers, and then select the container.
-
A list of the objects in the container, along with the full URL to each item, will be displayed. Just note the URL and use it in the URL of the VHD to publish field in the VM Depot.
-
-
Once you’ve specified the VHD path and filled out all the information, agree to the terms and click the publish button.
Final Thoughts
The VM Depot is a great addition to the Windows Azure VM story. Previously you had to select a raw OS image and manually install your software stack on it. With the Depot, you can now pick an image that already has the stack you need, as well as share your custom stack with the community. And since it’s based on the Windows Azure command-line tools, it allows you to create the command-line once in the portal and then use it in your automation scripts, or hand it out to co-workers who need to create their own VMs.
There’s already a lot of VMs in the Depot for both specific OS releases (Debian Wheezy and Mageia) and specific software and software stacks (LAMP, Ruby, JRuby, WordPress, Joomla, Drupal). It will be interesting to see what new VMs show up now that this is open to the community.
Any thoughts on specific OS or software stacks that you’d like to see in the VM Depot?