Complete Installation Guide

The manual installation is intended for those who are comfortable with Linux system administration.

Note

Here is the link to our Quick Installation Guide .

Step 1 Installing Dependencies

Some external software must be installed before you can install GeoNode. The GeoNode package contains both the Java and Django web application code for GeoNode, but requires some external software installed to complete the GeoNode platform.

This includes:

  • A Python interpreter
  • A Java Runtime Environment (JRE)
  • Apache Tomcat servlet container
  • Python development libraries
  • PostgresQL database
  • The GDAL, GEOS, and OGR geospatial software libraries

For convenience, appropriate commands to retrieve these dependencies on Ubuntu 12.04 LTS are listed below:

$ sudo apt-get install python python-support python-dev python-virtualenv openjdk-6-jre tomcat7 postgresql-9.1 postgresql-contrib-9.1 gcc patch zip python-imaging gdal-bin libgeos-dev python-urlgrabber python-pastescript gettext postgresql-contrib postgresql-9.1-postgis libpq-dev unzip libjpeg-dev libpng-dev python-gdal libproj-dev python-psycopg2 apache2 libapache2-mod-wsgi git-core gettext libxml2-dev libxslt-dev

Beware that in case of use of postgres 9.2 as described in Installation of Postgresql-9.2 on Ubuntu 12.04 and PostGIS 2.0.3 Installation on Ubuntu 12.04 all the postgres and postgis references must be removed from the above command!

Note

Before you copy the command into the terminal and run it, check the versions, you might have to adjust them!

Note

Be sure that you’ve installed all the required dependencies before you go further with the installation of GeoNode.

Step 2 Download Code

Download the code using git.

$ git clone https://github.com/GeoNode/geonode.git          # download code from github
$ cd geonode                                                # change into the folder called geonde
$ sudo pip install -e .                                     # this installs django etc.
$ sudo paver setup                                          # this downloads geoserver.war

Now if you like to see if all is working so far type:

$ sudo paver start                                          # starts everything with default configs! NOT for production!
$ sudo paver stop                                           # stops all and you can continue with complete install

This will start GeoNode at http://localhost:8000/. But until now, GeoNode is running with the default configurations, e.g it uses Jetty as servlet container and sqlite3 as database. Also GeoNode won’t start without using the command above. Changing this, the following configurations on the used components have to be done.

Step 3 Configure

Final steps to configure Geonode include the stack:

  • Servlet Container: Apache Tomcat for Geoserver
  • Static File Server: Apache httpd
  • Python/WSGI Container: mod_wsgi
  • Django Database: PostgresQL

Please choose between one of the two methods to finish the installation-configuration of GeoNode:

  1. Configure using the ubuntu config file, this is the recommended way using the provided .sh scripts
  2. Configure manually, doing each step by hand as opposed to using the .sh scripts

