How to install LimeSurvey in Ubuntu

To install LimeSurvey in Ubuntu

LimeSurvey is a free survey application that was programmed in php to create surveys. It permits the end user to access the web interface to develop and publish online surveys. Installation of Lime survey is explained in this article.


To install LimeSurvey

Before setting up LAMP, update your repositories by using the following command.

root@linuxhelp:~# apt-get update
Hit http://in.archive.ubuntu.com wily InRelease
Hit http://in.archive.ubuntu.com wily-updates InRelease               
Hit http://security.ubuntu.com wily-security InRelease                 
Hit http://in.archive.ubuntu.com wily-backports InRelease              
Hit http://security.ubuntu.com wily-security/main Sources              
Hit http://in.archive.ubuntu.com wily/main Sources
Hit http://in.archive.ubuntu.com wily/restricted Sources    
Hit http://in.archive.ubuntu.com wily/universe Sources
.
.
.
Hit http://in.archive.ubuntu.com wily-backports/universe i386 Packages                                                                                                     
Hit http://in.archive.ubuntu.com wily-backports/multiverse i386 Packages                                                                                                   
Hit http://in.archive.ubuntu.com wily-backports/main Translation-en                                                                                                        
Hit http://in.archive.ubuntu.com wily-backports/multiverse Translation-en                                                                                                  
Hit http://in.archive.ubuntu.com wily-backports/restricted Translation-en                                                                                                  
Hit http://in.archive.ubuntu.com wily-backports/universe Translation-en

Run the following command to install Mariadb Server.

root@linuxhelp:~# apt-get install mariadb-server -y
Reading package lists... Done
Building dependency tree       
Reading state information... Done
The following extra packages will be installed:
  libaio1 libdbd-mysql-perl libdbi-perl libhtml-template-perl libmysqlclient18 libreadline5 libterm-readkey-perl mariadb-client-10.0 mariadb-client-core-10.0
  mariadb-common mariadb-server-10.0 mariadb-server-core-10.0 mysql-common
.
.
.
Setting up libdbd-mysql-perl (4.028-2) ...
Setting up libhtml-template-perl (2.95-2) ...
Setting up mariadb-server (10.0.25-0ubuntu0.15.10.1) ...
Processing triggers for libc-bin (2.21-0ubuntu4) ...
Processing triggers for ureadahead (0.100.0-19) ...
Processing triggers for systemd (225-1ubuntu9) ...

Start and enable the mariadb service.

root@linuxhelp:~# systemctl start mysql
root@linuxhelp:~# systemctl enable mysql

Then specify the root password for mariadb.

root@linuxhelp:~# mysql_secure_installation

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

In order to log into MariaDB to secure it, we' ll need the current
password for the root user.  If you' ve just installed MariaDB, 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 MariaDB
root user without the proper authorisation.

Set root password? [Y/n] y
New password:
Re-enter new password:
Password updated successfully!
Reloading privilege tables..
 ... Success!

By default, a MariaDB installation has an anonymous user, allowing anyone
to log into MariaDB 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, MariaDB 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 MariaDB
installation should now be secure.

Thanks for using MariaDB!

Create a database and database user for limesurvey.

root@linuxhelp:~# mysql -u root -p
Enter password:
Welcome to the MariaDB monitor.  Commands end with   or g.
Your MariaDB connection id is 50
Server version: 10.0.25-MariaDB-0ubuntu0.15.10.1 (Ubuntu)

Copyright (c) 2000, 2016, Oracle, MariaDB Corporation Ab and others.

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

MariaDB [(none)]>  CREATE DATABASE limedb 
Query OK, 1 row affected (0.00 sec)

MariaDB [(none)]>  GRANT ALL PRIVILEGES ON limedb.* TO ' limeuser' @' localhost'  IDENTIFIED BY ' linux'  
Query OK, 0 rows affected (0.00 sec)

MariaDB [(none)]>  FLUSH PRIVILEGES 
Query OK, 0 rows affected (0.00 sec)

MariaDB [(none)]>  exit
Bye

Utilise the following command, to install the apache webserver package.

root@linuxhelp:~# apt-get install apache2 -y
Reading package lists... Done
Building dependency tree       
Reading state information... Done
The following extra packages will be installed:
  apache2-bin apache2-data apache2-utils libapr1 libaprutil1 libaprutil1-dbd-sqlite3 libaprutil1-ldap liblua5.1-0
