Skip to content

DevMachineSetup

swmde52 edited this page Mar 16, 2013 · 4 revisions

Development Environment Setup

Details of the steps taken to set up a dev environment on Linux Mint Maya (16/03/2013).

Tools

I installed the following tools for my use during the setup, feel free to uninstall them afterward if you wish:

sudo apt-get install tmux vim

Git and Github

Firstly, I installed git, and a couple of useful tools:

sudo apt-get install git gitk git-gui

Next, I configured git:

git config --global user.name "Stephen William Mansfield"
git config --global user.email "[email protected]"
git config --global color.ui true

I followed these instructions to generate a pair of keys:

ssh-keygen -t rsa -C "[email protected]"

Next, I uploaded the public key to github:

sudo apt-get install xclip
xclip -sel clip < ~/.ssh/id_rsa.pub

Project Directory

Created a project directory to hold jemelec related work, including projects:

mkdir -p ~/workspace/jemelec/projects

Python Dev Environment

The first step is to install pythyon setuptools from the Mint repositories. This allows us to bootstrap the actual python tool we'll use to manage python libraries:

sudo apt-get update
sudo apt-get install python-setuptools python-dev

Now install pip, which is a better tool for managing python libraries:

sudo easy_install pip

Now install (still system-wide) virtualenv and virtualenvwrapper for creating and managing python virtual environments. And also ipython because it's a useful python repl to have installed:

sudo pip install virtualenv virtualenvwrapper ipython

Virtualenvwrapper needs some further installation steps. The following lines were appended to ~/.bashrc:

export WORKON_HOME=$HOME/.virtualenvs
source /usr/local/bin/virtualenvwrapper.sh

This configures virtualenvwrapper to create the python virtual environments in ~/.virtualenvs.

For this to take affect, you will need to start a new terminal session.

At this stage it is now possible to create new python virtual environments. So create one for the jem-data python project:

mkvirtualenv jem-data

jem-data project

Firstly, I cloned the source repository into the jemelec proects directory (naming it swmde52, rather than the default origin):

cd ~/workspace/jemelec/projects/
git clone --origin swmde52 [email protected]:swmde52/jem-data.git

And added my repository as a remote repository too:

cd jem-data
git remote add icmurray [email protected]:icmurray/jem-data.git

With the source code downloaded, development can be started. First, activate the jem-data virtualenv:

work jem-data

and then install all the dependencies:

pip install -r ./pip-requirements-test.txt
pip install -e .

This being successful, the tests should now be runnable, and all pass:

nosetests

And the also the server simulator should run:

python ./jem_data/server_sim/main.py

... and the benchmarking script should be runnable against the server running above:

python jem_data/analysis/performance.py --host=127.0.0.1 --port=5020 --unit=0x01 --requests=10 --delay=0

Lastly, I cloned the jem-data wiki into ~/workspace/jemelec/projects/jem-data.wiki:

cd ~/workspace/jemelec/projects
git clone [email protected]:icmurray/jem-data.wiki.git

Scala Setup

First, install the Java Development Kit -- Open JDK is fine:

sudo apt-get install openjdk-7-jdk
sudo rm /etc/alternatives/java /etc/alternatives/javaws
sudo ln -s /usr/lib/jvm/java-7-openjdk-i386/jre/bin/java /etc/alternatives/java
sudo ln -s /usr/lib/jvm/java-7-openjdk-i386/jre/bin/javaws /etc/alternatives/javaws

To get started with the scala application, the first thing that's needed is sbt, the Scala Build Tool:

cd ~/
mkdir bin
cd bin
wget 'http://repo.typesafe.com/typesafe/ivy-releases/org.scala-sbt/sbt-launch//0.12.2/sbt-launch.jar'
echo 'java -Xms512M -Xmx1536M -Xss1M -XX:+CMSClassUnloadingEnabled -XX:MaxPermSize=384M -jar `dirname $0`/sbt-launch.jar "$@"' > ./sbt
chmod u+x ./sbt

Then, we'll install Play2.1, a scala web framework:

cd ~
mkdir opt
cd opt
wget 'http://downloads.typesafe.com/play/2.1.0/play-2.1.0.zip'
unzip ./play-2.1.0.zip
ln -s ./play-2.1.0 ./play
cd ~/bin
ln -s ~/opt/play/play play2.1

Now, download the jem-web source:

cd ~/workspace/jemelec/projects
git clone --origin swmde52 [email protected]:swmde52/jem-web.git
cd jem-web
git remote add icmurray [email protected]:icmurray/jem-web.git

And start the Play console:

cd ~/workspace/jemelec/projects/jem-web
play2.1

Within the play console, run:

update
compile
test
run

With the server running, you should be able to visit http://127.0.0.1:9000 and see the application running.

Installing MongoDB

MongoDB is downloaded as a pre-built package (note -- these instructions use the 32-bit version due to the dev. machine being a 32-bit architecture. But the production version will be the 64-bit build).

cd ~/opt
wget 'http://fastdl.mongodb.org/linux/mongodb-linux-i686-2.2.3.tgz'
tar xvzf ./mongodb-linux-i686-2.2.3.tgz
ln -s mongodb-linux-i686-2.2.3 mongodb
cd ~/bin
ln -s ~/opt/mongodb/bin/mongod
Clone this wiki locally