Your first virtual machine

This page teaches how to create a Virtual Machine (VM) running Linux, by importing an appliance from the Apps option of the Storage menu.

NOTE

This walk-through guide provides an introduction to the concepts of the HPC Cloud. If you are going to use a VM running Linux for your research, the steps described in this guide will produce a basic VM that you can use to install the software that you may need and where to process your data later on. If your goal is to use a VM running Windows, this chapter still gives you a good introduction and you are recommended to start here.

More advanced and specialized topics are discussed separately.

If you are not yet acquainted with terms such us Virtual Machine, template and image, please visit the introduction to the HPC Cloud documentation page

Recap: templates, images and appliances

You use the HPC Cloud interface to build virtual machines.

You build them by first describing all their parts. This description is called a template. You instantiate a template to make a VM out of it.

Storage drives (like hard disks) are images. They do not physically exist, but rather, they only exist as files in a backing file server.

To make starting a virtual machine easier, we provide the Apps option, which has appliances readily available for you to pick and use.

Logging into the HPC Cloud User Interface

The HPC Cloud User Interface (UI) is the web site where you manage your VMs.

You can reach the UI at the following URL: https://ui.hpccloud.surfsara.nl

After you are granted access to the HPC Cloud, you will receive a username and a password for this UI.

NOTE

If you would like an explanation about the options you can see on the UI, please visit the User Interface documentation page.

To start building a virtual machine, go to the UI and log in with the username and password you received.

NOTE

… that the username and password are not for the VM you are going to create. You can set users and passwords later on, once you have created a VM.

Importing an appliance from the Apps option of the Storage menu

We are going to work with a pre-made image that is available in the Apps option.

NOTE

The Apps option contains a collection of so-called appliances maintained by the HPC Cloud team. It is a handy way to import, from within the UI, useful images that are ready to use. More information about the appliances configuration is available. There is also an OpenNebula marketplace, publicly available on the OpenNebula website, and anybody can contribute their appliances to it.

Import the appliance by following these steps:

  1. From the user view, choose the Storage tab on the left menu of the screen and then Apps (in the screen shot, it has been highlighted in red).

    appmarket step 1

  2. Look for the Ubuntu 14.04 Server appliance in the list and click on it. This will show details about image, template and other attributes (including a textual description) that conform the appliance. Please, read the Description now. The description mentions that there is no password for the root account and that you need to add an SSH public key to your user profile. We will do this in a later step. Read the extended information related to the appliance (especially, the bit about the contextualization and configuration options).

    appmarket step 2

  3. Click on the OpenNebula button at the top of the screen. A dialogue will pop up, asking you for a few details.

    appmarket step 3

  4. The first options are the name of the image and the template. You can change the names to something more descriptive to you. Once you have many image and template objects, it will pay off to have good descriptive names of what each of them is.

  5. The next setting is the datastore for images. Make sure that you select local images ssd.

  6. Finally, click Download. This will start importing the appliance from the AppMarket. When the import is successful, it will create an image and a template.

You can verify that the process is complete by inspecting the VMs sections in the Templates tab and the Images section in the Storage tab of the UI. You should see your new image and template there.

Adding an SSH key to your profile

If you remember from the description of the virtual machine, there is no password for the root user. You have to add an SSH key to your user profile in order to be able to log in as root in your VM.

First, you need to create an SSH key in your own computer. This process is described in a different article. This SSH key enables you to log in to your virtual machine with ssh.

After you have created an SSH key, go to your user profile by selecting the buddy icon on the top-right of the screen, then select Settings. A dialogue pops up. In the dialogue, go to the Info page; then locate the section Public SSH Key, and click on the blue edit icon. You should now see an empty text area.

Find the file in your computer containing the public key you created (it is usually called id_rsa.pub and it is usually found in the .ssh directory in your $HOMEdirectory). Open the file, then copy the contents of the file (its contents are your public key) and paste it into the text area of the UI.

import_ssh_key_img

You can just close this dialogue now. Your public key is automatically stored in your profile.

Starting your virtual machine

Note:

When you import an appliance from the Apps option, the disk image is normally non-persistent. This means, in short, that your changes are lost when you shut your VM down. Before starting your VM, always check whether Image Persistence is set to the desired mode (yes or no).

A template is a description of a virtual machine. The template we have been editing in this guide is now ready to create a virtual machine from it.

Go to the VMs option of the Instances section of the UI. This displays an overview of all running VMs. If this is your first virtual machine, this list will be empty.

Start your virtual machine using the following steps:

  1. Click on the green plus sign, as shown in the screenshot.

startVM

  1. Select the template you created before from the presented list. This opens a dialogue with options where you will define the resources to be allocated to VM.

  2. The first box in the dialogue is to give your virtual machine a name. Ideally, give your VM a name consisting only of lowercase letters, hyphens (‘-‘) and digits, but no other characters or spaces.

  3. The number of instances is 1, which is fine for now.

  4. Click on the Create button at the top of the screen.

Your VM will appear in the list of virtual machines. At first, it will have the state PENDING. That state means that the cloud system is looking for a place where your virtual machine can actually run.

When the required capacity becomes available, your virtual machine will go through a few other states, and eventually, it will appear as RUNNING. Refresh the VM status by clicking on the two arrows chasing each other next to “+” button.

testVM

The operating system on the machine will go through the boot process.

Logging in on your virtual machine

After you have added your public key to your user profile, you should be able to log in on your virtual machine as user ubuntu, allowing you to perform maintenance tasks on your virtual machine by using sudo.

You will need to find the IP address of your virtual machine, first. The IP address of your virtual machine is shown on in the IPs column from the virtual machines list, under the Virtual Resources tab of the UI.

If you use Linux or Mac OSX open a terminal (if you are using Windows then open a GitBash terminal) and type:

  ssh ubuntu@145.100.mmm.nnn

where you should replace mmm and nnn to match the IP address of your virtual machine.

Note: In this case ‘ubuntu’ is the username but it could be a different one, e.g. ‘admincentos’ for VMs created from Centos Apps images.

Note: You may have to specify which of your (multiple) public keys you want to use to connect to your VM. The ssh command can take an argument of the following form for that:

  • the flag -i
  • a space
  • and the path to the public key file

Example:

In the screen shot below, the IP address is 145.100.59.30. And suppose the public key we want to use from our laptop is ~/.ssh/id_rsa.pub. Then, the correct command in this case would be:

  ssh -i ~/.ssh/id_rsa ubuntu@145.100.59.30

Note for Windows:

If you are using Putty, then use the IP of your virtual machine as host, ubuntu as username, and click Connect (see instructions here).

If there were no errors, and if your firewalls allow making remote connections, you should now be logged in on your virtual machine, as user ubuntu.

Note: Operating as user root

Many tasks in Linux require your becoming user root. The recommended way of operating as root in Ubuntu is to run your commands prefixed by sudo. For example, to install a common text editor, you would run: sudo apt-get install vim.

However, if what you would like is to become root in a terminal so that you do not have to bother with the sudo prefix, then you can do that like this: sudo su -. From then on, everything you run in that terminal will take place as the root user.

Shut down and remove your machine

If you want to terminate your VM and stop consuming your quotas, perform the following steps:

  1. Tick the box to the left on the row of your VM and click Terminate (upper right corner of the screen, under the dust bin drop-down button). shutdownVM

  2. Refresh the Virtual Machines list (by clicking on the two arrows chasing each other next to + button) until your VM is gone.

That was the shutdown. Once the operation is finished, your VM will be removed from the display and its resources freed. You can start a new VM from your existing template and image any time.