Install LimeSurvey CE on Alibaba Cloud

Alibaba Cloud
7 min readSep 16, 2019


By Arslan Ud Din Shafiq, Alibaba Cloud Community Blog author and Alibaba Cloud MVP.

LimeSurvey is a free-to-use and open-source web application for creating surveys to get statistical reports. It has been written in PHP language. LimeSurvey helps you to easily conduct surveys. You can ask questions from the people for assessments. LimeSurvey is multilingual supporting more than 80 languages. You can run a survey in multiple translations at the same time without copying it.

In this tutorial, you will be installing and setting up LimeSurvey CE on an Alibaba Cloud Elastic Compute Service (ECS) instance that is installed with Ubuntu 16.04.


  • You must have Alibaba Cloud Elastic Compute Service (ECS) activated and verified your valid payment method. If you don’t know how to setup your ECS instance, you can refer to this tutorial or quick-start guide. Your ECS instance must have at least 1GB RAM and 1 Core processor.
  • A domain name registered from Alibaba Cloud. If you have already registered a domain from Alibaba Cloud or any other host, you can update its domain nameserver records.
  • Domain name must be pointed to your Alibaba Cloud ECS’s IP address
  • Access to VNC console in your Alibaba Cloud or SSH client installed in your PC
  • Set up your server’s hostname and create user with root privileges.

Setting up Your Environment

Setting up Your Server

Before proceeding with installation of any kind of package, use the following command to update your Ubuntu system. To run this command, remember to login from non-root user with sudo privileges.

# sudo apt update && sudo apt upgrade

Installing PHP

Limesurvey requires PHP 5.5.9 or later. In this tutorial, you will install PHP 7.2. To do so, run the following steps.

You will need to install python software properties and software properties common. To do so, run the command below.

# sudo apt-get install software-properties-common python-software-properties

Add a repository for newer versions of PHP.

# sudo add-apt-repository ppa:ondrej/php

Then, update the system to refresh the available repositories.

# sudo apt update

Last, to install PHP 7.2, run the following command.

# sudo apt install -y php7.2

Installing Required PHP Extensions

LimeSurvey CE requires the following PHP extensions:

  1. php7.2-cli
  2. php7.2-fpm
  3. php7.2-common
  4. php7.2-mysql
  5. php7.2-ldap
  6. php7.2-imap
  7. php7.2-gd
  8. php7.2-mbstring
  9. php7.2-zip
  10. php7.2-xml

To install the above extensions of PHP, run the following command.

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

When you have done installation of the above extensions, apache2 will be installed automatically. Hence, you don’t need to install apache explicitly.

You can run the following command to check installed PHP version.

# php --version

Installing MariaDB

LimeSurvey CE supports MySQL, PostgreSQL, MSSQL and SQLite. In this tutorial, you will use MariaDB server for MySQL. By default, Ubuntu repository has older version of MariaDB server. To use new version of MariaDB, you will need to add MariaDB repository to your Ubuntu system. To do so, follow the steps below.

Verify the keys by running command.

# sudo apt-key adv --recv-keys --keyserver hkp:// 0xF1656F24C74CD1D8

Add the repository by running the command.

# sudo add-apt-repository 'deb [arch=amd64,i386,ppc64el] xenial main'

Update the system by running command.

# sudo apt update

Install MariaDB by running the following command.

# sudo apt install -y mariadb-server

Start and enable the MariaDB server so that after reboot, the server can start automatically.

# sudo systemctl start mariadb
# sudo systemctl enable mariadb

Run the following command to enhance security of MariaDB server and set password for the root user.

# sudo mysql_secure_installation

Connect to the MySQL shell as root user by running the command below and enter your password.

# sudo mysql -u root -p

Running the following MySQL queries in your MariaDB server.

CREATE USER 'aareez'@'localhost' IDENTIFIED BY '654321Ab';
GRANT ALL PRIVILEGES ON lime.* TO 'aareez'@'localhost';

Installing Unzip