In the end you will have the same running instance of Geonode.

  1. Configure using the ubuntu config file

    This is a semi-automatic configuration script involving two .sh scripts.

    • Installer configuration file (located in package/support/config-ubuntu.sh) First thing to edit
    • The installer script (located in package/ install.sh) Second thing to edit
    1. First open the package/support/config-ubuntu.sh installer configuration file. Now provide the details of your installation, such as where your webserver looks for documents.
    2. Second open the install.sh and configure to your needs.

    Note

    you might have to change the postgresql and postgis version in this file, according to the versions you use!

    Once edited (if necessary) run the ./install.sh file with the following commands:

    $ cd package                                                                   # change into the folder called "package"
    $ sudo ./install.sh support/config-ubuntu.sh                                   # run the install.sh with the ubuntu config.sh
    $ sudo cp downloaded/geoserver.war /var/lib/tomcat7/webapps                    # copy geoserver.war into tomcat webapps directory
    $ sudo geonode-updateip youraddress                                            # create the IP address to your address
    $ geonode createsuperuser                                                      # call geonode binary django-admin.py create django super user
    

    GeoNode can now be accessed at http://localhost

  2. Configure Manually

    Note

    If the server has a fresh Ubuntu installation it’s strongly suggested instead to adjust the package/support/config-ubuntu.sh script to match the desired installation paths.

    1. Configure Postgresql and Postgis

      Until now GeoNode uses sqlite3 as the default db. The following steps will show you how to make geonode to use postgresql and postgis.

      Create geonode user and database

      First of all a user called geonode (with password geonode), as well as a database called geonode has to be created.

      To create the user:

      $ sudo -u postgres createuser -P geonode
      

      Now you will be asked to enter a password. This must be geonode (you can change it if you want to, but be aware that you have to edit the local_settings.py if you do so!)

      To create the databases (the geonode one and the spatial for shapefile imports):

      $ sudo -u postgres createdb -O geonode geonode
      $ sudo -u postgres createdb -O geonode geonode-imports
      $ sudo su postgres
      $ psql -f /usr/share/postgresql/9.1/contrib/postgis-1.5/postgis.sql geonode-imports
      $ psql -f /usr/share/postgresql/9.1/contrib/postgis-1.5/spatial_ref_sys.sql geonode-imports
      $ psql -d geonode-imports -c 'GRANT ALL ON geometry_columns TO PUBLIC;'
      $ psql -d geonode-imports -c 'GRANT ALL ON spatial_ref_sys TO PUBLIC;'
      $ exit
      

      This creates a db called geonode and geonode-imports (which automatically has the postgis extension as well!) with owner geonode.

      Change authentication method

      In the postgres config path, /etc/postgresql/9.2/main, you should find the file pg_hba.conf. This file has to be edited in order to allow the geonode user to have access to the database. Therfore change the directory to this file and open it

      $ cd /etc/postgresql/9.1/main
      $ sudo vi pg_hba.conf
      

      The file should contain the following default settings until now:

      ../../../_images/pg_hba_detail.png

      and then set the authentication method of the following entry from peer to trust:

      #TYPE        DATABASE    USER    METHOD
      local   all      all     md5
      

      After changing this file, the postgres service has to be restarted. This is essential, because otherwise the changed configurations won’t be considered!

      To restart the postgresql server type

      $ sudo service postgresql restart
      

      Note

      service could be also called postgresql-9.1 or postgresql-9.2 depending on your installation

      Additional entry:

      #Type   DATABASE    USER    ADDRESS     METHOD
      host    geonode     geonode 127.0.0.1/32    md5
      

      Setup local settings

      The next step is to set the local settings.

      In the directory ../geonode/geonode a file called local_settings.py.sample exists. It includes all the settings to change the default db from sqlite3 to postgresql. Rename the file to local_settings.py.

      $ sudo mv geonode/local_settings.py.sample geonode/local_settings.py
      

      Uncomment the line 10 and modify the line 12 as follows:

      'ENGINE': 'django.contrib.gis.db.backends.postgis',
      'NAME': 'geonode-imports',
      
      .. note:: If you do not use *geonode* as password for your database, then you have to edit the local_settings.py and change                      your password in this part of the file
      

      Add the following as a directive:

      ALLOWED_HOST = ['domain or IP']
      

      Synchronise db

      To synchronise the database call the django command syncdb

      $ python manage.py syncdb --noinput --all
      
    2. Django configurations

      The Django frontend can be served in various ways, one of the most performant is Apache httpd with mod_wsgi installed.

      You will also need a web server capable of simply serving static files; if you are using Apache httpd it can serve this purpose as well.

      Note

      The Django project has further documentation on how to serve Django applications at https://docs.djangoproject.com/en/1.5/howto/deployment/ .

      Before the webserver will be configured, some other steps are needed to execute.

      Create new superuser

      A new django superuser has to be created

      $ python manage.py createsuperuser
      

      You will be asked to enter a username, an email adress and a password.

      Create local static files

      The collectstatic command will create a new folder static_root.

      $ python manage.py collectstatic
      

      Enable geonode upload function

      An empty folder called uploaded must be created

      $ sudo mkdir -p /home/user/geonode/geonode/uploaded
      

      When using apache webserver change owner to www-data

      $ sudo chown www-data -R /home/user/geonode/geonode/uploaded
      
    3. Webserver configurations (Apache and mod_wsgi)

      Make apache to load the mod_wsgi module

      If you’ve done the installation from above, you should already have a httpd.conf file that includes one line

             LoadModule wsgi_module /path/to/modules/mod_wsgi.so
      
      .. note:: If you do not already have this, then please add this line to *httpd.conf* now!
      

      Beside this module you also have to enable the proxy module. This can be done very easily using

      $ sudo a2enmod proxy_http
      

      We have to create one more configuration file for geonode. Go to the folder sites-available and create a file called geonode

      $ cd /etc/apache2/sites-available
      $ sudo gedit geonode
      

      This file should inlcude the following, but don´t forget to adjust the paths!

      WSGIDaemonProcess geonode python-path=/home/user/geonode:/home/user/.venvs/geonode/lib/python2.7/site-packages user=www-data threads=15 processes=2
      
      <VirtualHost *:80>
          ServerName http://localhost
          ServerAdmin webmaster@localhost
          DocumentRoot /home/user/geonode/geonode
      
          ErrorLog /var/log/apache2/error.log
          LogLevel warn
          CustomLog /var/log/apache2/access.log combined
      
          WSGIProcessGroup geonode
          WSGIPassAuthorization On
          WSGIScriptAlias / /home/user/geonode/geonode/wsgi.py
      
          <Directory "/home/user/geonode/geonode/">
          Order allow,deny
              Options Indexes FollowSymLinks
              Allow from all
              IndexOptions FancyIndexing
          </Directory>
      
          Alias /static/ /home/user/geonode/geonode/static/
          Alias /uploaded/ /home/user/geonode/geonode/uploaded/
      
          <Proxy *>
              Order allow,deny
              Allow from all
          </Proxy>
      
          ProxyPreserveHost On
          ProxyPass /geoserver http://localhost:8080/geoserver
          ProxyPassReverse /geoserver http://localhost:8080/geoserver
      
      </VirtualHost>
      

      Enable the new site

      $ sudo a2ensite geonode
      

      This command will create a file geonode in the folder sites-enabled.

      Now reload apache

      $ sudo service apache2 reload
      

      If you now type localhost into your webbrowser, the geonode webpage will appear. You can now login with your newly created superuser account. But if you try to attend the django admin interface, you will only see the content of this webpage but without any design. To change this, you have to change the following entry in our geonode configuration file

      $ sudo gedit /etc/apache2/sites-available/geonode
      

      Change this entry:

      Alias /static/ /home/user/geonode/geonode/static/
      

      to:

      Alias /static/ /home/user/geonode/geonode/static_root/
      

      Now reload apache2

      again using sudo service apache2 reload and visit localhost/admin. Now you should be able to see this

      ../../../_images/admin_interface.PNG
    4. Change permissions of folders

      $ sudo chown www-data:www-data /home/user/geonode/geonode/static/
      $ sudo chown www-data:www-data /home/user/geonode/geonode/uploaded/
      $ sudo chown www-data:www-data /home/user/geonode/geonode/static_root/
      
      $ sudo service apache2 reload
      
    5. Configure application server

      The GeoServer web application must be served using a Java Servlet container; two popular and free containers are Jetty and Tomcat. Jetty is used as default in your GeoNode installation. Typically a Java web application (WARs) can be deployed by simply copying the .war file into the appropriate place. So if you are going to use Tomcat instead, then copy the geoserver.war file into Tomcats webapps directory, as shown in the steps below.

      Deploy your geoserver with Tomcat

      To do so we need Tomcat installed and not running. So if you’ve got Tomcat running at the moment, stop it

      $ sudo /etc/init.d/tomcat7 stop
      

      You can find the geoserver.war in the folder downloaded in your geonode directory:

      geonode/downloaded/geoserver.war
      

      Now copy this file into the webapps folder of tomcat

      $ sudo mv geonode/downloaded/geoserver.war /var/lib/tomcat7/webapps/
      

      By starting tomcat it will unpack the geoserver.war and create a new directory tomcat/webapps/geoserver.

      $ sudo /etc/init.d/tomcat7 start
      

      Let´s try to attend http://localhost:8080/geoserver or localhost/geoserver. You will now see the geoserver homepage.

      ../../../_images/geoserver_webpage.PNG

      Warning

      Geoserver is not a Vanilla Geoserver install, please use the geoserver.war that comes with geonode. In the future we might use a Vanilla Geoserver, it is in discussion

    GeoNode’s GeoServer integration requires some specific extensions to help GeoNode in managing GeoServer layers. GeoNode releases include a GeoServer WAR archive with these extensions pre-installed. However, some manual configuration may still be needed in case of not standard installation.

    1. Configure GeoServer with the location of the GeoNode site, used for authentication (so that GeoServer can recognize logins from the main site). This setting defaults to http://localhost:8000/, so if you are running the GeoNode Django application on a different port, or on a different server from the one running GeoServer, then you will need to change this by adding a block of XML to WEB-INF/web.xml within the unpacked application directory, like so:

      <context-param>
          <param-name>GEONODE_BASE_URL</param-name>
          <param-value>http://localhost/</param-value>
      </context-param>
      

    The <param-value> tag should enclose the URL to the Django application homepage.

    Note

    While we intend to provide a detailed, accurate explanation of the installation process, if you run into problems with the process described in this document, please don’t hesitate to let the GeoNode team know so we can keep it up to date.