Suggested packages:
  apache2-doc apache2-suexec-pristine apache2-suexec-custom
.
.
.
Enabling conf security.
Enabling conf serve-cgi-bin.
Enabling site 000-default.
Processing triggers for libc-bin (2.21-0ubuntu4) ...
Processing triggers for ureadahead (0.100.0-19) ...
Processing triggers for systemd (225-1ubuntu9) ...
Processing triggers for ufw (0.34-2) ...

Install the PHP extensions, by running the following command.

root@linuxhelp:~# apt-get install php5 libapache2-mod-php5 php5-mcrypt php5-mysql -y
Reading package lists... Done
Building dependency tree       
Reading state information... Done
The following extra packages will be installed:
  libmcrypt4 php5-cli php5-common php5-json php5-readline
Suggested packages:
  php-pear libmcrypt-dev mcrypt php5-user-cache
.
.
.
Creating config file /etc/php5/mods-available/readline.ini with new version
php5_invoke: Enable module readline for apache2 SAPI
php5_invoke: Enable module readline for cli SAPI
Processing triggers for libc-bin (2.21-0ubuntu4) ...
Processing triggers for libapache2-mod-php5 (5.6.11+dfsg-1ubuntu3.4) ...

Visit the LimeSurvey’ s official link,
https://www.limesurvey.org/ to download the latest version
or download the package by using wget command.

root@linuxhelp:~# wget http://download.limesurvey.org/latest-stable-release/limesurvey250plus-build160718.zip

Extract the downloaded package as shown below.

root@linuxhelp:~# cd Downloads/
root@linuxhelp:~/Downloads# ls
limesurvey250plus-build160718.zip
root@linuxhelp:~/Downloads# unzip limesurvey250plus-build160718.zip
Archive:  limesurvey250plus-build160718.zip
   creating: limesurvey/
  inflating: limesurvey/.gitattributes  
  inflating: limesurvey/.gitignore   
  inflating: limesurvey/.htaccess    
  inflating: limesurvey/.scrutinizer.yml  
  inflating: limesurvey/README       
   creating: limesurvey/admin/
 extracting: limesurvey/admin/admin.php  
  inflating: limesurvey/admin/index.php
.
.
.
  inflating: limesurvey/upload/admintheme/index.html  
   creating: limesurvey/upload/labels/
  inflating: limesurvey/upload/labels/index.html  
  inflating: limesurvey/upload/labels/readme.txt  
  inflating: limesurvey/upload/readme.txt  
   creating: limesurvey/upload/surveys/
  inflating: limesurvey/upload/surveys/index.html  
  inflating: limesurvey/upload/surveys/readme.txt  
   creating: limesurvey/upload/templates/
  inflating: limesurvey/upload/templates/index.html  
  inflating: limesurvey/upload/templates/readme.txt

Shift the " limesurvey" directory to /var/www/html/ location.

root@linuxhelp:~/Downloads# ls
limesurvey  limesurvey250plus-build160718.zip
root@linuxhelp:~/Downloads# mv limesurvey /var/www/html/

Change the ownership for the limesurvey directory as follows.

root@linuxhelp:~# chown www-data:www-data -R /var/www/html/limesurvey
root@linuxhelp:~# ls -l /var/www/html/limesurvey/
total 84
drwxr-xr-x  2 www-data www-data 4096 Jul 18 15:10 admin
drwxr-xr-x 15 www-data www-data 4096 Jul 18 15:10 application
drwxr-xr-x  3 www-data www-data 4096 Jul 18 15:11 docs
drwxr-xr-x 15 www-data www-data 4096 Jul 18 15:11 fonts
drwxr-xr-x 19 www-data www-data 4096 Jul 18 15:11 framework
drwxr-xr-x  4 www-data www-data 4096 Jul 18 15:11 images
-rw-r--r--  1 www-data www-data 7552 Jul 18 15:10 index.php
drwxr-xr-x  6 www-data www-data 4096 Jul 18 15:11 installer
drwxr-xr-x 90 www-data www-data 4096 Jul 18 15:11 locale
-rw-r--r--  1 www-data www-data 1140 Jul 18 15:10 phpci.yml
drwxr-xr-x  4 www-data www-data 4096 Jul 18 15:11 plugins
-rw-r--r--  1 www-data www-data   61 Jul 18 15:10 README
drwxr-xr-x  4 www-data www-data 4096 Jul 18 15:11 scripts
drwxr-xr-x 11 www-data www-data 4096 Jul 18 15:11 data-styles
drwxr-xr-x  5 www-data www-data 4096 Jul 18 15:11 data-styles-public
drwxr-xr-x  5 www-data www-data 4096 Jul 18 15:11 templates
drwxr-xr-x  3 www-data www-data 4096 Jul 18 15:11 themes
drwxr-xr-x 32 www-data www-data 4096 Jul 18 15:11 third_party
drwxr-xr-x  5 www-data www-data 4096 Jul 18 15:11 tmp
drwxr-xr-x  6 www-data www-data 4096 Jul 18 15:11 upload


