Setting up geonode
>> return Cedeus IDE
Contents
Basic Install for GeoNode v. 2.0
This is the fast install from GeoNode.org Quickstart. Full install instructions, including installation of PostGIS, can be found in this Admin tutorial
- Install from PPA in Ubuntu 12.04 -> see http://docs.geonode.org/en/latest/intro/install.html
- if Tomcat7 is not installed, do:
sudo apt-get install tomcat7
(but see below in step 1.5) -
sudo add-apt-repository ppa:geonode/release
. Note, if add-apt does not work (command not found) then do firstsudo apt-get update && sudo apt-get install python-software-properties
-
sudo apt-get update
- check what geonode versions are available use:
apt-cache showpkg geonode
. When I looked there was only one version, i.e. 2.0.0+thefinal5 -
sudo apt-get install geonode
(before I could run this I had do to dosudo apt-get install libtomcat7-java
so that Tomcat6 will be removed and then I could install tomcat7 - which was needed to for GeoServer - used by GeoNode. Another time I installed with Ubuntu Server as default solo OpenSSH and LAMPS (no tomcat no psql), so I could just dosudo apt-get install tomcat7
) - Note that the packages are stored in /var/cache/apt/archives. So they can be copied from there to another machine.
- if Tomcat7 is not installed, do:
- Set the IP address and create a superuser (also described here: http://docs.geonode.org/en/latest/deploy/production.html)
-
sudo geonode-updateip 127.0.0.1
(=> Use the real IP if you have one, and for the VM I actually used the one given by ifconfig: 10.0.2.15) -
geonode createsuperuser
- set GeoServer ProxyURL as described in the geonode install instructions. Use user admin with geoserver.
- If starting up Apache results in the following message: "Could not reliably determine the server’s fully qualified domain name, using 127.0.1.1 for ServerName.", Then do this:
-
sudo vim /etc/apache2/httpd.conf
- add
ServerName localhost
to the blank file (the word ServerName needs to stay as such) -
sudo service apache2 restart
-
-
- When using a VM with -nat I got at this point "There was a problem loading this page - Please contact your GeoNode administrator (he may have received an email automatically if he configured it properly).". I checked what is going on with
tail -f /var/log/apache2/error.log
. The log showed me that I should add the bridged IP 146.155.17.113:14080 to allowed hosts in /etc/geonode/local_settings.py. Hence I did changed the corresponding line in local_settings.py toALLOWED_HOSTS=["*"]
- Import data
Read the admin docs and also OSGeo Live DVD Quickstart tutorial
Note, for assigning geoserver tomcat memory, do it for tomcat7 as described for tomcat6 (see OSGeo VM) using setenv.sh but in /usr/share/tomcat7/bin
Notes on installing PostGIS
install from source: see: http://trac.osgeo.org/postgis/wiki/UsersWikiPostGIS20Ubuntu1204src
- To check if postgres exists, use
which psql
which should return the path. Then with the path I did/usr/bin/psql --version
to retrieve the version installed.
- So, Postgres 9.1 was installed, but when I executed "psql" I got this:
psql: FATAL: role "ssteinig" does not exist
- Hence, I first had to creating my account as a user using
sudo -u postgres createuser -s $USER
(got this from here). - Now I could create a db using
createdb mygeodb
, and connect via commandline withpsql -d mygeodb
- Finally I spatially enabled the db with
CREATE EXTENSION postgis;
andCREATE EXTENSION postgis_topology;
- However, for
CREATE EXTENSION postgis;
I got the following error: "ERROR: could not open extension control file "/usr/share/postgresql/9.1/extension/postgis.control": No such file or directory". - This may be solved using the install instructions from here: http://wiki.postgresql.org/wiki/Apt
- However, I followed now what is written here: http://trac.osgeo.org/postgis/wiki/UsersWikiPostGIS21UbuntuPGSQL93Apt
- the stuff described below did not work either, I think:
- echo "deb http://apt.postgresql.org/pub/repos/apt/ precise-pgdg main" | sudo tee /etc/apt/sources.list.d/postgis.list
- sudo apt-get update
- sudo apt-get install postgresql-9.3 pgadmin3
- and then...., I got again an error: update-alternatives: error: alternative pg_basebackup.1.gz can't be slave of psql.1.gz: it is a slave of postmaster.1.gz, which send me to this page: http://www.postgresql.org/message-id/20130508192711.GA9243@msgid.df7cb.de
- However, for
- then add a Postgres/postgis port forwarding rule for port 5432
GeoNode with external PostgreSQL DB
- modify settings in "/etc/geonode/local_settings.py" (before first use of db)
- the changes may require to run
geonode syncdb --noinput --all
(and perhaps a tomcat7/apache2 restart?) to sync - if the db contains data/layers already (e.g. geonodegisb93 > schemata > public > tables), and those should be visible again from GeoNode, then
- each table/layer needs to be published (re-loaded) in GeoServer and
-
geonode updatelayers
command needs to be run.
Accessing GeoNode - PostgreSQL
- create user:
sudo su postgres
- and:
createuser -d -E -i -l -P -r -s sstein
or all in one:sudo -u postgres createuser -P ssteinig
- to access via terminal use
psql -U sstein -d geonode -h localhost
- to access via pgAdmin:
- edit the file /etc/postgresql/9.1/main/postgresql.conf and /etc/postgresql/9.1/main/pg_hba.conf , see http://www.glom.org/wiki/index.php?title=Initial_Postgres_Configuration
- restart postgres as follows:
sudo /etc/init.d/postgresql restart
Some PostgreSQL commands
- quit psql:
\q
- connecting: psql -U geonode93 -d geonodegisdb93 -h localhost -p 5432
- listing of dbs:
psql -l -p 5432<code> or <code>\l
(including spec of port, as the PostGIS VM has postgres 9.1 (:9434) and 9.3 (:9432) installed)- or alternatively:
SELECT datname FROM pg_database WHERE datistemplate = false;
- or alternatively:
- adding / removing users
createuser
anddropuser
e.g.:dropuser geonode -p 5434
but needs to be done as "sudo su - postgres" - creating /removing dbs
createdb
anddropdb
e.g.:createdb geonodegisdb93
- listing of tables:
\dt
: but this will only list the table from the database currently connected to- to see at least something (if nothing added yet) it can also be done using:
SELECT table_schema,table_name FROM information_schema.tables ORDER BY table_schema,table_name;
- to see at least something (if nothing added yet) it can also be done using:
Testing GeoExplorer with remote WMS clients
- a list of running GeoNode instances can be found in this email thread: http://groups.google.com/d/topic/geonode-users/icuYPeL3rIg/discussion
- a server to test is http://demo.geonode.org/geoserver/wms , or the server from the World Food Program: http://geonode.wfp.org/geoserver/wms (= http://74.3.255.211/geoserver/wms)
- if errors occur to check what is going on run:
tail -f /var/log/apache2/error.log
- if a 403 error occurs, then the list of allowed hosts needs to be modified in the /etc/geonode/local_settings.py file (perhaps a "sudo service apache2 restart" is needed)
- if a 500 error occurs, then it could be that the mapping domain => IP does not work and the DNS has to be added to the computer settings (i.e. adding the DNS to /etc/resolv.conf - but see ask-ubuntu : i edited now /etc/network/interface and ifdown/ifup eth0 => but this made me loosing the network connection !!! ...and I had to use VNC to connect to the VM again and do
sudo ifup eth0
in a terminal)
Changing the GeoNode logo (GeoNode 2.0)
The original documention on how to do this is here: http://docs.geonode.org/en/latest/deploy/customize.html. However, some things have changed for GeoNode v 2.0. So we have to do the following:
- The static web documents are in /var/www/geonode/static/geonode. And CSS and images are in the subfolders /css and /img.
- Create a new logo file. The original logo file is called logo.png and has a dimension of 127x29 px.
- Create a subfolder in /etc/geonode/media/ => so we have now the folder /etc/geonode/media/geonode/img/
- Make this img subfolder accessible for ftp (e.g. using chmod 777)
- copy the new logo into the etc/.../img subfolder
- run
sudo geonode collectstatic -v0
- this should copy the new logo image into /var/geonode/static/geonode/img/.
Changing the GeoNode Theme (GeoNode 2.0)
Change of GeoNode web page colors
See comments above... for simple change of the CSS. I actually took the bootstrap? created base.css (see also base.less) and changed the color/backgroundcolor for web page elements (see personal notes in my log-book).
Apart from that: Everything else is more complicated and requires lots of others software (bootstrap, etc):
- a theme is available here: http://github.com/ingenieroariel/geonode-project
- a recent Oct. 2013 email thread: http://groups.google.com/d/msg/geonode-users/pI3-7QiFzs0/3nrvyjAX2rYJ
- install geonode with apt-get
- install git-core and clone https://github.com/GeoNode/geonode-project.git
- Install your custom project in the virtualenv, you can do this via pip install -e . or python setup.py develop
- Modify geonode's /var/www/geonode/wsgi/geonode.wsgi to import yourproject.settings instead of geonode.settings.
- Add a symlink to /etc/geonode/local_settings.py next to yourproject.settings so it picks up all the information about database and template locations in production. (run geonode collectstatic)
- Restart apache.
Translation + Change of GeoNode Welcome text
GeoNode is a Django Project - well, according to Daniel they put it into package for distribution (see here). So for that reason the GeoNode Django "project" can be found under the following path /usr/local/lib/python2.7/dist-packages/geonode/locale
.
To edit the text of the GeoNode welcome page, one can edit the English, Spanish, etc, locales stored under /usr/local/lib/python2.7/dist-packages/geonode/locale. However, I need to check if they should get replaced when an upgrade is performed. The translation is in .po files. Information on how to compile these files can be found here: http://docs.djangoproject.com/en/1.6/topics/i18n/translation/#how-to-create-language-files
However, what did I do to change the german translation for the front page.
- copy (backup first) and open /locale/de/LC_MESSAGES/django.po
- check out in the file /templates/index.html what strings are used
- modify the text for the corresponding language keys in django.po
- save and cope the file to the server (ensure that you have a backup of the original!!! and use chmod to enable copying)
- compile the changed language file using:
django-admin.py compilemessages -l de
or:geonode compilemessages
- perhaps do a sudo service apache2 restart?
- now check if the german text changed.
Note, for a new language file, e.g. Chile Spanish one would create the template po files using: django-admin.py makemessages -l es_cl
or: sudo geonode makemessages -l es_cl
first. (I think so ;)
GeoNode Settings
ToDo: check for settings that still need to be adjusted for a running system:
see http://docs.geonode.org/en/latest/reference/developers/settings.html