Default server setup

Submitted by rnsrk on Thu, 08/19/2021 - 15:12

This Tutorial describes the configuration routine for an default server setup. You have the possibility to test WissKI in a virtual machine, install a development environment with XAMPP oder follow a dockerized installation.

Recommended Server Setup

Our recommended server setup consists of five parts:

  • Ubuntu 18.04 or higher Linux
  • PHP 7.4 or higher with extensions:
    • php-apcu, php-curl, php-gd, php-json, php-mbstring, php-mysqli, php-xml and php-zip
  • Apache 2.x or higher Web Server
  • MariaDB 10.6 or higher Database
  • GraphDBfree 9 or higher TripleStore

Set up your Server

If you are using a Ubuntu higher than18.04, we provide an installing script, which helps you to set up everything you need to get a Drupal site ready to install.

Since WissKI is a Drupal module, you need a running Drupal instance first. The installation of Drupal consists of some steps, which we describe in an Ubuntu 20.04 environment as an example. If you want to install Drupal in any other system please consider the install guide of Drupal.

Install software dependencies

Drupal is written in PHP, so make sure you have PHP 7.4 or higher with extensions php-apcu, php-curl, php-gd, php-json, php-mbstring and php-mysqli installed. Since Drupal is a web content management system, you need a webserver (Apache 2 is recommended) and a database to store your content and configs (here: MariaDB). In the further course of the installation we need some additional applications to install and orchestrate drupal modules (composer), get files from the web (wget) and unzip compressed files (unzip).

Apache

Install Apache2 server and dependencies by typing:

sudo apt install apache2 \
            libapache2-mod-php -y

Please be sure that no other webserver is using port 80 (like ngnix).

MySQL/ MariaDB Database

You need a MySQL Database Management System. If you have MySQL already installed, that's cool, if not, we recommend MariaDB install it with:

sudo apt install mariadb-server -y

Make your MariaDB secure

If you have a fresh installation, you might want to secure it. Run the mysql secure installation script and note your credentials. In most cases, you can just answer y[es] to all questions.

sudo mysql_secure_installation

Add group  ... is a fundamental structure element of the pathbuilder ... is the place where you define the WissKI structure, configure groups and fields and tell WissKI to which adapter it should send the queries. You can export/import your pathbuilder setup. The administrative name of a pathbuilder could something like Collection and Collection Items or Named Entities. and can be used as a disambiguation point. Enabled groups resulting in bundles, if you click Save and generate bundles and fields. Administrative names are i. e. Collection or Person and machine names should be start with "g_", like g_person. www-data to your user

You may want to alter files created by the Apache server. Join the www-data group  ... is a fundamental structure element of the pathbuilder ... is the place where you define the WissKI structure, configure groups and fields and tell WissKI to which adapter it should send the queries. You can export/import your pathbuilder setup. The administrative name of a pathbuilder could something like Collection and Collection Items or Named Entities. and can be used as a disambiguation point. Enabled groups resulting in bundles, if you click Save and generate bundles and fields. Administrative names are i. e. Collection or Person and machine names should be start with "g_", like g_person. , if you are not already a member.

usermod -aG www-data $USER
newgrp www-data

Install PHP

You need at least php7.4. We recommend using php8.0. You haven't already add the ppa by

sudo add-apt-repository ppa:ondrej/php

You can install php8.0 by typing:

sudo apt install php8.0 \
    php8.0-apcu \
    php8.0-curl \
    php8.0-gd \
    php8.0-mbstring \
    php8.0-mysql \
    php8.0-xml \
    php8.0-zip -y

Tweak your PHP

Give WissKI some ressources to increase the performance; add a file to /etc/php/ php-version ... is the PHP version you installed and use on you operating system, i. e. 8.0. /mods-available/wisski.ini with the content:

file_uploads = On
allow_url_fopen = On
memory_limit = 256M
upload_max_filesize = 20M
max_execution_time = 60
date.timezone = Europe/Berlin
max_input_nesting_level = 640

Enable the php-mod for your php-version ... is the PHP version you installed and use on you operating system, i. e. 8.0. , i. e.

phpenmod -v 8.0 wisski

Enable Apache rewrite module

To provide clean urls enable Apache rewrite module and restart Apache server.

sudo a2enmod rewrite && sudo systemctl restart apache2

Only if your working on a local host: redirect domain

Add your  website-name ... is your (future) registered second level domain without http://www. like wisski.com - even If you are working on a local machine and want to migrate to a server later. to /etc/hosts, i. e. with

127.0.0.1   wisski.com

Add virtual host to Apache sites

Add a file /etc/apache2/sites-available/ website-name ... is your (future) registered second level domain without http://www. like wisski.com - even If you are working on a local machine and want to migrate to a server later. .conf with the content

<VirtualHost *:80>
    ServerAdmin <server admin mail>
    DocumentRoot "/var/www/html/<website name>/web"
    ServerName www.<website name>
    ServerAlias <website name>
    ErrorLog "/var/log/apache2/drupal.local-error_log"
    CustomLog "/var/log/apache2/drupal.local-access_log" common
        <Directory /var/www/html/<website name>/web>
        Options FollowSymlinks
        AllowOverride All
        Require all granted
        RewriteEngine on
        RewriteBase /
        RewriteCond %{REQUEST_FILENAME} !-f
        RewriteCond %{REQUEST_FILENAME} !-d
        RewriteRule ^(.*)$ index.php?q=$1 [L,QSA]
    </Directory>