To Create apache virtualhost

Run the following command to create the configuration file and then generate a softlink as follows.

root@linuxhelp:~# touch /etc/apache2/sites-available/limesurvey.conf
root@linuxhelp:~# ln -s /etc/apache2/sites-available/limesurvey.conf /etc/apache2/sites-enabled/limesurvey.conf

Unfold the limesurvey.conf file.

root@linuxhelp:~# vim /etc/apache2/sites-available/limesurvey.conf

And append the following entries

< VirtualHost *:80> 
ServerAdmin admin@linuxhelp.com
DocumentRoot /var/www/html/limesurvey/
ServerName linuxhelp.com
ServerAlias www.linuxhelp.com
< Directory /var/www/html/limesurvey/> 
Options FollowSymLinks
AllowOverride All
< /Directory> 
ErrorLog /var/log/apache2/linuxhelp.com-error_log
CustomLog /var/log/apache2/linuxhelp.com-access_log common
< /VirtualHost> 

Restart the apache service.

root@linuxhelp:~# systemctl restart apache2

Hit the browser and access http://< IP_address> /limesurvey

Select the preferred language and click Start installation.

Read the License agreement and Click I Accept to proceed further.


Install the php modules if the following error occurs.

Open the terminal and run the following command to install PHP modules.

root@linuxhelp:~# apt-get install php5-gd php5-ldap php5-imap -y
Reading package lists... Done
Building dependency tree       
Reading state information... Done
The following extra packages will be installed:
  libc-client2007e mlock
Suggested packages:
  uw-mailutils
The following NEW packages will be installed:
  libc-client2007e mlock php5-gd php5-imap php5-ldap
0 upgraded, 5 newly installed, 0 to remove and 252 not upgraded.
.
.
.
php5_invoke: Enable module ldap for apache2 SAPI
php5_invoke: Enable module ldap for cli SAPI
Processing triggers for libc-bin (2.21-0ubuntu4) ...
Processing triggers for libapache2-mod-php5 (5.6.11+dfsg-1ubuntu3.4) ...

Then restart the apache services.

root@linuxhelp:~# systemctl restart apache2

Open the browser and reload the page.

Now configure the database and click populate database.


Create Administrator Account by filling up the fields below and click Next

Click Administration.

Login with credentials

Hit Create a new survey.

Start creating your own survey by filling the necessary fields.

FAQ
Q
How can I stop the system from sending confirmation emails?
A
If you are using tokens and a participant fills out the survey, a confirmation email is sent to his/her email address. If you don't want this message to be sent just delete the whole confirma
Q
2 limesurvey instance on same domain
A
With 2 limesurvey instance on same domain, but different directory, you need to update the session configuration. For example, if you have example.org/ls1 and example.org/ls2 : update the ls
Q
Purpose of using the LimeSurvey?
A
LimeSurvey is a free survey application that was programmed in php to create surveys. It permits the end user to access the web interface to develop and publish online surveys.
Q
Why the LAMP or LEMP setup is need to run the LimeSurvey application?
A
Because LimeSurvey is webinterface applicaion and which is written in PHP
Q
How can I restore data from a deactivated survey?
A
We recommend to always use the time-out option instead of deactivating a survey. If you closed your survey accidentally it is important that you don't change anything in the survey. Then, an