Skip to content

sandervdwaal/OpenConext-vm

 
 

Repository files navigation

OpenConext Virtual Machine

These are the source files to build an OpenConext Virtual Machine.

Requirements for building the OpenConext VM (in order)

Do not start installing

  • The latest version of VirtualBox
  • RVM
  • Git
  • Patience (a full build, depending on your network connection, should take about 1 hour)

Requirements on Debian/Ubuntu

Install Virtualbox, see: https://www.virtualbox.org/wiki/Linux_Downloads Install required packages:

$ sudo apt-get install git libssl-dev libopenssl-ruby zlib zlib1g-dev

Installation

First install VirtualBox if you have not done already. Make sure you use the latest version.

The OpenConext Virtual Machines scripts uses Ruby, Vagrant and VeeWee for building up the VM. You don't have to install these dependencies as we use Bundler to install gems in the local gemset (to avoid polluting your global applications and/ or gemset).

To use Ruby and use local gemsets we first need to install RVM using:

$ curl https://raw.github.com/wayneeseguin/rvm/master/binscripts/rvm-installer | bash -s stable

Make sure to restart your terminal, or session in order to add the directory of the rvm command to your PATH.

Due to an incompatibility with the default openssl installation on mac-os it might be necessary to (re)compile ruby with a different openssl. See for more information:

http://blog.55minutes.com/2012/01/fixing-a-segmentation-fault-in-ruby-193/

Now we can install the latests Ruby version (NOTE if you are on mac-os you will have to use the second command) :

$ rvm install 1.9.3 

Or

$ rvm install 1.9.3 --with-openssl-dir=/opt/local --with-iconv-dir=/opt/local

And set the 1.9.3 version to the default (not strictly necessary)

$ rvm --default use 1.9.3

Please note that RVM uses bash profile to load itself in your shell. Thus, RVM doesn't load when you use another shell or don't login to your shell. In gnome-terminal on Ubuntu you can enable login by: Edit > Profile preferences > Run command as a login shell.

Verify the correct installation by typing:

$ ruby -v

You should see:

ruby 1.9.3p0 (2011-10-30 revision 33570) [x86_64-darwin10.8.0]

Now get the source code of the OpenConext VM:

$ git clone git://github.com/OpenConext/OpenConext-vm.git
$ cd OpenConext-vm

Now you are prompted to accept the OpenConext .rvmrc file:

RVM has encountered a new or modified .rvmrc file in the current directory =
This is a shell script and therefore may contain any shell commands.       =

Examine the contents of this file carefully to be sure the contents are    =
safe before trusting it! ( Choose v[iew] below to view the contents )      =

Do you wish to trust this .rvmrc file? (/path/OpenConext-vm/.rvmrc)
y[es], n[o], v[iew], c[ancel]>

Accept the .rmvrc file by typing y

Now install bundler as local gem:

$ gem install bundler

If this results in a zlib error, install zlib with the command:

$ rvm pkg install zlib
$ rvm reinstall 1.9.3

You may also need to install zlib1g-dev at your OS

Next use the gems defined in the Gemfile to install vagrant and veewee:

$ bundle install

Verify that Vagrant and VeeWee are setup correctly with the following commands (should not return an error):

$ vagrant -v
$ vagrant basebox templates

Then build a basebox (one time):

$ vagrant basebox build -f demo.openconext.org 

Make sure you answer Yes and not Y when asked to download the box file. Please let all the commands run untill your prompt is back (e.g. don't go start typing in the pop-ups of the VM)

$ vagrant basebox export demo.openconext.org
$ vagrant box remove demo.openconext.org
$ vagrant box add demo.openconext.org demo.openconext.org.box

The third command is necessary to clean up previous boxes. If this is the first time you can ignore the following:

$ Box 'demo.openconext.org' could not be found

Then instantiate the box:

$ vagrant destroy
$ vagrant up

Finally copy host/hosts to your hosts file and point your browser to https://profile.demo.openconext.org.

If you want to avoid having to add the ssl exceptions in your browser you can import the Certificate Authority certificate:

OpenConext-vm/certs/openconext.pem 

into your browser.

To login in on the several Service Providers you can choose OpenConext Mujina IdP from the WAYF and login with admin, secret.

Platform usage

You can now use the following OpenConext components:

If you want to make modifications to the components a Samba share is available at:

smb://172.18.5.2/www
username: openconext
password: openconext

If you want to query or update the database, you can connect to it either from the prompt:

$ vagrant ssh
$ mysql -u root -p
Enter password: c0n3xt

Or use the host DNS entry demo.openconext.org and default port 3306.

VM usage

We use Vagrant to manage the VM sp please refer to the their documentation for an quick overview of the available commands, or type

$ vagrant

SSH & SCP

To connect to the VM with ssh or copy files with scp you can inspect the ssh settings with:

$ vagrant ssh-config

which will print the ssh configuration used with vagrant ssh:

Host default
HostName 127.0.0.1
User vagrant
Port 2222
UserKnownHostsFile /dev/null
StrictHostKeyChecking no
PasswordAuthentication no
IdentityFile /Users/user/.vagrant.d/insecure_private_key
IdentitiesOnly yes

You can (as an alternative to ssh vagrant) use this information to ssh or scp (mind to replace the key file with the path of the vagrant ssh-config setting):

ssh -i /Users/user/.vagrant.d/insecure_private_key vagrant@localhost -p 2222
scp -P 2222 -i /Users/user/.vagrant.d/insecure_private_key some_local_file vagrant@localhost:

If you add the output of vagrant ssh-config to your ~/.ssh/config file you can ease the copying of files or connecting to the VM:

ssh default
scp some-local-file default:

As an alternative you change the samba share configured in OpenConext-vm/scripts/samba_install.sh.