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).
- As root, apply updates:
apt-get updateapt-get upgrade - Ensure DNS is in place, and hostname is set in /etc/hosts
- Create users, apply sudo privileges if required. A common user group is very helpful.
- 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.
sudo apt-get install apache2- 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/.
- You must add the directive AllowEncodedSlashes On to the main /etc/apache2/apache2.conf or within your vhost configuration.
- Ensure that AllowOverride is set to All so that .htaccess directives can be actioned.
- And finally, ensure that mod_rewrite is enabled
sudo a2enmod rewrite
sudo service apache2 restart
Install PHP
sudo apt-get install php5 php5-cli php5-json php5-curl php5-mcrypt php5-gd- 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
- Download the install.php script and place it in your web root.
- Ensure that the web root is owned by (or at least writable by) the web server.
- 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...
sudo apt-get install mysql-server mysql-client php5-mysql- Run the
mysql_secure_installationscript - 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'; - 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.
Install packages:sudo apt-get install postgresql-9.1 postgresql-9.1-postgis gdal-bin php5-pgsqlor alternatively use postgis-compile.sh to build from source.Note that you may need/want to change /etc/postgresql/pg_hba.conf so that md5 authentication is required. (see manual for more details).Then to create databases and tables required for the GeospatialRelationshipService, see postgis-create-database.sh.- NEW (2016) –
sudo apt-get install postgresql-9.4-postgis-2.1 php5-pgsql gdal-bin - Create a postgresql user “rdf”, specifying a password...
sudo -u postgres createuser rdf -P - Allow that user to create databases...
sudo su postgres -c 'psql postgres -c "ALTER USER rdf CREATEDB"' - 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'" - 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.
- 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.listsudo apt-get update - Install latest stable version of MongoDB
sudo apt-get install mongodb-org - Edit MongoDB config...
sudo vim /etc/mongodb.confand 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 - You can control mongod using
sudo service mongod {start|stop|restart|status} - 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.
sudo apt-get install beanstalkd- Edit /etc/default/beanstalkd to enable START=yes
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.
sudo add-apt-repository ppa:mapnik/boostwget -O - https://dl.hhvm.com/conf/hhvm.gpg.key | sudo apt-key add -echo deb https://dl.hhvm.com/ubuntu precise main | sudo tee /etc/apt/sources.list.d/hhvm.listsudo apt-get updatesudo 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.