You will need to install unzip which will be used to unzip the compressed zip folder. To install unzip, run the command.

# sudo apt-get install unzip -y

Installing and Setting up LimeSurvey CE

To install LimeSurvey CE, you will need to follow the steps.

Navigate to /var/www/html using the command.

# cd /var/www/html

Now change ownership of /var/www/html directory to aareez.

# sudo chown -R aareez:aareez /var/www/html

Remove index.html file by running the command below.

# sudo rm index.html

Now download the latest stable release of LimeSurvey CE using the command below.

# wget

Now unzip the downloaded compressed folder by running command below.

# unzip

Now remove the zip folder by running command below.

# rm

Now provide ownership of /var/www/html to www-data so that apache server can access the required files.

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

Configuring the Apache Server

Create virtual host configuration file for LimeSurvey CE by running the following command. After you run this command, a file will be opened in nano text editor.

# sudo nano /etc/apache2/sites-available/lime.conf

Copy and LimeSurvey CE the following code and save the file.

<VirtualHost *:80> 
DocumentRoot /var/www/html/limesurvey/
DirectoryIndex index.php index.htm index.html
<Directory /var/www/html>
Options FollowSymLinks
AllowOverride All
ErrorLog ${APACHE_LOG_DIR}/LimeSurvey_error.log
LogLevel warn
CustomLog ${APACHE_LOG_DIR}/LimeSurvey_access.log combined

Run the command below to disable default site.

# sudo a2dissite 000-default.conf

You will need to enable the newly created virtual host. To do so, run the command below.

# sudo a2ensite lime

You will need to enable rewrite mod. You can do so by editing configuration file in apache2 directory or you can simply run the command below.

# sudo a2enmod rewrite

You will need to enable SSL engine. You can do so by editing configuration file in apache2 directory or you can simply run the command below.

# sudo a2enmod ssl

You will have to restart apache server to apply the changes and load the settings by running command below.

# sudo service apache2 restart

You can access LimeSurvey CE via your domain name or ECS IP address. In my case, I have accessed via You will see the following screen.

It will automatically detect your browser’s language. However, you can select your desired language and click Start installation. You will be redirected to following screen.

Click “I accept” button to continue. You will be redirected to pre-installation check page. You can see everything looks good. If you see any error here, try to troubleshoot.

Click Next button, you will be redirected to database configuration page.

Click Next button, then you will be asked to allow to populate database with tables.

Click Populate database button to continue, then you will be redirected to administrator’s settings page.

Now enter your information to the form above and then click Next. After administrator’s account is created, you will be then redirected to the following page.

Click Administration, you will be redirected to the following page. Log in to your account using admin credentials.

After login, you will see the following dashboard.

Installing the SSL Certificate

We will install SSL certificate using Let’s Encrypt with Certbot. To do so, run the following steps.

Update the package.

# sudo apt-get update

Install software-properties-common.

# sudo apt-get install software-properties-common

Add the certbot repository by running the command below.

# sudo add-apt-repository ppa:certbot/certbot

Update the package to load the added certbot repository.

# sudo apt-get update

Stop apache before issuance of SSL certificate.

# sudo systemctl stop apache2

Install python-certbot-apache by running the command below.

# sudo apt-get install python-certbot-apache

Running the following command to get Let’s Encrypt SSL issued.

# sudo certbot --apache -d

Select the option 2 to redirect the link to https and update virtual host settings for SSL. Restart apache server.

# sudo systemctl start apache2

You can access your website at https<span>://your_domain_name</span>.tld

Setting up Firewalls and Ports

If you have activated firewalls, you will have to define a rule in Alibaba Cloud security group for your cloud server to add exception for port 80/tcp and 443/tcp. You can enable these ports while creating ECS instance, but in case if you forgot to unblock these ports, you can follow the procedure in this guide: Add security group rules.

Original Source



Alibaba Cloud

Follow me to keep abreast with the latest technology news, industry insights, and developer trends. Alibaba Cloud website: