Category Archives: Uncategorized

How to install PostgreSQL 9.2 on Debian 7 (Wheezy).


In this blog post I’m going to give you a walk through on how to install PostgreSQL 9.2 on Debian 7  (Wheezy).

Less than few weeks ago the Debian team released a new version (7.0) code name ‘Wheezy‘.
With this version the development team has improved many interesting features such
several tools to deploy private clouds, an improved installer and multiarch support.

As you probably know, the Debian stable releases can take a really long time (1.5-2 years), so
by the time of the release the packages might be not at the latest version, e.g.
Debian Wheezy comes PostgreSQL 9.1 meanwhile other distribution are already using PostgreSQL 9.2.

Top 5 reason to use PostgreSQL 9.2

Index-only scans
Replication improvements
JSON datatype
Range Types
Performance improvements

Full list at

To successfully install PostgreSQL 9.2 on Debian 7 (Wheezy), please follow the instructions below.

As root user execute:

apt-get install python-software-properties

wget --quiet -O - | sudo apt-key add -

add-apt-repository "deb wheezy-pgdg main"

apt-get update && apt-get install postgresql

Smooth-Sec 64bit edition is out

Today I’m pleased to announce the long-awaited release of Smooth-Sec 64bit edition. This new version brings substantial improvements in term of high performances with the adoption of 64bit Debian gnu-Linux operating system.

Smooth-Sec 64bit edition features:

Operating system: Debian 6.0 squeeze 64-bit
IDS: Suricata 1.3 stable
WEB Console: Snorby 2.5.1
Database: MariaDB 5.5.25
Log interpreter: Barnyard2 2.1.10-beta2
Web framework: nginx/0.8.54 – passenger-3.0.4

ISO Download:

I hope you enjoy it

How to install Nmap 6 on Ubuntu 12.04

Fyodor and the Nmap crew today have released the version 6 of the famous Network Mapper. This major release brings 600 significant improvements (see, the top 6 are:

Nmap Scripting Engine (NSE) – 352 scripts!

Better Web Scanning

Full IPv6 Support

New Nping Tool

Better Zenmap GUI & results viewer

Faster scans

To install the latest Nmap on Ubuntu 12.04 please follow this steps, please note that I’m using Checkinstall to build the .deb package. Using CheckInstall will give an easy way to install or remove the  files from the file system.


apt-get install build-essential checkinstall


bzip2 -cd nmap-6.00.tar.bz2 | tar xvf -

cd nmap-6.00




dpkg -i nmap_6.00-1_i386.deb

To try nmap.

nmap -A


Ubuntu, Django, Postgresql and Nginx, a rock solid web stack.

Lately I’ve been working on developing a web application project,   I guess everyone involved in such process had to make the uneasy decision to choose the right Web Stack to run the application.  Multiple factors usually drive the final decision,total cost of ownership (TCO), scalability, stability and performances. The TCO factor can be easy overcome with FLOSS (Free and open source software), scalability is a very broad term and concept  that doesn’t have any clear answer. Stability can be achieved with software that is  widely used and widely reviewed and tested for a long time, never pick something new just because it’s cool. Doesn’t matter if the website serve millions of users or just a few hundred, slow or bad performances can make the user experience a nightmare. Performance enhancement can be  achieved with, Memory caching system, Low memory footprint web servers, good and slim database design, query optimization to work under heavy loads. Please  be aware that applications, services and workloads differ from case to case, you might need more write capacity rather than read, serving multimedia files or whatever else, don’t blame me if you have troubles with your production application after following this how-to. For me and some other, this setup works quite well, I hope the same for you :-) .

This tutorial covers the set up a free, full-featured web development framework based on Ubuntu Server 12.04(LTS), Django 1.4 stable, Postgresql database V. 9.1, Nginx web server V.1.1.19 and Gunicorn.

Ubuntu Server
Linux for high-volume server workloads

The web framework for perfectionists with deadlines

A powerful, open source object-relational database system.

A web server with a strong focus on high concurrency, performance and low memory usage.

A WSGI HTTP Server, the link between Django an Nginx.

Postgresql installation and setup

apt-get install postgresql python-psycopg2

sudo -u postgres psql template1

ALTER USER postgres with encrypted password 'a_strong_password';

template1=# CREATE DATABASE test;

template1=# CREATE USER test WITH PASSWORD 'test';

template1=# GRANT ALL PRIVILEGES ON DATABASE test to test;

In /etc/postgresql/9.1/main/pg_hba.conf


local   all             postgres                                peer


local   all             postgres                                md5

local   all             all                                     peer


local   all             all                                     md5

Restart Postgresql server with:

/etc/init.d/postgresql restart

To thest the local connection to the database please use:

psql -d postgres -U postgres


psql -d test -U test

Django installation and setup.

apt-get install aria2c


tar xvfz Django-1.4.tar.gz

python install

mkdir /var/djangoweb/  startproject myproject  startproject myproject

cd myproject/

mkdir /var/djangoweb/myproject/static

ln -s /usr/local/lib/python2.7/dist-packages/django/contrib/admin /var/djangoweb/myproject/static/

in myproject/


import os.path
PROJECT_DIR = os.path.dirname(__file__)

