Subversion in 5 minutes

June 27, 2009

I have recently installed a Subversion on my Ubuntu VM for my personal use:

  • Store little bit of source code , when I play with code
  • Store documents in order to keep a track of modifications

Subversion is a popular Software Configuration Management (SCM), the CVS successor.
Installing Subversion for a personal use is quite simple.
Distribution installation
Easy by using the Ubuntu package utility:

sudo apt-get install subversion

SNVServe
First we have to create a directory that will be the root to store all Subversion repositories.

mkdir /usr/local/repositories

Then, we will use a simple server in order give access to the repositories.
This server is called svnserve.

svnserve -d -r /usr/local/repositories

By using the command above, we tell the server to start from the created directory in daemon mode.
Once started the server will be accessible at the following URL: svn://localhost:3690/
Creating a repository
Now, we have to create a repository in order to store data.
Creating a repository (called test) can be done by using the following command:

svnadmin create /usr/local/repositories/test

This command will create the test folder containing the default Subversion repository structure.
Configuring access rights
Since, this repository is for a personal use, we will give write access to all users. To do that, it is necessary to modify the following file in the newly created repository test/conf/svn/svnserve.conf. Using these settings is certainly not advised in a production context.

# anon-access = read
anon-access=write

Creating repository structure
In Subversion, repositories have, usually the following structure:

  • trunk: Main development
  • tags: Space to store tags (label)
  • branches: Space to store branches

This is not mandatory but it is a convention, widely used.
So, we will initialize this structure by creating corresponding folders in a temporary directory called import-svn for e.g. and then import this structure in the repository.

mkdir -p /tmp/import-svn/trunk /tmp/import-svn/tags /tmp/import-svn/branches
svn import /tmp/import-svn/ svn://localhost:3690/test

You will have to cancel the edition of a comment text and to continue in order to commit the import.

If you want to use your repositories from outside the VM, you can forward the TCP port 3690 to 3699 for e.g. see this post for more details on port forwarding.


VirtualBox Headless

June 20, 2009

Sun Virtual Box Logo

VirtualBox is an amazing software, it permits to emulate several guest systems. This process is also called virtualization. With this tool, it is, for example, possible to run a Linux installation (called Guest) on a Mac OS X system (called host).In this way, this is very easy to run a Linux safely. This virtual environment will be a great playground to perform tests, install softwares, etc. since it will be easy to save and restore a previous configuration without spoiling your main environment.

Ubuntu running on Mac OS X inside a VM

Ubuntu running on Mac OS X inside a VM

I will tell more about VirtualBox features and usages in next posts.
But know, I will explain how to access the system running in the VirtualBox environment (the Guest) from the host machine. This is useful, for example, if you want to use your Linux installation trough the SSH protocol. This avoid to be inside the Virtual Machine (VM) screen to use it. You can then use your VM as if was a server located on your network.
The default network protocol used when you create a VM is NAT (Network Address Translation). With this configuration, it is possible to access by default to the Internet form the Guest. But if we want to access the Guest from the Host trough ssh an additionnal setting is required. It consists in defining port forwarding for the ssh port. The goal is to forward to the default ssh port (22) on the Guest, queries made on a new port (2222) on the Host.

Declaring port forwarding (To run these instructions the VM must not be running)

VBoxManage setextradata "Ubuntu" "VBoxInternal/Devices/pcnet/0/LUN#0/Config/guestssh/Protocol" TCP
VBoxManage setextradata "Ubuntu" "VBoxInternal/Devices/pcnet/0/LUN#0/Config/guestssh/GuestPort" 22
VBoxManage setextradata "Ubuntu" "VBoxInternal/Devices/pcnet/0/LUN#0/Config/guestssh/HostPort" 2222

Where:

  • Ubuntu: is the name of the VM
  • pcnet: is the default network card
  • gestssh: is a name given to the setting

Behind the scene, the definition file of the VM (Ubuntu.xml in this case) is updated:

<ExtraData>
 <ExtraDataItem name="VBoxInternal/Devices/pcnet/0/LUN#0/Config/guestssh/Protocol" value="TCP"/>
 <ExtraDataItem name="VBoxInternal/Devices/pcnet/0/LUN#0/Config/guestssh/GuestPort" value="22"/>
 <ExtraDataItem name="VBoxInternal/Devices/pcnet/0/LUN#0/Config/guestssh/HostPort" value="2222"/>
</ExtraData>

Installing the server on the guest

Now it’s time to install the ssh server on the Guest.
On the Guest:

sudo apt-get install openssh-server

Now the ssh server is installed and is running.

Enabling the X protocol on ssh
On a Ubuntu installation the X server is configured with the -nolisten tcp option. In order to be able to use the X protocol trough this configuration, this option has to be enabled.

sudo vi /etc/gdm/gdm.conf
#DisallowTCP=true
DisallowTCP=false

The X server needs a restart to take this modification into account.

Run the VM in Headless mode
The Headless mode permits to run a VM without the need to use the VirtualBox GUI nor to have the VM displayed in a window. To do that run the VM as folllow:

VBoxHeadless --startvm Ubuntu --vrdp=off

The vrdp option is turned off because it is useless since we will use ssh to connect to the VM.

Connect to the Guest form the Host
Use an ssh client, for example the command line to connect to the Guest.

ssh -X [user]@localhost -p 2222

WBS tools

June 14, 2009

To create a WBS, it can be interesting to use a Mind mapping software. Mind maps are diagrams used to represent information in a graphical structure called map. Softwares permit to create these diagrams. Several products exist in this category, like (see here for the full list):

  • XMind : Based on the Eclipse platform. This is the tool that has been used to produce diagrams of this post.
  • FreeMind: One of the first free mind mapping software (written in Java).

Since the WBS is a hierarchical structure, Mind mapping tools permits to represent and to design it efficiently. In consequence, it will be easy to:

  • Expand / Collapse level to show hide WBS detail
  • Reorder elements of the WBS (if an activity does not belong to a category, it is easy to move it with a Mind mapping software)
  • Add new elements, elements are easily inserted, numbering of existing elements is automatically computed
  • Add additional informations (notes, flags, etc.), Mind mapping softwares permit to add graphical elements in order to bring visual information.
  • Offer a global view of the project
  • Export the structure to a spreadsheet application for further use like estimating the WBS
  • And many other things, …

The following screen shots show what can be done in XMind with the example of the WBS presented in a previous post. All the views presented below have been created with the same structure, only the visual representation has been switched.

The standard map clockwise view (note: numbering function has been used in order to identify each activity of the WBS), this view is (most of the time) the default view of Mind mapping softwares:

WBS map view

WBS map view

The tree view, this is the standard view to represent a WBS:

WBS Tree structure

WBS Tree structure

The spreadsheet view:

WBS spreadsheet view

WBS spreadsheet view

And, my favorite (it is the most funny) the fishbone view:

WBS fishbone

WBS fishbone