</VirtualHost>

Enable site

Enable your website-name ... is your (future) registered second level domain without http://www. like wisski.com - even If you are working on a local machine and want to migrate to a server later. and restart the Apache server by

sudo a2ensite wisski.com && sudo systemctl restart apache2

Create database and database user

Please be sure that your database-name ... is used for your MariaDB database, where Drupal store its information, i.e. wisski_db. and database-user ... is the user role to manage your wisski database and should be a simple name without symbols or special characters, like drupal or wisski. not already exists. Create your database with your database-name ... is used for your MariaDB database, where Drupal store its information, i.e. wisski_db. and/ or database-user ... is the user role to manage your wisski database and should be a simple name without symbols or special characters, like drupal or wisski. , i. e. with

sudo mysql -e "CREATE DATABASE wisski_db ;"
sudo mysql -e "CREATE USER 'wisski'@'localhost' IDENTIFIED BY 'djDfdn39dvAS3983ndfasD34';"
sudo mysql -e "GRANT ALL PRIVILEGES ON wisski_db.* TO 'wisski'@'localhost';"
sudo mysql -e "FLUSH PRIVILEGES;"

Adjust permissions of web directory

You need write permissions.

sudo chown -R www-data:www-data /var/www/html
sudo chown -R 775 /var/www/html

Install Drupal and all necessary modules and libraries

If you do not have composer, please visit getcomposer.org, download and install it. The Code below renames the bin to composer and save it to /usr/local/bin.

php -r "copy('https://getcomposer.org/installer', 'composer-setup.php');"
php -r "if (hash_file('sha384', 'composer-setup.php') === '756890a4488ce9024fc62c56153228907f1545c228516cbf63f885e036d37e9a59d27d63f46af1d4d07ee0f76181c7d3') { echo 'Installer verified'; } else { echo 'Installer corrupt'; unlink('composer-setup.php'); } echo PHP_EOL;"
php composer-setup.php --filename=composer --install-dir=/usr/local/bin
php -r "unlink('composer-setup.php');"

You may need unzip and wget packages as well:

sudo apt install wget unzip

Install Drupal site with composers recommend project option, this installs your site in website-name ... is your (future) registered second level domain without http://www. like wisski.com - even If you are working on a local machine and want to migrate to a server later. /web,

cd /var/www/html
composer create-project drupal/recommended-project wisski.com
cd wisski.com
composer require drupal/devel drush/drush drupal/inline_entity_form drupal/wisski:3.x-dev@dev
cd web/modules/contrib/wisski
composer update

Adjust permissions of web directory again, with

sudo chown -R www-data:www-data /var/www/html
sudo chown -R 775 /var/www/html

SSL certificates with certbot

This is only necessary if you are installing WissKI on remote production server and not on a local machine. You can get letsencrypt SSL certificats by installing and using certbot. Please be aware that the following lines replace apt installation with snap! Follow the instructions from certbot to reseive and install the certificates.

sudo apt remove certbot -y
sudo snap install core
sudo snap refresh core
sudo snap install --classic certbot
sudo ln -s /snap/bin/certbot /usr/bin/certbot
sudo certbot --apache

Run the Drupal installer

Open your webbrowser and run the Drupal installer at http:// website-name ... is your (future) registered second level domain without http://www. like wisski.com - even If you are working on a local machine and want to migrate to a server later. .

Most module and help pages related to Drupal are written in English, so it is convenient to leave the system language as default.

Select Standard as the installation profile.

Use your database-name ... is used for your MariaDB database, where Drupal store its information, i.e. wisski_db. ,  your database-user ... is the user role to manage your wisski database and should be a simple name without symbols or special characters, like drupal or wisski. and your database-password ... is the password for the non-root user, i. e. djDfdn39dvAS3983ndfasD34. at the Database configuration. If you performed a default server setup, the host will be localhost, if you are in a Docker environment it will be your mariadb-service-name ... is the name of your MariaDB service inside a docker-compose.yml, i. e. mariadb. At https://github.com/rnsrk/dockerWissKI/blob/main/docker-compose.yml, its on line 18. .

Wait until Drupal is installed.

On the site configuration form, enter your website-title, site-email-adress, website-user-name and website-user-password. Click Save and continue. Congratulations, you installed your Drupal site!

Example screencast

Activate WissKI modules

WissKI consists of several submodules, to be able to use the core functionalities, go to Manage Extend, check

  • WissKI Core
  • WissKI Pathbuilder
  • WissKI SPARQL1.1 Adapter with Pathbuilder
  • WissKI Store Abstraction Layer Zero

and click Install.

Example screencast

WissKI basis configuration

Navigate to Manage Configuration WissKI Configuration (WissKI section) and check Do you want to use only main bundles for display? and Do you want to use views for navigation? at the Miscellaneous settings and click Save.

Then, navigate to Manage Configuration Performance (Development section) and uncheck Aggregate JavaScript files.

Was this reply helpful?
0
0
No votes have been submitted yet.

Need help?