Personal tools
You are here: Home Documentation Tutorials Installing and setting up Grok under mod_wsgi Setting up a clean Linux server

Setting up a clean Linux server

When starting with a new server, it's important to get all required packages in place before beginning.
Grok can run behind any WSGI server. This tutorial will show how to install Grok behind the Apache web server and mod_wsgi on a brand new Linux virtual server.
Page 3 of 5.

I decided to cover the whole setup from new server to Grok startup in this tutorial, to offer a complete guide for the whole process in a single place. I chose to use Linux as the operating system, again because it's by far the most popular way to deploy web applications right now. Ubuntu is my distribution of choice, but this steps apply equally well to any Debian based distribution. Other distributions use different package managers and probably other system paths, but you should be able to figure out easily what you need in any case.

You can start with a clean install of a recent version of Ubuntu GNU/Linux. The first step is to install the necessary packages for the correct Python version (Grok 1.1 requires Python 2.6/2.5) and also for the Apache server.

Before that, It is necessary to install the required packages for being able to compile and build software using Ubuntu (other distributions usually don't need this). Be aware that both package installation and Apache module additions usually require root access. In the commands block, the prompt with '$' is a user prompt, '#' is a root prompt you can have with sudo -s. In this part, you'll use a root terminal to not have to prefix each command by sudo. In the other parts, you'll use a user terminal where you add sudo before a command if you need to execute something as root. You can have one terminal opened as root and another terminal as user.

$ sudo -s
# apt-get install build-essential

Next, the packages for Python and Apache. Like most packaged Linux distributions, Ubuntu requires a separate install for the development libraries of each piece of software:

# apt-get install python2.5 python2.5-dev
# apt-get install apache2

The apache2 package usually install apache2-mpm-worker, but maybe you have the other version, apache2-mpm-prefork, installed. To be sure which one is installed you can execute:

# dpkg -l|grep apache2

Then install the corresponding development package, apache2-threaded-dev if apache2-mpm-worker is installed, apache2-prefork-dev if apache2-mpm-prefork is installed:

# apt-get install apache2-threaded-dev

Grok uses Python's setuptools, so that package is needed as well:

# apt-get install python-setuptools

It's possible the version provided by the Ubuntu package is not the latest. If you want to have more control of the installed version of setuptools and want to update it yourself when a new version is available, you can use the following method instead. Download manually setuptools-0.6c9-py2.5.egg (or latest version, choose py2.5) and execute the command:

# sh setuptools-0.6c9-py2.5.egg

You can later update it with sudo easy_install-2.4 -U setuptools.