Skip to content

Create the virtual machine

To generate virtual machines you will create an Azure student account with your email @estudiant.upc.edu. Once this is done, you will have to activate an Azure subscription for students, with which you will have access to some services of the platform, in which you can spend 100 dollars that the platform will assign you for free. You do not need to give bank card information or make any real expenses to register the service at any time in the process.

Next, you have the web pages where you can register for the services.

  • WebUPC Azure. To register the account, it must be with a student email. You will have to authenticate the account several times and put your phone number to receive the verification codes.

https://serveistic.upc.edu/ca/distsoft/faq/microsoft-imagine/acord-upc-microsoft-imagine

  • Azure website where to activate the free service for students. There are two free promotions, the common one of €170 for one month, and the student version, which provides €100 for 12 months. The latter is the one that you must activate from the following web page.

https://azure.microsoft.com/es-es/free/students/

Once this process is done, you will be able to access the Azure portal by clicking on the “Portal” button on the Microsoft Azure website indicated first or by going directly to https://portal.azure.com, as seen in the following screenshots.

Una vez en el portal deberíais ver el siguiente web:

Once inside the portal, you must click on “All services” and search for “Education”, to verify that you have the 100 USD available at the beginning of the project and to check the remaining amount throughout the project.

Once this is done, you can start up your virtual machine, which will be the main evaluable element of your project that will be tutored, but not solved by the teacher. In case you have doubts about operating the platform, you should first look for solutions and information through the professional Azure manuals.

To start working, you must enter the Azure home page and look for the Virtual Machines button.

Once there you can access the creator of virtual machines. Below you have the captures of the characteristics of the machine that you must generate. As you can see, it is NOT the cheapest machine possible since you will use a more powerful machine to carry out the initial installation. Throughout the guide we will indicate when you can modify the features of the machine so that the architecture works on the cheapest machine, with a cost of €3.40 per month being active 24 hours.

You will have them connected much less time, therefore, you could opt for a virtual machine with more features (be careful, spending the 100 USD of the account implies the end of free access to services, with an impact on the execution of the project!) . Since financial and time management is important in any real implementation, please be careful.

Below, the screenshots show the steps to generate the virtual machine:

Step 1 (Subscription type and machine type):

Step 2 (Access Method):

Step 3 (Input Port Rules):

Step 4 (Disk Options):

Step 5 (Networks):

Step 6 (Management, Auto Shutdown):

When you click on “Review and create”, you will have to wait a few seconds and the following message will be shown:

Finally, click on “Create” and the following message will be shown:

Click on “Download the private key and create the resource”. Once the resource has been created, the following message will be shown:

You must store the private key file in the following path:

C:\Users\.ssh

If you access the virtual machine resource you will see that you can start and stop it. In addition, to avoid scares, in the configuration you will see that you have been instructed to activate the automatic shutdown of the machine every day at 12 PM, so that there are no problems if it stays on after working on it.

You can access the following web page to be able to see the balance you have left and the consumption you make: https://www.microsoftazuresponsorships.com

We encourage you at this point to spend a few minutes getting to know the Azure interface. You can try to locate the information of your virtual machine (public IP, version of the operating system, information about CPU and disks). Due to the wealth of menus and options of the Azure interface it is impossible to know all of it, but we think it is important that you spend a little time locating important functions to work with your virtual machine (start, restart, stop, delete) and you can use these functions when solving problems that arise throughout the implementation of the project.

Access to the virtual machine via SSH client

Once you start the machine you will have to connect to it to be able to execute commands and use it. This connection is achieved through SSH, a command line protocol that allows you to do something similar to remote desktop connection programs like TeamViewer. The machine created does not have to have a graphical interface, it is just a computer with a command line, as is the case at hand.

In this implementation, you will access the virtual machine using the SSH key pair that you have already created, instead of using a username and password. This system minimizes the chances of receiving a man-in-the-middle attack when connecting to the virtual machine.

NOTE: Linux, Mac OSX and some versions of Windows come with a factory-installed SSH client, which can be accessed from the command terminal (cmd for Windows). If you need to install it separately, here is a simple tutorial for Windows 10:

https://www.profesionalreview.com/2018/11/30/ssh-windows-10/

To access the virtual machine via SSH, click on the Connect button that you can see in the following screenshot:

Click on SSH in the drop-down that opens, and you will reach the following menu:

Now you must copy the path of the private key that you downloaded when creating the virtual machine and paste it in the space available in point 3. Once this is done, copy the content of point 4, since the command will be completed with the path of the private key that you have indicated.

The terminal response should be similar to the following:

At the bottom you can see that the user and the name of your virtual machine are already indicated. Therefore, you can already execute commands on the virtual machine from that line.

Enable access for the teaching team

You will be provided with a public key that you must enable within the virtual machine.

To do so, copy the public key and once inside the virtual machine execute the following commands to place yourself in the .ssh/ directory:

ls -a

cd .ssh

The following command allows you to access the file that you must configure:

sudo nano authorized\_keys

The authorized_keys file allows you to record the public keys that the virtual machine will consider known. You will have to paste in the lower line (marked in red in the capture) to which the public key that has been provided to you is already written:

To exit save the changes with CTRL+O, press Enter to keep the name of the saved file and exit with CTRL+X.

Finally you can validate if there are two keys registered by entering the following command:

sudo cat authorized\_keys

Virtual machine handling instructions

For the general use of the Linux Bash terminal, you can use the following website that will explain the basic commands of the terminal:

https://es.wikibooks.org/wiki/Manual_de_consola_Bash_de_Linux

Highlight the use of the following commands:

  • cd”. Allows you to navigate between directories.
  • ps –A”. It allows you to see the processes (programs) that the operating system is running, very useful to check if the software you need is running.
  • docker ps”. Returns a list with information on the generated containers (identifier, image from which it was created and status).

On the other hand, for Windows users we recommend installing Windows Terminal, a program that offers a terminal with many features (navigate up and down to be able to view all the commands entered and the information returned by the machine, generate several terminal sessions in the form of tabs in the same window, …). This application is free and you can find it in the Microsoft Store.