Install GeoNode on CentOS 7 (dev mode)

Preparation

Make sure all the needed libraries are installed

sudo yum -y update
sudo yum groupinstall 'Development Tools'
sudo yum install -y libxml2-devel libxslt-devel libjpeg-turbo-devel postgresql postgresql-server postgresql-contrib postgresql-libs postgresql-devel postgis geos-python python python-tools python-devel python-pillow python-lxml openssh-clients zip unzip wget git gdal python-virtualenv gdal-python geos python-pip python-imaging python-devel gcc-c++ python-psycopg2 libxml2 libxml2-devel libxml2-python libxslt libxslt-devel libxslt-python

Install pip

Installation of Python pip:

sudo rpm -iUvh http://dl.fedoraproject.org/pub/epel/7/x86_64/e/epel-release-7-9.noarch.rpm
sudo yum -y update
sudo yum -y install python-pip
sudo pip install --upgrade pip

Warning

Make sure to align the version of EPEL to the latest for your current CentOS version

Install Python Virtual Environment

sudo pip install virtualenvwrapper

Set up PostgreSQL

Enable the PostgreSQL service

systemctl enable postgresql

Change the Unix password for the postgres user

sudo passwd -u postgres -f
sudo passwd postgres

Initialize the PostgreSQL database with the default service name postgresql

sudo /usr/bin/postgresql-setup initdb

Start the PostgreSQL service

systemctl start postgresql.service

Create the database for GeoNode

su - postgres
pg_ctl status
pg_ctl start # if not running
createdb geonode

Create the needed role and privileges

psql
postgres=#
postgres=# \password postgres
postgres=# CREATE USER geonode WITH PASSWORD 'geonode';
postgres=# GRANT ALL PRIVILEGES ON DATABASE "geonode" to geonode;
postgres=# \q

Install Java

First come back to the normal user, then check if Java is already installed

java -version

In case, install Java

sudo yum install -y java-1.8.0-openjdk-devel

Setup a virtual environment

Assuming your username is geonode, you need to edit your .bashrc file

nano /home/geonode/.bashrc

Add the following lines (please replace geonode with your actual user name):

# virtualenvwrapper
export VIRTUALENVWRAPPER_PYTHON=/usr/bin/python
export WORKON_HOME=home/geonode/.venvs
source /usr/bin/virtualenvwrapper.sh
export PIP_DOWNLOAD_CACHE=$HOME/.pip-downloads

Save and exit. Then,

source /home/geonode/.bashrc

Install GeoNode

Setup a virtual environment for GeoNode and enter into it

mkvirtualenv geonode --system-site-packages
workon geonode

Make sure to have the most updated Python pip version

pip install --upgrade pip

Clone the current stable branch 2.6.x

git clone -b 2.6.x https://github.com/GeoNode/geonode

Install GeoNode and its dependencies

pip install -e geonode && pip install -r geonode/requirements.txt
pip Paver

Verify the installation

pip freeze | grep geonode

In case of successful installation, this should return several (50+) lines.

Install GeoServer

The installation of GeoServer in development mode can be started with this pavement command script

paver setup

This should return

GeoNode development environment successfully set up.If you have not set
up an administrative account, please do so now. Use "paver start" to start
up the server.

Run the Django server

Before starting the GeoNode server you have to complete the installation with several import pre-running steps. Let’s see them in their order.

Warning

Please note we have always to be in our virtual environment before running the following commands, while you don’t need the sudo privileges anymore!

Migrate the database

python manage.py migrate

Create an administrative account as know as superuser in Django. Please make sure you will create at least one superuser named admin which is required in development mode.

python manage.py createsuperuser

Create the required initial data and OAuth2 configurations

python manage.py loaddata geonode/base/fixtures/initial_data.json
python manage.py loaddata geonode/base/fixtures/default_oauth_apps.json

Finally we are able to start all the components

paver start_geoserver # start GeoServer
python manage.py runserver 0.0.0.0:8000 # start GeoNode

Warning

Note that the default IP address, 127.0.0.1, is not accessible from other machines on your network. In case you are using forwarded_port on a Vagrantfile please make sure to start runserver with the option :option:0.0.0.0:8000 which allows fundamentally to view your development server from other machines on the network, included your host machine in such a case. See more on Installing the Operating System.