Skip to content

Dependency Installation

joetm edited this page Nov 11, 2015 · 1 revision

This page describes how to install the dependencies of sameAs Lite. You should be familiar with sameAs Lite concepts. As the instructions are very detailed, experienced users may want to skip this part or skim through it.


Operating systems

The instructions have been written with reference to three 64-bit operating systems:

Other operating systems, or versions of these, may differ in how packages are installed, the versions of these packages available from package managers etc. Consult the relevant documentation for your operating system and the products concerned.


Install Apache 2

Apache 2 is a popular web server.

Note: These instructions assume the use of Apache 2.4 web server. Other versions of Apache 2, particularly Apache 2.2, differ in how they are installed, configured and managed. Consult the relevant documentation for your version of Apache 2.

Ubuntu 14.04

Install:

$ sudo apt-get install apache2
$ apache2 -v
Server version: Apache/2.4.7 (Ubuntu)
Server built:   Mar 10 2015 13:05:59

Visit http://127.0.0.1. You should see:

Apache2 Ubuntu Default Page 

Install apache-utils, for htpasswd and other tools:

$ sudo apt-get install apache2-utils

Scientific Linux 7

Apache is already provided:

$ /usr/sbin/httpd -v
Server version: Apache/2.4.6 (Scientific Linux)
Server built:   Jul 23 2014 05:03:32

Start Apache and configure it to start automatically when the system is rebooted:

$ sudo systemctl restart httpd.service
$ sudo systemctl status httpd.service
$ sudo systemctl enable httpd.service

Fedora 21

Apache is already provided:

$ /usr/sbin/httpd -v
Server version: Apache/2.4.10 (Fedora)
Server built:   Sep  3 2014 14:49:30

Start Apache and configure it to start automatically when the system is rebooted:

$ sudo systemctl restart httpd.service
$ sudo systemctl status httpd.service
$ sudo systemctl enable httpd.service

Install PHP

PHP Hypertext Preprocessor executes code on a web server which generates HTML which is then sent to the client. sameAs Lite is implemented in PHP.

Ubuntu 14.04

Install:

$ sudo apt-get install php5-common libapache2-mod-php5 php5-cli
$ php --version
PHP 5.5.9-1ubuntu4.7 (cli) (built: Mar 16 2015 20:47:39) 

Scientific Linux 7

PHP is already provided:

$ php --version
PHP 5.4.16 (cli) (built: Sep 30 2014 05:06:36) 

Fedora 21

Install:

$ sudo yum install php
$ php --version
PHP 5.6.7 (cli) (built: Mar 20 2015 06:12:07) 

Install PHP modules

Ubuntu 14.04

Install:

$ sudo apt-get install php5-xsl php5-curl

Scientific Linux 7 / Fedora 21

Install:

$ sudo yum install php-xml php-mbstring php-pdo

Restart Apache:

$ sudo systemctl restart httpd.service

Install PHP Composer

PHP Composer is a dependency manager for PHP. It is used to install and manage sameAs Lite PHP dependencies.

Install:

$ php -r "readfile('https://getcomposer.org/installer');" | php -- --install-dir=/usr/bin

The installation directory specified above is that assumed by sameAs Lite's Makefile:

  • If you wish to use a different directory then provide a different value to --install-dir.
  • If you wish to use the current directory then leave out -- --install-dir=/usr/bin entirely.

Check it has installed:

$ /usr/bin/composer.phar --version
Composer version 1.0-dev (829199c0530ea131262c804924f921447c71d4e8) 2015-03-16 13:11:02

Install curl

curl is a command line tool and library for interacting over HTTP(S). It is used for testing sameAs Lite deployments.

Ubuntu 14.04

Install:

$ sudo apt-get install curl
$ curl --version
curl 7.35.0 (x86_64-pc-linux-gnu) libcurl/7.35.0 OpenSSL/1.0.1f zlib/1.2.8 libidn/1.28 librtmp/2.3

Scientific Linux 7

curl is already provided:

$ curl --version
curl 7.29.0 (x86_64-redhat-linux-gnu) libcurl/7.29.0 NSS/3.15.4 zlib/1.2.7 libidn/1.28 libssh2/1.4.3

Fedora 21

curl is already provided:

$ curl --version
curl 7.37.0 (x86_64-redhat-linux-gnu) libcurl/7.37.0 NSS/3.17.2 Basic ECC zlib/1.2.8 libidn/1.28 libssh2/1.4.3

Install Git

Git is a popular distributed version control system. It is needed to get the sameAs Lite source code and is used by PHP Composer to access sameAs Lite's PHP dependencies.

Ubuntu 14.04

Install:

$ sudo apt-get install git
$ git --version
git version 1.9.1

Scientific Linux 7

Git is already provided:

$ git --version
git version 1.8.3.1

Fedora 21

Git is already provided:

$ git --version
git version 2.1.0

Install PHP runtime dependencies by running:

