• Get In Touch
October 24, 2016

How to Install LimeSurvey on Ubuntu-16.04

Want your very own server? Get our 1GB memory, Xeon V4, 25GB SSD VPS for £10.00 / month.
Get a Cloud Server

LimeSurvey also known as PHPSurveyor is an open source online survey application written in PHP. It is developed in PHP and uses MySQL, sqlite, and PostgreSQL on the backend for database related operations.

You can easily develop and publish online surveys create statistics, and export the data to other applications using web interface. It enables users to use rich text in questions and messages using a rich text editor and easily integrate images and videos into surveys. You can create unlimited number number of surveys using LimeSurvey.

Currently LimeSurvey provides following features:

  1. You can create unlimited number of surveys at the same time.
  2. Supports unlimited number of participants to a survey.
  3. Provides WYSIWYG HTML editor.
  4. Easily integrat pictures and movies into a survey.
  5. Easily re-use and edit answer sets.
  6. Easily create your own page layout using template editor.
  7. Easily import and export functions to CSV, PDF, SPSS, text, queXML and MS Excel format.
  8. Provide user friendly web interface.

In this tutorial, we will learn how to install LimeSurvey on Ubuntu-16.04.

Requirements

  • A server running Ubuntu-16.04.
  • A non-root user with sudo privileges setup on your server.

Installing LAMP Stack

LimeSurvey is developed in PHP and uses MySQL on the backend for database, so you will need to install Apache, MySQL and PHP as pre-requisites for this application.

To install all these components, you will need to install the lamp stack, because the lamp stack comes with all these components.

You can install it by running the following command:

sudo apt-get install lamp-server^

