EBC azure
Embedded Linux Class by Mark A. Yoder
Here's how to set a virtual machine in Microsoft's azure cloud to compile a kernel.
Contents
Setting up an Account
If you have a Promo Code
- Go to the azure pass site and follow the instructions.
If you don't have a Promo Code
- Go to the azure main site and click on Try for free.
Selecting and Starting a New Instance
Once you have an azure login
- Go to azure Management page and login.
- Click on +NEW on the bottom left of the page.
- Select VIRTUAL MACHINE, QUICK CREATE and fill in the fields. The best machine you can get is 2 cores.
- Click CREATE A VIRTUAL MACHINE on the bottom right.
- Once you machine is running (it will take a few minutes), click on it.
- Click on DASHBOARD on the upper left above the cloud.
- Scroll to the bottom until you see DNS NAME. Remember this name.
Connecting to Your Instance
Connecting to your machine is as easy as ssh, just substitute your machine's name for mine. Note, the default account is azureuser.
$ ssh -XC azureuser@test-yoder.cloudapp.net Warning: Permanently added 'test-yoder.cloudapp.net,138.91.113.249' (ECDSA) to the list of known hosts. Welcome to Ubuntu 14.04.1 LTS (GNU/Linux 3.13.0-36-generic x86_64) * Documentation: https://help.ubuntu.com/ System information as of Mon Oct 6 22:01:12 UTC 2014 System load: 0.79 Memory usage: 2% Processes: 208 Usage of /: 16.4% of 28.80GB Swap usage: 0% Users logged in: 0 Graph this data and manage this system at: https://landscape.canonical.com/ Get cloud support with Ubuntu Advantage Cloud Guest: http://www.ubuntu.com/business/services/cloud Last login: Mon Oct 6 18:05:12 2014 from 137.112.44.233 azureuser@test-yoder:~$
You can now use the machine as you would your host.
Connecting More Easily
You have to type a lot to do a simple ssh. Here's how to save some typing. On the page where you found the DNS NAME, look for the PUBLIC VIRTUAL PI (VIP) ADDRESS. Put it in /etc/hosts on the machine you are ssh'ing from (not your azure machine).
$ sudo vi /etc/hosts
Add a line like:
138.91.113.249 azure
where the number is your azure machine's IP address.
$ vi ~/.ssh/config
and add
Host azure User azureuser UserKnownHostsFile /dev/null StrictHostKeyChecking no
And finally
$ ssh-copy-id azure
Now you can login without a password. This can be done from either you host your bone.
$ ssh -XC azure
You can even copy to and from with
$ scp local_file azure:remote_file
Watch out though, every time you stop your machine an restart it, it will get a new IP address. You can run the following to find out the new address.
$ nslookup test-yoder.cloudapp.net Server: 127.0.1.1 Address: 127.0.1.1#53 Non-authoritative answer: Name: test-yoder.cloudapp.net Address: 138.91.113.249
Controlling azure from the Command Line
azure has a nice web interface, but you can also control it from the command line with azure-cli.
$ npm install -g azure-cli
xplat-cli shows how to configure your host machine to connect to your azure account. Pretty much you do
$ azure account download
to get a settings file and then
$ azure account import [path to .publishsettings file]
to configure your account. (See xplat-cli) for details.
Once configured you can start your virtual machine with
$ azure vm start test-yoder
Or stop it with
$ azure vm shutdown test-yoder
There are many more options. See [1] for details.
Attach a Virtual Disk
See [2] to learn how to attach a virtual disk.
Embedded Linux Class by Mark A. Yoder