This guide is written for Ubuntu 16.04.
Setting up NOCLook
NOCLook is the main GUI component, a django webapp that allows users to access the data stored in NI, it is also often what people refer to when they say NI.
Install NEO4J
The official neo4j installation guide for version 3.2 is the reference for this part.
Install Java8
$ sudo add-apt-repository ppa:webupd8team/java $ sudo apt-get update $ sudo apt-get install oracle-java8-installer $ java -version java version "1.8.x"
NEO4J
$ wget -O - https://debian.neo4j.org/neotechnology.gpg.key | sudo apt-key add - $ echo 'deb http://debian.neo4j.org/repo stable/' | sudo tee -a /etc/apt/sources.list.d/neo4j.list $ sudo apt-get update $ sudo apt-get install neo4j=3.2.2
Configuration
$ sudo vim /etc/neo4j/neo4j.conf Add the following: # Autoindexing # Enable auto-indexing for nodes, default is false node_auto_indexing=true # The node property keys to be auto-indexed, if enabled node_keys_indexable=name, description, ip_address, ip_addresses, as_number, hostname, hostnames, telenor_tn1_number, nordunet_id, version # Enable auto-indexing for relationships, default is false relationship_auto_indexing=true # The relationship property keys to be auto-indexed, if enabled relationship_keys_indexable=ip_address
$ sudo rm /var/lib/neo4j/data/dbms/auth # Note the extra space before the command to avoid saving password in bash history $ sudo -u neo4j neo4j-admin set-initial-password your_awesome_password $ sudo service neo4j restart
Install Postgres database
Set password for database user and create a new database
$ sudo apt-get install postgresql $ sudo -u postgres psql postgres template1=# CREATE USER ni with PASSWORD 'secret'; template1=# CREATE DATABASE norduni; template1=# GRANT ALL PRIVILEGES ON DATABASE norduni to ni; template1=# ALTER DATABASE norduni OWNER TO ni; # Allow user ni to drop and create for restoring template1=# ALTER USER ni CREATEDB; # and development purposes template1=# \q
Installing NOCLook
Before installing NOCLook you need to install the required system libraries
$ sudo apt-get install git python-pip libpq-dev $ sudo pip install -U pip $ sudo pip install virtualenv $ sudo adduser --disabled-password --home /var/opt/norduni ni
Now you are ready to install NOCLook, start by changing to the ni user.
$ sudo -u ni -i $ pwd /var/opt/norduni $ git clone git://git.nordu.net/norduni.git # Create virtual env $ virtualenv norduni_environment # Activate virtual env $ . norduni_environment/bin/activate # Install python dependencies $ pip install -r norduni/requirements/prod.txt
Configure NOCLook
$ cd norduni/src/niweb/ $ cp dotenv .env $ vi .env
You need to setup the following settings:
NEO4J_USERNAME=neo4j NEO4J_PASSWORD= REPORTS_TO= SECURITY_REPORTS_TO= DB_PASSWORD= ALLOWED_HOSTS=ni.yourdomain.tld localhost DEFAULT_FROM_EMAIL= EMAIL_HOST= SECRET_KEY=
The secret key should be at least 50 chars long consisting of the following characters: 'abcdefghijklmnopqrstuvwxyz0123456789!@#$%^&*(-_=+)'
You can use the following snippit to gennerate such a string locally:
# Missing ! since bash is sad when you use ! in anything, and pyton thinks \! is to be read as both \ and ! $ python -c "import random; print(''.join([random.SystemRandom().choice('abcdefghijklmnopqrstuvwxyz0123456789@#$%^&*(-_=+)') for i in range(50)]))"
Migrate databases and check config
# To make it easier for yourself set DJANGO_SETTINGS_MODULE=niweb.settings.prod in your bashprofile/bashrc $ cd norduni/src/niweb $ python manage.py migrate $ python manage.py collectstatic $ python manage.py runserver