NOTE: these instructions are now very old/out of date... YMMV!
Contact Ian if you need assistance :)

Basic server setup

The Seme4 Platform can be deployed to any Linux server. We tend to use Debian/Ubuntu flavours, rather than Redhat/Centos, however this is merely preference and you should be able to adapt these installation instructions for other distributions (though your package manager and package names may well be slightly different).

  1. As root, apply updates:
    apt-get update
    apt-get upgrade
  2. Ensure DNS is in place, and hostname is set in /etc/hosts
  3. Create users, apply sudo privileges if required. A common user group is very helpful.
  4. Make sure that standard development tools are installed: sudo apt-get install build-essential ssl-cert curl zip unzip subversion

Install web server

We have used the nginx web server with good success, however Apache is more commonly understood and in some ways easier to configure.

  1. sudo apt-get install apache2
  2. Either use the default root in /var/www/html/, or create a vhosts structure such as /var/www/vhosts/mydomain.com/ with appropriate configurations in /etc/apache2/sites-available/ and /etc/apache2/sites-enabled/.
  3. You must add the directive AllowEncodedSlashes On to the main /etc/apache2/apache2.conf or within your vhost configuration.
  4. Ensure that AllowOverride is set to All so that .htaccess directives can be actioned.
  5. And finally, ensure that mod_rewrite is enabled
    sudo a2enmod rewrite
    sudo service apache2 restart

Install PHP

  1. sudo apt-get install php5 php5-cli php5-json php5-curl php5-mcrypt php5-gd
  2. In /etc/php5/apache2/php.ini set the timezone as appropriate: date.timezone = Europe/London
    raise the upload limits: upload_max_filesize = 128M
    and post_max_size = 130M (note: post should be larger than upload)

Note if you are migrating an existing Seme4 Platform installation to use PHP version 8.0 or above, download and run php8-fixes.php

Install Seme4 Platform

  1. Download the install.php script and place it in your web root.
  2. Ensure that the web root is owned by (or at least writable by) the web server.
  3. Access https://mydomain.com/install.php and the platform (and dependencies) should be installed for you.

This concludes the basic Platform install. You may however wish to connect to various backend data storage technologies, as described in the optional components below.

MySQL (optional)

A couple of services require MySQL...

  1. sudo apt-get install mysql-server mysql-client php5-mysql
  2. Run the mysql_secure_installation script
  3. Log in to MySQL and create database(s) and user for the platform to use:
    mysql -uroot -p
    then run the following SQL commands:
    CREATE DATABASE db1;
    CREATE USER 'username'@'localhost' IDENTIFIED BY 'mypass';
    GRANT ALL ON db1.* TO 'username'@'localhost';
  4. Restart web server: sudo service apache2 restart

4store (optional)

If you want to store RDF data, 4store is our usual reccomendation.

Use the script available at ianmillard.com/4store/ to download/compile 4store, and there are also some other helper scripts there too.

PostGIS (optional)

For geospatial capabilities we required PostGIS, which is a set of extensions built on top of the Postgres database. Hopefully you can use latest packages, however for some legacy applications you may need a specific version of Postgres and/or PostGIS in which case it is best to build from source.

  1. Install packages: sudo apt-get install postgresql-9.1 postgresql-9.1-postgis gdal-bin php5-pgsql or alternatively use postgis-compile.sh to build from source.
  2. Note that you may need/want to change /etc/postgresql/pg_hba.conf so that md5 authentication is required. (see manual for more details).

  3. To set up postgis, see the the following script: postgis-setup.sh. (note that paths may well have changed).
  4. Then to create databases and tables required for the GeospatialRelationshipService, see postgis-create-database.sh.
  5. NEW (2016) – sudo apt-get install postgresql-9.4-postgis-2.1 php5-pgsql gdal-bin
  6. Create a postgresql user “rdf”, specifying a password... sudo -u postgres createuser rdf -P
  7. Allow that user to create databases... sudo su postgres -c 'psql postgres -c "ALTER USER rdf CREATEDB"'
  8. To create new datatabases, execute
    sudo su postgres -c "createdb --user rdf --host localhost --password --owner rdf DBASE_NAME" sudo su postgres -c "psql DBASE_NAME -c 'create extension postgis'"
  9. Once you have the database, create entry in config.ttl then use admin functions of the GeospatialRelationshipService to create tables when prompted.
    []
      a srv:Service , srv:GeospatialRelationshipService ;
      srv:name "Geo-index of Countries" ;
      srv:endpoint "services/geo/countries/" ;
      srv:description "Geospatial service storing country boundaries" ;
      srv:data_store [
        a srv:RelationshipStore ;
        srv:id "TABLE_PREFIX" ;
        srv:db_type "pgsql" ;
        srv:db_host "localhost" ;
        srv:db_name "DBASE_NAME" ;
        srv:db_user "rdf" ;
        srv:db_pass "PASSWORD" ;
      ] .
    

ElasticSearch (optional)

If you want to do efficient text search over indexed RDF documents, we use ElasticSearch (based on Lucene).

Installing should be as easy as sudo apt-get install elasticsearch, or else see elasticsearch.org.

MongoDB (optional)

Within the Platform “canned query” allow you to easily expose pre-canned queries over datasests via RESTful API style URIs (with variable subsitutions).

There is an adapter which allows you to connect to and query MongoDB stores in this fashion.

  1. Import key and update package manager
    sudo apt-key adv --keyserver hkp://keyserver.ubuntu.com:80 --recv 7F0CEB10
    echo 'deb https://downloads-distro.mongodb.org/repo/ubuntu-upstart dist 10gen' | sudo tee /etc/apt/sources.list.d/mongodb.list sudo apt-get update
  2. Install latest stable version of MongoDB
    sudo apt-get install mongodb-org
  3. Edit MongoDB config... sudo vim /etc/mongodb.conf and set
    location of data: dbpath=/mnt/diskc/mongodb/db
    location of logs: logpath=/mnt/diskc/mongodb/log/mongod.log
    set logs to append: logappend=true
    ensure listening on localhost only: bind_ip = 127.0.0.1
    turn off HTTP (admin) interface: nohttpinterface = true
    turn off table scans: notablescan = true
  4. You can control mongod using sudo service mongod {start|stop|restart|status}
  5. As table scans are turned off, ensure there are indexes created over all keys you wish to query. Using the command line client mongo issue queries such as db.poi.ensureIndex({"postcode": 1 }); to add an index on the “postcode” key within the “POI” database.

Beanstalkd (optional)

The task queue and workflow services utilise a queue daemon called beanstalkd.

  1. sudo apt-get install beanstalkd
  2. Edit /etc/default/beanstalkd to enable START=yes
  3. sudo service beanstalkd start

HHVM (optional)

The HHVM is a virtual machine designed for executing programs written PHP, using a just-in-time (JIT) compilation approach to achieve superior performance.

Note that it does not currently have support for Postgres.

We use it mainly for speeding up command line data-processing scripts (makeRDF etc), and do not currently use it with web server.

  1. sudo add-apt-repository ppa:mapnik/boost
  2. wget -O - https://dl.hhvm.com/conf/hhvm.gpg.key | sudo apt-key add -
  3. echo deb https://dl.hhvm.com/ubuntu precise main | sudo tee /etc/apt/sources.list.d/hhvm.list
  4. sudo apt-get update
  5. sudo apt-get install hhvm

WordPress (optional)

It is possible to install the Seme4 Platform alongside WordPress, though this requires a little more fiddling – contact us for more info. You may find the flat theme and plugin useful.

 

For further information, please drop us a line.