How to Install LimeSurvey CE on Ubuntu 18.04 LTS

Published on: Fri, Jul 27, 2018 at 11:01 am EST

LimeSurvey is an open source survey software written in PHP. LimeSurvey source code is hosted on GitHub. This guide will show you how to install LimeSurvey Community Edition (CE) on a fresh Ubuntu 18.04 LTS Vultr instance.

Requirements

  • Minimum 180 MB disk space
  • Nginx version 1.1 or greater
  • Minimum PHP version 5.5.9. PHP 7.0.0 or greater is recommended, with the following modules and libraries enabled:
    • MBstring, PDO database driver for MySQL or PostgreSQL, GD-Library, IMAP, LDAP, ZIP
  • MySQL version 5.5.3 or greater

Check the Ubuntu version.

lsb_release -ds
# Ubuntu 18.04 LTS

Create a new non-root user account with sudo access and switch to it.

adduser johndoe --gecos "John Doe"
usermod -aG sudo johndoe
su - johndoe

NOTE: Replace johndoe with your username.

Set up the timezone.

sudo dpkg-reconfigure tzdata

Ensure that your system is up to date.

sudo apt update && sudo apt upgrade -y

Install unzip.

sudo apt install -y unzip

Install PHP

Install PHP 7.2 and required PHP extensions.

sudo apt install -y php7.2 php7.2-cli php7.2-fpm php7.2-common php7.2-mbstring php7.2-xml php7.2-mysql php7.2-gd php7.2-zip php7.2-ldap php7.2-imap

Check the version.

php --version

# PHP 7.2.5-0ubuntu0.18.04.1 (cli) (built: May  9 2018 17:21:02) ( NTS )
# Copyright (c) 1997-2018 The PHP Group
# Zend Engine v3.2.0, Copyright (c) 1998-2018 Zend Technologies
#     with Zend OPcache v7.2.5-0ubuntu0.18.04.1, Copyright (c) 1999-2018, by Zend Technologies

Install MySQL and setup the database

Install MySQL.

sudo apt install -y mysql-server

Check the version.

mysql --version && sudo mysqld --version
# mysql  Ver 14.14 Distrib 5.7.22, for Linux (x86_64) using  EditLine wrapper
# mysqld  Ver 5.7.22-0ubuntu18.04.1 for Linux on x86_64 ((Ubuntu))

Run mysql_secure_installation to improve MySQL security and set the password for the MySQL root user.

sudo mysql_secure_installation

Connect to the MySQL shell as the root user.

sudo mysql -u root -p
# Enter password

Create an empty MySQL database and user for LimeSurvey, and remember the credentials.

CREATE DATABASE dbname;
GRANT ALL ON dbname.* TO 'username' IDENTIFIED BY 'password';
FLUSH PRIVILEGES;
EXIT;

Install and configure Nginx

Install Nginx.

sudo apt install -y nginx

Check the version.

sudo nginx -v
# nginx version: nginx/1.14.0 (Ubuntu)

Run sudo vim /etc/nginx/sites-available/limesurvey.conf and configure Nginx for LimeSurvey.

server {
    listen 80;
    listen [::]:80;

    server_name example.com;
    root /var/www/limesurvey;

    index index.php;

    location / {
        try_files $uri $uri/ /index.php?$args;
    }

    location ~ \.php$ {
        include snippets/fastcgi-php.conf;
        fastcgi_pass unix:/var/run/php/php7.2-fpm.sock;
    }
}

Save the file and exit.

Activate the new limesurvey.conf configuration by linking the file to the sites-enabled directory.

sudo ln -s /etc/nginx/sites-available/limesurvey.conf /etc/nginx/sites-enabled/

Test the configuration.

sudo nginx -t

Reload Nginx.

sudo systemctl reload nginx.service

Install LimeSurvey

Navigate to /var/www.

cd /var/www

Download the latest stable LimeSurvey CE ZIP package and unpack it.

sudo wget https://download.limesurvey.org/latest-stable-release/limesurvey3.11.0+180612.zip
sudo unzip limesurvey3.11.0+180612.zip
sudo rm limesurvey3.11.0+180612.zip

Navigate to the document root folder.

cd /var/www/limesurvey

Change ownership of /var/www/limesurvey folder to user www-data.

sudo chown -R www-data:www-data /var/www/limesurvey

Open your site in a web browser and follow the LimeSurvey web installer.