Installing Lime Survey on an Ubuntu 20.04 VPS

This tutorial mainly includes links to other good tutorials and takes you through the entire process from first accessing your virtual private server (VPS) with an Ubuntu 20.04 operating system to having a fully operational installation of Lime Survey. It should serve you well in any Ubuntu-situation and is based on the tutorials I used, plus some free additional tops and commentary. The whole process should take you about 2 hours, assuming you do it peacefully with a bit of multi-tasking. Step 3 takes by far the longest.

STEP 0: Access your server using an SSH connection. If you have a Windows operating system, download PuTTY. In Linux you can just type ssh [email protected].

STEP 1: Its good safety practice to not login to your VPS with root access but to instead create a sudo user. So do that first.

STEP 2: To install Lime Survey you need to install a so-called LAMP stack: Linux, Apache, MySQL and PHP, the basic code stock on which the Lime Survey installation sits. You can follow the following LAMP tutorial, however be sure to install a slightly different collection of PHP-scripts by running:

sudo apt install php php-cli php-common php-mbstring php-xml php-mysql php-gd php-zip php-ldap php-imap

STEP 3: You can download the latest community edition stable (LTS) version of Lime Survey from the official community website. I’ve found it simpler to just download to my PC, unzip everything and then upload via SFTP (with the same login credentials as you use for SSH to access the VPS). Only the uploading can take quite some time (around 1 hour in my experience, just let it do its thing). Place the Lime Survey files in the directory of the virtual host that you made in step 2 (e.g. /var/www/survey)

STEP 4: You need to take a few more steps before Lime Survey is ready to run. (As a reference, there is also an official installation manual) First of all certain folders need to be fully accessible to the Apache web server. You can do this with the following commands:

sudo chown -R www-data:www-data /var/www/survey/tmp
sudo chown -R www-data:www-data /var/www/survey/upload
sudo chown -R www-data:www-data /var/www/survey/application/config

Its also wise to create a MySQL user specifically for Lime Survey, e.g. limeuser. Note down the user name and password for use in step 6.

sudo mysql
CREATE USER 'limeuser'@'localhost' IDENTIFIED BY 'DIFFICULTPA$$WORD';
GRANT SELECT, CREATE, INSERT, UPDATE, DELETE, ALTER, DROP, INDEX ON lime. * TO 'limeuser'@'localhost';

STEP 5: Its important to have an SSL certificate for your domain so that the connection with the survey-taker and other users is encrypted. You can get it for free via Let’s Encrypt, a service of the non-profit Internet Security Research Group (ISRG). A tutorial is available. In case certbot package is not installed on the VPS, use this code to install it:

sudo apt install certbot python3-certbot-apache
sudo certbot --apache

STEP 6: OK, now it’s time for the real test. If you access your Lime Survey installation for the first time, it will self-check that everything is correctly configured. You will need to provide the MySQL user details (step 4) and the rest is pretty self-explanatory. Woohoo, well done! Ypu’ve installed your own Lime Survey server!

Lime Survey and R: limer

Lime Survey is (probably) the world’s most popular open source survey package and R is the world’s most popular open source statistical and data analysis software (probably). So it seems only natural that there should be a bridge between the two: where the limitations of Lime Survey begin, R can take over and vice-versa.

Thankfully the bridge has been laid by an R package called limer. limer uses the API functionality that is built into Lime Survey to make calls to a Lime Survey instance. The most useful of these is probably the ability to get survey responses. But there is a wealth of other options too, including copying and deleting surveys, getting survey statistics, etc.

The github page of limer provides instructions on how to install it and how to make some basic calls. You also need to enable the API in your Lime Survey installation, which you can do under Settings –> Global Settings –> Interfaces. Be sure to set it to “JSON-RPC” and you will also see the URL to access the API (see image below)

Details on the Lime Survey API are available, although admittedly the documentation is a bit thin.

Assuming you have configured your Lime Survey instance with an SSL certificate (giving the https:// URL), the connection between R and Lime Survey is also encrypted and therefore any personal or sensitive data being exchanged between Lime Survey and R, is secured.

limer coding examples are to follow in a later post.