How to install Geonode 2.8 on Debian 9 (Stretch)

Submitted by hvalentim on Thu, 04/05/2018 - 02:21

So, you wanted to install GeoNode on Debian 9 but found a somewhat obnoxious documentation which is taking you nowhere? Don't despair. Here's a dirty but functional and quick way to get it working in 7 steps and 10 minutes of copy&paste.

Tested on a fresh Debian 9.4 installation. All commands run by prior invocation of "su". For the sake of graphical clarity "$" denotes the start of a new line/command and is not meant to be typed/copied itself.

STEP 1 - Install the Dependencies
$ su
$ apt-get install python-virtualenv python-dev libxml2 libxml2-dev libxslt1-dev zlib1g-dev libjpeg-dev libpq-dev libgdal-dev git default-jdk build-essential openssh-server gettext nano vim unzip zip patch git-core postfix wget apache2 libapache2-mod-wsgi libgeos-dev libjpeg-dev libpng-dev libpq-dev libproj-dev libxml2-dev libxslt-dev python-gdal python-pycurl python-imaging python-pastescript python-psycopg2 python-urlgrabber python-pip gcc apache2 libapache2-mod-wsgi libgeos-dev libjpeg-dev libpng-dev libpq-dev libproj-dev libxml2-dev libxslt-dev gdal-bin libgdal20 libgdal-dev postgresql postgis postgresql-9.6-postgis-scripts postgresql-contrib software-properties-common dirmngr
STEP 2  - Install Oracle Java
$ sudo add-apt-repository "deb http://ppa.launchpad.net/webupd8team/java/ubuntu xenial main"
$ apt-key adv --keyserver keyserver.ubuntu.com --recv-keys EEA14886
$ sudo apt-get update
$ sudo apt-get install oracle-java8-installer
$ echo "JAVA_HOME=\"/usr/lib/jvm/java-8-oracle\""  >> /etc/environment
$ source /etc/environment
Step 3 - Install tomcat
$ sudo apt-get install tomcat8 tomcat8-admin
Step 4 - Make sure everything is updated and clean up
$ sudo apt-get update && sudo apt-get upgrade && sudo apt-get autoremove && sudo apt-get autoclean && sudo apt-get purge && sudo apt-get clean
Step 5 - Install Python Dependencies
$ pip install --upgrade pip
$ pip install --user virtualenv
$ pip install --user virtualenvwrapper
$ pip install Django==1.8.19
$ pip install celery==4.1.0
$ pip install pygdal==2.1.2.3
Step 6 - Install custom geoserver-geonode from ubuntu package
$ wget https://launchpad.net/~geonode/+archive/ubuntu/stable/+files/geoserver-geonode_2.12.2-4_all.deb
$ dpkg -i --ignore-depends=all geoserver-geonode_2.12.2-4_all.deb
$ rm geoserver-geonode_2.12.2-4_all.deb
Step 7 - Install Geonode 2.8.0
$ wget https://github.com/GeoNode/geonode/archive/2.8.0.zip
$ unzip 2.8.0.zip
$ rm 2.8.0.zip
$ cd geonode-2.8.0
$ pip install -r requirements.txt
$ pip install -e .
$ pip install geonode==2.8.0
$ cd package
$ mv install.sh install.sh.original
$ wget http://valentim.org/sites/default/files/2018-04/install.txt
$ mv install.txt install.sh
$ chmod +x install.sh
$ sudo ./install.sh support/config-ubuntu.sh
$ service apache2 stop
$ service tomcat8 stop
$ service apache2 start
$ service tomcat8 start

That's it. Your Geonode should now be available on http://localhost
You may login with user: admin & pswd: admin

In case you are running an exposed server, the following may be required (if you are running it on a local machine skip it):

$ geonode createsuperuser
$ geonode-updateip youraddress

Don't forget to change default pswds as well.