$ make install
# install libraries required to run
/usr/bin/composer.phar update --no-dev
Loading composer repositories with package information
Updating dependencies
  - Installing ptlis/conneg (v3.0.0)
  - Installing slim/slim (2.6.2)
  - Installing slim/views (0.1.3)
  - Installing twig/twig (v1.18.0)
Writing lock file
Generating autoload files

Install SQLite 3.8.2+

SQLite is a public domain, file-based relational database management system. It can be used to host linked data stores exposed by sameAs Lite.

Ubuntu 14.04

Install:

$ apt-get install sqlite3
$ sqlite3 --version
3.8.2 2013-12-06 14:53:30 27392118af4c38c5203a04b8013e1afdb1cebd0d

Install PHP SQLite module:

$ apt-get install php5-sqlite

Restart Apache:

$ service apache2 restart

Scientific Linux 7

Note: the default version of SQLite 3, 3.7.17, cannot be used with sameAs Lite. sameAs Lite uses a WITHOUT ROWID optimisation which is only available in SQLite 3.8.2 and beyond.

$ sqlite3 --version
3.7.17 2013-05-20 00:56:22 118a3b35693b134d56ebd780123b7fd6f1497668

However, if you wish to use an older version of SQLite 3, you can disable this optimisation:

  • Edit src/Store.php and look for the connect function:
/**
 * Establish connection to database, if not already made
 * @throws \Exception Exception is thrown if connection fails or table cannot be accessed/created.
 */
public function connect()
  • Within this function, look for the code that handles SQLite:
// try to create tables for this store, if they don't exist
if ($this->dbType == 'sqlite') {
    $sql = 'CREATE TABLE IF NOT EXISTS ' . $this->storeName .
        ' (canon TEXT, symbol TEXT PRIMARY KEY)' . 
        ' WITHOUT ROWID;' .
       ' CREATE INDEX IF NOT EXISTS ' . $this->storeName . '_idx' .
        ' ON ' . $this->storeName . ' (canon);';
  • Replace the line:
        ' WITHOUT ROWID;' .
  • with:
        ';' .

Fedora 21

SQLite 3.8.2 and its PHP module are already provided:

$ sqlite3 --version
3.8.7 2014-10-17 11:24:17 e4ab094f8afce0817f4074e823fabe59fc29ebb4

Install MySQL

MySQL is a popular open source relational database management system. MariaDB is an open source fork of MySQL. Either can be used to host linked data stores exposed by sameAs Lite.

Ubuntu 14.04

Install:

$ apt-get install mysql-server 

You will be prompted for a root password for the MySQL server.

$ mysql --version
mysql  Ver 14.14 Distrib 5.5.41, for debian-linux-gnu (x86_64) using readline 6.3

Complete installation:

 $ mysql_install_db
 $ /usr/bin/mysql_secure_installation

When prompted, provide the following responses:

 Enter current password for root (enter for none): PASSWORD
 Change the root password? [Y/n] n
 Remove anonymous users? [Y/n] y
 Disallow root login remotely? [Y/n] y
 Remove test database and access to it? [Y/n] y
 Reload privilege tables now? [Y/n] y

Check status:

$ service mysql status
mysql start/running, process 38506

Install PHP MySQL module:

$ apt-get install php5-mysql

Restart Apache:

$ service apache2 restart

Scientific Linux 7 / Fedora 21

Install:

$ yum install mariadb-server mariadb

You will be prompted for a root password for the MySQL server.

$ mysql --version
mysql  Ver 15.1 Distrib 5.5.41-MariaDB, for Linux (x86_64) using readline 5.1

Complete installation:

$ mysql_install_db
$ systemctl start mariadb
$ systemctl status mariadb
$ /usr/bin/mysql_secure_installation
$ /usr/bin/mysql_secure_installation

When prompted, provide the following responses:

 Enter current password for root (enter for none): PASSWORD
 Change the root password? [Y/n] n
 Remove anonymous users? [Y/n] y
 Disallow root login remotely? [Y/n] y
 Remove test database and access to it? [Y/n] y
 Reload privilege tables now? [Y/n] y

Check status:

$ systemctl status mariadb

Install PHP MySQL module:

$ yum install php-mysql

Restart Apache:

$ systemctl restart httpd.service

Allow Apache services to connect to the database management system:

$ setsebool -P httpd_can_network_connect_db=1
  1. SameAs-Lite
  2. Concepts
  3. Server Requirements
    1. Requirements
    2. Dependency Installation
  4. Installation & Configuration
    1. Environment Configuration
    2. SameAs Configuration
    3. Sample Data
  5. [Data Stores](Data Stores)
  6. Usage
    1. Web Usage
    2. API
    3. [API Examples](API Examples)
    4. Scripting
  7. Contributing to SameAs-Lite
    1. [Setting up a development environment](Setting up a development environment)
    2. [Coding Standards](Coding Standards)
    3. [Day-to-Day Development](Day-to-Day Development)
  8. [Open Source Governance](Open Source Governance)
  9. Support
  10. [Getting In Touch](Getting In Touch)
  11. [Legal Information](Legal Information)

Clone this wiki locally