Output:

    Setting up libaio1:amd64 (0.3.109-4) ...
    Setting up libmysqlclient18:amd64 (5.5.52-0ubuntu0.16.04.1) ...
    Setting up libdbi-perl (1.630-1) ...
    Setting up libdbd-mysql-perl (4.025-1ubuntu0.1) ...
    Setting up libterm-readkey-perl (2.31-1) ...
    Setting up mysql-client-core-5.5 (5.5.52-0ubuntu0.16.04.1) ...
    Setting up mysql-client-5.5 (5.5.52-0ubuntu0.16.04.1) ...
    Setting up mysql-server-core-5.5 (5.5.52-0ubuntu0.16.04.1) ...
    Setting up mysql-server-5.5 (5.5.52-0ubuntu0.16.04.1) ...
    161022 22:30:28 [Warning] Using unique option prefix key_buffer instead of key_buffer_size is deprecated and will be removed in a future release. Please use the full name instead.
    161022 22:30:28 [Note] /usr/sbin/mysqld (mysqld 5.5.52-0ubuntu0.16.04.1) starting as process 9263 ...
    mysql start/running, process 9395
    Setting up apache2 (2.4.7-1ubuntu4.13) ...
    Enabling module mpm_event.
    Enabling module authz_core.
    Enabling module authz_host.
    Enabling module authn_core.
    Enabling module auth_basic.
    Enabling module access_compat.
    Enabling module authn_file.
    Enabling module authz_user.
    Enabling module alias.
    Enabling module dir.
    Enabling module autoindex.
    Enabling module env.
    Enabling module mime.
    Enabling module negotiation.
    Enabling module setenvif.
    Enabling module filter.
    Enabling module deflate.
    Enabling module status.
    Enabling conf charset.
    Enabling conf localized-error-pages.
    Enabling conf other-vhosts-access-log.
    Enabling conf security.
    Enabling conf serve-cgi-bin.
    Enabling site 000-default.
     * Starting web server apache2                                                  AH00558: apache2: Could not reliably determine the server's fully qualified domain name, using 127.0.1.1. Set the 'ServerName' directive globally to suppress this message
     * 
    Processing triggers for ureadahead (0.100.0-16) ...
    Setting up mysql-server (5.5.52-0ubuntu0.16.04.1) ...
    Processing triggers for ufw (0.34~rc-0ubuntu2) ...
    Setting up apache2-mpm-prefork (2.4.7-1ubuntu4.13) ...
    Setting up php5-common (5.5.9+dfsg-1ubuntu4.20) ...

    Creating config file /etc/php5/mods-available/pdo.ini with new version
    php5_invoke: Enable module pdo for cli SAPI
    php5_invoke: Enable module pdo for apache2 SAPI

    Creating config file /etc/php5/mods-available/opcache.ini with new version
    php5_invoke: Enable module opcache for cli SAPI
    php5_invoke: Enable module opcache for apache2 SAPI
    Setting up php5-mysql (5.5.9+dfsg-1ubuntu4.20) ...

    Creating config file /etc/php5/mods-available/mysql.ini with new version
    php5_invoke: Enable module mysql for cli SAPI
    php5_invoke: Enable module mysql for apache2 SAPI

    Creating config file /etc/php5/mods-available/mysqli.ini with new version
    php5_invoke: Enable module mysqli for cli SAPI
    php5_invoke: Enable module mysqli for apache2 SAPI

    Creating config file /etc/php5/mods-available/pdo_mysql.ini with new version
    php5_invoke: Enable module pdo_mysql for cli SAPI
    php5_invoke: Enable module pdo_mysql for apache2 SAPI
    Setting up php5-cli (5.5.9+dfsg-1ubuntu4.20) ...
    update-alternatives: using /usr/bin/php5 to provide /usr/bin/php (php) in auto mode

    Creating config file /etc/php5/cli/php.ini with new version
    php5_invoke pdo_mysql: already enabled for cli SAPI
    php5_invoke opcache: already enabled for cli SAPI
    php5_invoke mysqli: already enabled for cli SAPI
    php5_invoke pdo: already enabled for cli SAPI
    php5_invoke mysql: already enabled for cli SAPI
    Setting up php5-readline (5.5.9+dfsg-1ubuntu4.20) ...

    Creating config file /etc/php5/mods-available/readline.ini with new version
    php5_invoke: Enable module readline for cli SAPI
    php5_invoke: Enable module readline for apache2 SAPI
    Setting up libapache2-mod-php5 (5.5.9+dfsg-1ubuntu4.20) ...

    Creating config file /etc/php5/apache2/php.ini with new version
    php5_invoke pdo_mysql: already enabled for apache2 SAPI
    php5_invoke opcache: already enabled for apache2 SAPI
    php5_invoke readline: already enabled for apache2 SAPI
    php5_invoke mysqli: already enabled for apache2 SAPI
    php5_invoke pdo: already enabled for apache2 SAPI
    php5_invoke mysql: already enabled for apache2 SAPI
    Module mpm_event disabled.
    Enabling module mpm_prefork.
    apache2_switch_mpm Switch to prefork
     * Restarting web server apache2                                                AH00558: apache2: Could not reliably determine the server's fully qualified domain name, using 127.0.1.1. Set the 'ServerName' directive globally to suppress this message
                                                                             [ OK ]
    apache2_invoke: Enable module php5
     * Restarting web server apache2                                                AH00558: apache2: Could not reliably determine the server's fully qualified domain name, using 127.0.1.1. Set the 'ServerName' directive globally to suppress this message
                                                                             [ OK ]
    Setting up php5-json (1.3.2-2build1) ...
    php5_invoke: Enable module json for cli SAPI
    php5_invoke: Enable module json for apache2 SAPI
    Processing triggers for libc-bin (2.19-0ubuntu6.3) ...

Once the lamp-server is installed, start Apache service and enable it to start at boot:

sudo /etc/init.d/apache2 start
sudo update-rc.d apache2 defaults

Output:

     Adding system startup for /etc/init.d/apache2 ...
       /etc/rc0.d/K20apache2 -> ../init.d/apache2
       /etc/rc1.d/K20apache2 -> ../init.d/apache2
       /etc/rc6.d/K20apache2 -> ../init.d/apache2
       /etc/rc2.d/S20apache2 -> ../init.d/apache2
       /etc/rc3.d/S20apache2 -> ../init.d/apache2
       /etc/rc4.d/S20apache2 -> ../init.d/apache2
       /etc/rc5.d/S20apache2 -> ../init.d/apache2

