Computing in school – making a virtual machine in Azure

In a previous post I described some of the issues faced by computing teachers when attempting to teach their subject on a standard school network.

nosign

 

Forty years ago it was very rare for educational establishments to have a computer on site. Nevertheless it was possible to still practice coding. Students would use punch card systems and teletype to write a program and then connect to a distant mainframe computer. This would execute the program and send the results back to the eagerly waiting student.

Nowadays ICT and computers are ubiquitous in schools but, in spite of this, all to frequently they can not be made available for students to practice coding.

computers, computers everywhere yet not a machine to code on

There is something in this old system of connecting to a remote yet powerful computer system which can be one solution to this modern educational problem.

Cloud computing is the modern equivalent. A virtual computer is created. This virtual computer, while in itself can be a very powerful machine such as a high grade internet web server of the order that is used to power enterprise systems,  is in reality nothing more than a simulation of a computer. A simulated computer that is running on another computer of staggeringly powerful proportions.

Commercial cloud computing like Microsoft Azure makes this available to the general public and it can be used by schools to circumvent the ‘no programming on the school network’ problem.

Once we have set up a Virtual Machine we can easily create user accounts and groups for all of our students. With Linux we can have many individual users all working at the same time on the same single virtual computer, each with their own desktop, running programs and individual home directories.

As they are effectively all using the same machine we only need a worry about installing and maintaining software on that one single (virtual) computer. Additionally, we don’t need worry about hardware failures as our system resides on the same mission critical rack that is used for all manner of other important systems (the NHS choices website being one such example)

An impressive program called Guacamole can be added to our virtual computer. This will allow our virtual computer to create multiple virtual desktops which can be accessed through a modern (HTML 5 compliant) web browser.

At the moment I am using the least powerful of three virtual architectures. I intend to test this on a class of thirty and then scale up if necessary.

(Update – 2 problems in school, guacamole does not seem to work well in general on the old Internet Explorer. 2 we are proxied. Guacamole depends on a constant stream of data but http data gets cached which makes it appear that the client is not responding. Solution will be to use https / websocket which is not cached)

There are other options also available such as ‘load balancing’ which involves two or more identical machines. If one machine is under too much load as many users connect to it, some will be seamlessly diverted to a different machine.

In this walk through I will create a virtual computer that runs Linux. I will then install a graphical interface, some examples of school programming software and finally install and configure Guacamole.

  • In the Azure Dashboard, create a new ‘classic’ virtual machine
  • Look through the available VMs and choose Ubuntu 14.04 Server. (This is the same as the standard Ubuntu you might install on your laptop except it is just a bare-bones system. None of the standard tools are installed and there is no graphical environment. Only command line (similar to old MS DOS). This is not a problem as we can easily install all of the missing elements.
  • You will be prompted for a username and password as part of the set up, this is important as it is the root user, the administrator. Also, you will not be able to use the system you have created without these details.
  • Go ahead and create the new system. It will take a few minutes to complete the process. When it is completed  you will be presented with a summary page of information about your new virtual machine. Look carefully and you will see a ‘Virtual IP address’. You will use this to connect to your computer and access the command line interface.
  • Open the required software ports to allow this virtual computer to communicate. Create new endpoints for HTTP (port 80), Alternative HTTP (port 8080), HTTPS (port 443) and RDP (port 3389).
  • We need to use a system called SSH to remotely access our virtual machine. This is available in the Terminal in Linux and Mac computers. For Windows we need to use putty.
  • Establish an SSH connection to your virtual IP address. In the Linux or Mac Terminal this is done with the command
    • ssh username@virtualIPaddress
  • We should now be logged in. First step is to update the list of repositories. These are known locations from where Ubuntu is able to download and install new software.
    • sudo apt-get update
  • Currently there is no graphical interface, only a text based command line. We can install one with the command
    • sudo apt-get install lxde
  • We will now follow the set of steps described in chapter 2 and chapter 5 of the Guacamole manual.
  • Install the first set of dependencies
    • sudo apt-get install libcairo2-dev libjpeg62-dev libpng12-dev libossp-uuid-dev
  • Now install the second set of dependencies
    • sudo apt-get install libfreerdp-dev libpango1.0-dev libssh2-1-dev libvncserver-dev libpulse-dev libssl-dev inlibvorbis-dev libwebp-dev
  • Download the Guacamole source code, uncompress it and then change into the new directory.
  • Now we will compile Guacamole and set it up so that it starts when the virtual computer starts.
    • sudo ./configure –with-init-dir=/etc/init.d
    • sudo make
    • sudo make install
  • When finished, change out of the guacamole directory, back to home directory, download and uncompress the guacamole client source code.
  • Install some extra tools needed to compile the client
    • sudo apt-get install maven
  • Install Apache Tomcat . This makes your virtual computer into a powerful dynamic java servlet web server and allows it to broadcast desktops visually with HTML5 over the internet into client web browsers.
    • sudo apt-get install tomcat7 tomcat7-admin tomcat7-docs
    • sudo apt-get install openjdk-7-jdk
  • Compile the Guacamole client.
    • mvn package
  • Now we will copy the compiled .war file to the Tomcat directory.
    • sudo cp guacamole/target/guacamole-0.9.9.war /var/lib/tomcat7/webapps/guacamole.war
  • Create a location for Guacamole configuration files.
    • sudo mkdir /etc/guacamole
  • Install a nice text editor to use to create the config files. Feel free to use emacs or vim here, I just like Joe.
    • sudo apt-get install joe.
  • Now create a guacamole.properties config file with the text in red below.
    • sudo joe /etc/guacamole/guacamole.properties

# Hostname and port of guacamole proxy
guacd-hostname: localhost
guacd-port: 4822

  • Press [ctrl]-[k]-[x] to save and exit. Now create a connection config file.
  • sudo joe /etc/guacamole/user-mapping.xml

 <user-mapping>

<!– Per-user authentication and config information –>
<authorize username=”username” password=”password”>
<protocol>rdp</protocol>
<param name=”hostname”>localhost</param>
<param name=”port”>3389</param>
</authorize>
</user-mapping>

  • Create a directory in tomcat7 for the connection file to go into.
    • sudo mkdir /usr/share/tomcat7/.guacamole
  • Link this to the files you just created.
    • sudo ln -s /etc/guacamole/guacamole.properties /usr/share/tomcat7/.guacamole
    • sudo ln -s /etc/guacamole/user-mapping.xml /usr/share/tomcat7/.guacamole
  • Install RDP client to allow remote desktop broadcasting.
    • sudo apt-get install rdesktop  freerdp-x11 xrdp
  • Restart guacamole and tomcat
    • sudo service guacd restart
    • sudo service tomcat7 restart
  • At this point you should now be able to login to your new desktop. Check your Azure VM properties and you will see a URL. Something like: yourservername.cloudapp.net
  • Type into a web browser http://yourservername.cloudapp.net:8080/guacamole
  • You should see a login screen, type in the username and password you specified in your connection config file.
  • You should now see a second login screen, type in your root username and password that you specified when you created the virtual machine.

You should now be logged into an Ubuntu desktop as if you were using it on your own computer. You can now use the adduser commands to create logins for your students as well as install new software for example:

  • sudo apt-get install idle idle3 scratch

If it doesnt work, the first places to check are the log files. These are usually very detailed and help you find the problem.

Look at both of these files

  • /var/log/syslog
  • /var/log/tomcat7/catalina.out

 

 

Advertisements
Computing in school – making a virtual machine in Azure

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Google+ photo

You are commenting using your Google+ account. Log Out / Change )

Connecting to %s