How to increase swap space and install GeoNode in Ubuntu 14.04

The quick installation guide of GeoNode  not that smooth, you are going to experience some challenges on the PostgreSQL locales. This tutorial will guide you especially when installing GeoNode on a server with less than minimum requirements.

Installing GeoNode requires intensive resources on a local machine or even on the server. Mainly because of GeoServer which requires a minimum of 1GB RAM to operate. If your machine or server has less than 1GB RAM, one can increase swap space to accommodate the operating requirements for GeoServer and GeoNode modules.


#Check memory size
$ free -m

#Check harddisk space
$ df -h

#Create swapfile
$ sudo fallocate -l 9G /swapfile && chmod 600 /swapfile && sudo mkswap /swapfile && sudo swapon /swapfile && sudo swapon -s

#Check permission: 600
$ ls -lh /swapfile

#Check memory size
$ free -m

#Edit fstab file add swapfile
$ sudo nano /etc/fstab

#Copy and paste to fstab file
/swapfile none swap sw 0 0

#Make swappiness and cache pressure permanent
$ sudo sysctl vm.swappiness=10 && sudo sysctl vm.vfs_cache_pressure=50

#Quick Install GeoNode
$ sudo add-apt-repository ppa:geonode/stable

$ sudo apt-get update && sudo apt-get install geonode
#You will experience problems on geonode installation finnishing properly
#Due to postgresql database locales
#Carry on
$ sudo passwd -u postgres # change password expiry infromation

$ sudo passwd postgres # change unix password for postgres

#Run as root
sudo su root

#Reconfigure locales
sudo dpkg-reconfigure locales

#Create cluster and restart postgresql
sudo pg_createcluster 9.3 main --start && sudo /etc/init.d/postgresql start

#Incase you experience
#psql: could not connect to server: Connection refusedIs the server running locally and acceptingconnections on Unix domain #socket "/var/run/postgresql/.s.PGSQL.5432"?
export LC_ALL="en_US.UTF-8"

#and this. (9.3 is my current PostgreSQL version. Write your version!)
sudo pg_createcluster 9.3 main –start

#You can proceed
$ sudo geonode-updateip <domain/ip-address>

#Incase you experience any problem on database sync
$ su postgres

psql > CREATE USER geonode WITH PASSWORD 'OjKkbvsn'; #should be same as password in geonode/


psql > \password geonode #type password in geonode/

#Create geonode superuser: admin
$ geonode createsuperuser

#Take some tea!