Installing LimeSurvey

Now, download the latest stable version of LimeSurvey from https://www.limesurvey.org/en/downloads/category/25-latest-stable-release using the following command:

wget http://download.limesurvey.org/latest-stable-release/limesurvey2.55+161021.zip

Next, unzip the downloaded file with the following command:

unzip limesurvey2.55+161021.zip

Next, move the limesurvey directory to apache default document root directory:

sudo mv limesurvey/ /var/www/html/

Next, you will need to change the permission of limesurvey directory to www-data:

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

Configuring MySQL

By default MySQL is not secured, so you will need to secure it first. You can secure MySQL using the mysql_secure_installation script:

sudo mysql_secure_installation

Answer all the questions as shown below:

    NOTE: RUNNING ALL PARTS OF THIS SCRIPT IS RECOMMENDED FOR ALL MySQL
          SERVERS IN PRODUCTION USE!  PLEASE READ EACH STEP CAREFULLY!


    In order to log into MySQL to secure it, we'll need the current
    password for the root user.  If you've just installed MySQL, and
    you haven't set the root password yet, the password will be blank,
    so you should just press enter here.

    Enter current password for root (enter for none): 
    OK, successfully used password, moving on...

    Setting the root password ensures that nobody can log into the MySQL
    root user without the proper authorisation.

    You already have a root password set, so you can safely answer 'n'.

    Change the root password? [Y/n] n
     ... skipping.

    By default, a MySQL installation has an anonymous user, allowing anyone
    to log into MySQL without having to have a user account created for
    them.  This is intended only for testing, and to make the installation
    go a bit smoother.  You should remove them before moving into a
    production environment.

    Remove anonymous users? [Y/n] Y
     ... Success!

    Normally, root should only be allowed to connect from 'localhost'.  This
    ensures that someone cannot guess at the root password from the network.

    Disallow root login remotely? [Y/n] Y
     ... Success!

    By default, MySQL comes with a database named 'test' that anyone can
    access.  This is also intended only for testing, and should be removed
    before moving into a production environment.

    Remove test database and access to it? [Y/n] Y
     - Dropping test database...
    ERROR 1008 (HY000) at line 1: Can't drop database 'test'; database doesn't exist
     ... Failed!  Not critical, keep moving...
     - Removing privileges on test database...
     ... Success!

    Reloading the privilege tables will ensure that all changes made so far
    will take effect immediately.

    Reload privilege tables now? [Y/n] Y
     ... Success!

    Cleaning up...



    All done!  If you've completed all of the above steps, your MySQL
    installation should now be secure.

    Thanks for using MySQL!

Next, you will need to log in to the MySQL cell and create a database for the LimeSurvey.
To do this, run the following command:

sudo mysql -u root -p

After entering root password, you should see the following output:

    Enter password: 
    Welcome to the MySQL monitor.  Commands end with ; or g.
    Your MySQL connection id is 49
    Server version: 5.5.52-0ubuntu0.16.04.1 (Ubuntu)

    Copyright (c) 2000, 2016, Oracle and/or its affiliates. All rights reserved.

    Oracle is a registered trademark of Oracle Corporation and/or its
    affiliates. Other names may be trademarks of their respective
    owners.

    Type 'help;' or 'h' for help. Type 'c' to clear the current input statement.

    mysql> 

Next, create a database for LimeSurvey installation:

mysql> CREATE DATABASE limesurvey;

    Query OK, 1 row affected (0.00 sec)

mysql> GRANT ALL PRIVILEGES ON limesurvey.* TO 'limeuser'@'localhost' IDENTIFIED BY 'password';

    Query OK, 0 rows affected (0.00 sec)

mysql> FLUSH PRIVILEGES;

    Query OK, 0 rows affected (0.00 sec)

mysql> exit

Configuring Apache for LimeSurvey

Once everything is setup, it’s time to configure apache for LimeSurvey.
To do this, create a new virtual host configuration file named limesurvey.conf:

sudo nano /etc/apache2/sites-available/limesurvey.conf

Add the following lines:


