Skip to content

Tutorial 02 Environment

Bradley Dice edited this page Aug 1, 2015 · 2 revisions

For this tutorial we are going to use Python for creating a webserver, so before we start, we should take some time setting-up our development environment.

Step 1 - Virtualenv

The very first thing to do is to install virtualenv if you don't already have.This is a really useful utility for creating sandboxed python installations.

sudo pip install virtualenv

Then, create a new sandbox for our tutorial and enter inside it:

virtualenv vmcp --no-site-packages
cd vmcp
source bin/activate

Step 2 - Libraries

Now you are ready to install the python libraries that we are going to need:

pip install flask m2crypto

Hint: If you have problems installing m2crypto you can try installing pycrypto or rsa. Any of these RSA libraries can be used.

Step 3 - Setting-up your local domain

For the purpose of this tutorial we are going to need a domain for which an authorization key is issued. The tutorial files already contain a private key for the domain test.local, so we will need to put an alias of this domain name to the localhost IP address.

To do this you will need to add to your machine's hosts file the following line:

127.0.0.1       test.local

To edit this file on windows:

  1. Open notepad with administrator privileges
  2. Open the C:\Windows\System32\drivers\etc\hosts

Or on Mac OSX / Linux:

  1. Open a terminal
  2. Type sudo nano /etc/hosts
  3. When done, press CTRL+X, Y and ENTER to save

Step 4 - Getting the tutorial files

All the tutorial files is located on the github repository of cernvm-webapi, in the folder doc/tutorial. Copy the contents of the entire folder in your virtualenv installation.