Lab Tutorial
Lab Tutorial
Authors: Jordi Blasco Planesas & Montserrat Rovira Marco
Distributed Systems course
Spring 2015
1.
OVERVIEW.........................................................................................................................2
2.
GNU/LINUX VIRTUAL MACHINE ................................................................................3
2.1.
3.
Install VirtualBox ....................................................................................................................... 3
JAVA .....................................................................................................................................5
3.1.
Installation ................................................................................................................................ 5
3.2.
Setup ......................................................................................................................................... 5
4.
4.1.
ECLIPSE ..............................................................................................................................6
Installation ................................................................................................................................ 6
4.2.
Setup ......................................................................................................................................... 6
4.2.1.
Testing environment: ............................................................................................................. 8
4.2.2.
Import and run SD project ...................................................................................................... 9
Distributed Systems
Page 1 of 10
Lab Tutorial
1. Overview
The purpose of this manual is to explain how to prepare the environment to do the practice of
Distributed Systems.
The manual is divided into the following sections:
Virtual machine: this section explains how to install the virtualization software, and how
to create our virtual machine with GNU / Linux.
This section is important if you use Windows OS; if you use GNU/Linux or OS X, you
can ignore this section.
Java: this section explains how to install and configure Java.
You can ignore this section if you already have Java7 or upper installed in your
computer.
Eclipse: this section explains how to install and configure Eclipse IDE. Moreover, you
can learn how to create a new project and how to do a test. Also shows how to import
the PRA as an Eclipse Project and how to execute Phase1
Distributed Systems
Page 2 of 10
Lab Tutorial
2. GNU/Linux virtual machine
The base code we provide you is ready to be validated in GNU/ Linux environment. So you
need to have installed Linux in your computer. If you do not have it installed you can create a
virtual machine with GNU/Linux.
We use VirtualBox for virtualizing operating systems
2.1.
Install VirtualBox
Download the appropriate package for your operating system:
[Link]
Install the software on your computer
Download the operating system GNU/ Linux as an image (.iso file).
e.g. Ubuntu 14.04.2 LTS 32bits
[Link]
Run VirtualBox:
Select Machine New ... Put a name and select an OS Select RAM Memory
allocated to this virtual machine Select Create a virtual hard drive now VDI
Dynamically allocated Select the maximum disk size Create
Prepare the installation of the virtual machine you just created:
Select Settings ... Storage Controller: IDE Add CD/DVD Device icon choose
disk select ubuntu .iso file Open OK
Figure 1
Distributed Systems
Page 3 of 10
Lab Tutorial
Figure 2
Start the virtual machine and Install the operating Ubuntu to the virtual machine.
After this process is completed you will have available GNU/Linux OS.
Distributed Systems
Page 4 of 10
Lab Tutorial
3. Java
For developing and deploying java applications install Java Standard Edition Development Kit
(JDK) on your computer. You will need JDK7 or upper in order to do the practice
There is another product available, Java Standard Edition Runtime Edition (JRE), but only
include utilities for running java programs, not for compiling source code.
3.1.
Installation
Download jdk according to your operating system:
GNU/Linux:
RedHat, Suse, Oracle Linux, SLES
32bits: [Link]
64bits: [Link]
3.2.
Ubuntu: [Link]
OS X: [Link]
Setup
If you try to run java code from Command Line Interface (CLI), you will need to set PATH. This
environment variable allows you to run java utilities from any folder.
To set environment variable PATH:
[Link]
Distributed Systems
Page 5 of 10
Lab Tutorial
4. Eclipse
An integrated development environment (IDE) or interactive development environment is a
software application that provides comprehensive facilities to computer programmers for
software development. An IDE normally consists of a source code editor, build automation tools
and a debugger. There are several Java IDE available and eclipse is the one we use.
The practice can be done with any other IDE, but from Distributed Sytems laboratory only will
support Eclipse.
4.1.
Installation
Install Eclipse:
Download Eclipse IDE for Java Developers, from
[Link]
Unzip the file into the folder you like
run eclipse.
4.2.
Setup
1. Run eclipse and choose a folder to be the workspace. Eclipse will store your Java
Projects into this folder
Figure 3
2. Then choose Go to the workbench.
Distributed Systems
Page 6 of 10
Lab Tutorial
3. The main screen that shows us Eclipse IDE is:
Figure 4
Distributed Systems
Page 7 of 10
Lab Tutorial
4.2.1. Testing environment:
1. Creating a new project: File New Java project Project Name: TestEntorn
2. Creating a new class: select the project File New Class Name: Test
3. Put the following text in the tab called [Link]:
public class Test {
public static void main(String args[]) {
[Link]("Hi world!");
}
}
4. Run: Run Run configuration Java Application New Name: RunTest;
Project: TestEntorn; Main class: Test Apply Run.
You may see Hi world! in the eclipse console.
Figure 5
Distributed Systems
Page 8 of 10
Lab Tutorial
4.2.2. Import and run SD project
For importing a project easily:
1. Download the project and unzip.
2. Import: File Import... General Existing projects into Workspace select this
folder: (...)/2015p-practica-SD/2015p-practiques-SDbaseCode;
3. Select Copy project into workspace Finish.
Figure 6
Local evaluation
When you have implemented Log and TimestampVector classes, you can test in a diferent
ways:
From CLI, run:
java -cp ../bin [Link] --phase1
(run it from scripts folder)
From Eclipse:
Run Run Configuration create run configuration Arguments tab:
Program arguments:
<port> <uoc-username> -h [Link]
Working directory :
${workspace_loc:2015p-practica-SDsolucio/scripts}
Apply Run
Distributed Systems
Page 9 of 10
Lab Tutorial
Formal evaluation
From CLI, run:
java -cp ../bin recipesService.Phase1 <port> <uoc-username> -h [Link]
(run it from scripts folder)
From Eclipse:
Run Run Configuration create run configuration Arguments tab:
Program arguments:
<port> <uoc-username> -h [Link]
Working directory :
${workspace_loc:2015p-practica-SDsolucio/scripts}
Apply Run
Distributed Systems
Page 10 of 10