layout |
---|
default |
This page teaches how to create a Virtual Machine
(VM) running Linux, by importing an appliance from the AppMarket
.
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
andimage
, please visit the introduction to the HPC Cloud documentation page
You use the HPC Cloud interface to build virtual machine
s.
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 AppMarket, which has appliances readily available for you to pick and use.
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.
We are going to work with a pre-made image
that is available on the AppMarket.
NOTE
The AppMarket is a collection of so-called appliances maintained by the HPC Cloud team. It is a handy way to import, from within the well-known UI, useful images that are ready to use. 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:
-
From the user
view
, choose the AppMarket tab on the left menu of the screen and then Appliances (in the screen shot, it has been highlighted in red). -
Next, look for the Ubuntu 14.04 Server appliance in the list; click on it. This will show details about
image
s,template
s and other attributes (including a textual description) that conform the appliance. Please, read theDescription
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). -
Click on the Import button at the top-right corner of the screen. A dialogue will pop up, asking you for a few details.
-
The first setting is the datastore for images. Make sure that you select 104: local images ssd.
-
The other options are the name of the
template
and theimage
. You can change the names to something more descriptive to you. Once you have manytemplate
s andimage
s, it will pay off to have good descriptive names of what each of them is. -
Finally, click Import. This will start importing the appliance from the AppMarket. When the import is successful, it will create an
image
and atemplate
.
You can verify that the process is complete by inspecting the Template and Image sections in the Virtual Resources tab of the UI. You should see your new image
and template
there.
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 $HOME
directory). Open the file, then copy the contents of the file (those contents are your public key) and paste those contents into the text area of the UI.
You can just close this dialogue now. Your public key is automatically stored in your profile.
When you imported the appliance from the AppMarket, it made a template
available for you to make a virtual machine. However, the VM would not be connected to the internet yet, so you cannot connect to it remotely.
Allow your virtual machine to connect to the internet by following these steps:
-
Go to the Templates section. Find the
template
you just created, and click on it. You now see an overview of thetemplate
settings. -
Click on Update on the top-right of the screen to start editing the
template
. This shows the different configuration options for yourtemplate
. For now, we will leave most settings alone, but you can browse through the different options. Select the Network tab. -
The Network tab shows which network interfaces (or
nic
s) your VM would have and to which networks they would be connected. To connect the only availablenic
at the moment (called NIC 0) to the internet, select the network called "internet", to the right of it, as shown on the screen shot. -
Click Update to save your changes.
Note:
When you import an appliance from the AppMarket, 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 Virtual Machines 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:
-
Click on the green plus sign, as shown in the screenshot. This opens a dialogue with options for your virtual machine.
-
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.
-
The number of instances is 1, which is fine for now.
-
The second step in the dialogue is to select a
template
. Since this is your firsttemplate
, there is only one item in the list. Select thistemplate
by clicking on it. -
Click on the Create button at the bottom 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.
The operating system on the machine will go through the boot process.
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 a Linux or a Mac OSX open a terminal (if you are using Windows then open a GitBash terminal) and type:
where you should replace mmm and nnn to match the IP address of your virtual machine.
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 [email protected]
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.
If you want to shutdown your VM and stop consuming your quotas, perform the following steps:
-
Tick the box to the left on the row of your VM and click Shutdown (upper right corner of the screen, under the dust bin drop-down button).
-
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.