Database setup in django

    'default': {
        'ENGINE': 'django.db.backends.postgresql_psycopg2', # Add 'postgresql_psycopg2', 'mysql', 'sqlite3' or 'oracle'.
        'NAME': 'test',                      # Or path to database file if using sqlite3.
        'USER': 'test',                      # Not used with sqlite3.
        'PASSWORD': 'test',                  # Not used with sqlite3.
        'HOST': '',                      # Set to empty string for localhost. Not used with sqlite3.
        'PORT': '',                      # Set to empty string for default. Not used with sqlite3.

Then go to the INSTALLED_APPS section and uncomment
django.contrib.admin line.

    # Uncomment the next line to enable the admin:
    # 'django.contrib.admin',
    # Uncomment the next line to enable admin documentation:
    # 'django.contrib.admindocs',

and # ‘django.contrib.admin’,

    # Uncomment the next line to enable the admin:
    # Uncomment the next line to enable admin documentation:
    # 'django.contrib.admindocs',

in myproject/ uncomment the following lines.

from django.contrib import admin

url(r'^admin/', include(,

The  file have to look like this.

from django.conf.urls import patterns, include, url

# Uncomment the next two lines to enable the admin:
from django.contrib import admin

urlpatterns = patterns('',
    # Examples:
    # url(r'^$', 'myproject.views.home', name='home'),
    #url(r'^myproject/', include('')),

    # Uncomment the admin/doc line below to enable admin documentation:
    # url(r'^admin/doc/', include('django.contrib.admindocs.urls')),

    # Uncomment the next line to enable the admin:
    url(r'^admin/', include(,

Now the basic parameters are defined, we must perform the first database synchronization,
go on top of the project root and issue the “python syncdb” command.

You’ll see the creation of the first Django tables inside the database,  you also need to create
the administrator user.

Creating tables ...
Creating table auth_permission
Creating table auth_group_permissions
Creating table auth_group
Creating table auth_user_user_permissions
Creating table auth_user_groups
Creating table auth_user
Creating table django_content_type
Creating table django_session
Creating table django_site
Creating table django_admin_log

You just installed Django's auth system, which means you don't have any superusers defined.
Would you like to create one now? (yes/no): yes
Username (leave blank to use 'root'): phillip
E-mail address:
Password (again):
Superuser created successfully.
Installing custom SQL ...
Installing indexes ...
Installed 0 object(s) from 0 fixture(s)

At this point the Django interaction with the database looks working properly.

In order to get access to Django administration page you need to run the
embedded python web server.

python runserver
Validating models...

0 errors found
Django version 1.4, using settings 'myproject.settings'
Development server is running at
Quit the server with CONTROL-C.

Point the browser to:


Gunicorn installation and setup

Install gunicorn

apt-get install git python-setuptools
git clone git://
cd gunicorn/
python install

inside the root project folder myproject


bind = ""
workers = 2
#recommended (2 x $num_cores) + 1

To run gunicor go in the root project folder and run:

gunicorn_django -c

To Daemonize the Gunicorn process add -D

gunicorn_django -c -D

Yum must get:

gunicorn_django -c
2012-05-01 19:53:28 [6176] [INFO] Starting gunicorn 0.14.2
2012-05-01 19:53:28 [6176] [INFO] Listening at: (6176)
2012-05-01 19:53:28 [6176] [INFO] Using worker: sync
2012-05-01 19:53:28 [6180] [INFO] Booting worker with pid: 6180
2012-05-01 19:53:28 [6181] [INFO] Booting worker with pid: 6181

Nginx installation and configuration

apt-get install nginx-full  openssl

rm /etc/nginx/sites-enabled/default

touch /etc/nginx/sites-available/django

ln -s /etc/nginx/sites-available/django  /etc/nginx/sites-enabled/django

In /etc/nginx/sites-enabled/django please add:

server {

listen   server_ipaddress:80;
#server_name *.site1;

access_log /var/log/nginx/djangosite1.access.log;
error_log /var/log/nginx/djangosite1.error.log;

location / {


#location /static {
#         autoindex on;
#         root /root/blog/public_html/;
#    }

location /static/admin {
         autoindex on;
         root /var/djangoweb/myproject/static/admin;


/etc/init.d/nginx restart

Django admin web interface.

Now you can point the browser to  http://server_ipaddress/admin/, be aware the myproject directory is just the schema container for the project, no applications are yet configured or installed. I strongly advise to follow “Writing your first Django app” how-to, do not copy paste the code.

If you want to find more about django development please take a look to:

Django From the Ground Up video series
DjangoCon 2011
The Django book

I hope this document will be useful for who is struggling with Django setup. Stay tuned.

April 2012 events – Nothing will happen (Belgrade) – Richard Stallman speech (Zagreb)

Nothing will happen in Belgrade 2012

In the next coming week a few events are taking place over Belgrade and Zagreb, as usual on the middle of april I will attend for nista neće dogoditi (Nothing will happen), an tech unconference for hackers from former Yugoslavian countries. This year the conference is hosted inside the newborn “Hacklab Belgrade” on April 21 and 22, I’m really  eager to visit the hackerspace and to see on what the crew is up to. Nothing will happen is an unique event, no schedule, no plan, but all of sudden things come together, and that is the moment  where to prove your hacker attitude. Hope to see you in Belgrade.

How to get to the Hacklab:

 Richard Stallman: For a Free Digital Society

On Monday, 23th April 2012 18:00, at the Zagreb Museum of Contemporary Art, Richard Stallman will deliver a speech  on the subject “For a Free Digital Society”.

“Activities directed at “including” more people in the use of digital technology are predicated on the assumption that such inclusion is invariably a good thing.  It appears so, when judged solely by immediate practical convenience.  However, if we also judge in terms of human rights, whether digital inclusion is good or bad depends on what kind of digital world we are to be included in.  If we wish to work towards digital inclusion as a goal, it behooves us to make sure it is the good kind.”

23th April 2012 18:00
Richard Stallman “For a Free Digital Society”
Museum of Contemporary Art
Av. Dubrovnik 17, 10000 Zagreb, Croatia

Addmission: Free – No registration required.

Event coordinator: Tomislav Medak,