ServerAdmin admin@yourdomain.com DocumentRoot /var/www/html/limesurvey/ ServerName 192.168.15.250 Options FollowSymLinks AllowOverride All ErrorLog /var/log/apache2/lime-error_log CustomLog /var/log/apache2/lime-access_log common

Save the file and restart Apache service.

sudo /etc/init.d/apache2 restart

Next, enable your site with the following command:

sudo a2ensite limesurvey.conf

or

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

Accessing the LimeSurvey Web Interface

Open your favorite web browser and type the URL http://your-server-ip/admin, it should display the installation page for limesurvey. Click on Start installation:

HP_NO_IMG/data/uploads/users/7ecb43a5-b365-4ebf-93d5-f3b632f29f33/899788195.png” alt=”” />

Next, accept License Agreement as shown below:

HP_NO_IMG/data/uploads/users/7ecb43a5-b365-4ebf-93d5-f3b632f29f33/1887165364.png” alt=”” />

Next, provide the mysql root credentials and specify a new database name for this new installation, then click on Next as shown below:

HP_NO_IMG/data/uploads/users/7ecb43a5-b365-4ebf-93d5-f3b632f29f33/947093329.png” alt=”” />

Next, you can change default username and password for admin user. You can also set your email account or survey site name from here too as shown below, then press Next:

HP_NO_IMG/data/uploads/users/7ecb43a5-b365-4ebf-93d5-f3b632f29f33/240827026.png” alt=”” />

Next, click the Administration option to login the admin panel for your survey application as shown below:

HP_NO_IMG/data/uploads/users/7ecb43a5-b365-4ebf-93d5-f3b632f29f33/702581480.png” alt=”” />

HP_NO_IMG/data/uploads/users/7ecb43a5-b365-4ebf-93d5-f3b632f29f33/381369393.png” alt=”” />

Conclusion

Finally, you have successfully installed LimeSurvey on your server. You can now easily create a new survey using LimeSurvey web interface.

You can also customise LimeSurvey as per your needs and use it in your production environment. Feel free to comments me if you have any questions.

Want your very own server? Get our 1GB memory, Xeon V4, 25GB SSD VPS for £10.00 / month.
Get a Cloud Server

Share this Article!

Related Posts

Node.js Authentication – A Complete Guide with Passport and JWT

Node.js Authentication – A Complete Guide with Passport and JWT

Truth be told, it’s difficult for a web application that doesn’t have some kind of identification, even if you don’t see it as a security measure in and of itself. The Internet is a kind of lawless land, and even on free services like Google’s, authentication ensures that abuses will be avoided or at least […]

Node.js and MongoDB: How to Connect MongoDB With Node

Node.js and MongoDB: How to Connect MongoDB With Node

MongoDB is a document-oriented NoSQL database, which was born in 2007 in California as a service to be used within a larger project, but which soon became an independent and open-source product. It stores documents in JSON, a format based on JavaScript and simpler than XML, but still with good expressiveness. It is the dominant […]

Using MySQL with Node.js: A Complete Tutorial

Using MySQL with Node.js: A Complete Tutorial

Although data persistence is almost always a fundamental element of applications, Node.js has no native integration with databases. Everything is delegated to third-party libraries to be included manually, in addition to the standard APIs. Although MongoDB and other non-relational databases are the most common choice with Node because if you need to scale an application, […]

Node.Js Vs Django: Which Is the Best for Your Project

Node.Js Vs Django: Which Is the Best for Your Project

Django and NodeJs are two powerful technologies for web development, both have great functionality, versatile applications, and a great user interface. Both are open source and can be used for free. But which one fits your project best? NodeJs is based on JavaScript, while Django is written in Python. These are two equally popular technologies […]

Nodejs Vs PHP:  Which Works Best?

Nodejs Vs PHP: Which Works Best?

Before getting into the “battle” between Node.js and PHP we need to understand why the issue is still ongoing. It all started with the increased demand for smartphone applications, their success forcing developers to adapt to new back-end technologies that could handle a multitude of simultaneous requests. JavaScript has always been identified as a client-side […]