How to Install LimeSurvey CE on Fedora 28

Published on: Fri, Oct 26, 2018 at 11:14 am EST
Fedora Linux Guides Server Apps

LimeSurvey is an open source survey program written in PHP. The LimeSurvey source code is hosted on GitHub. This guide will show you how to install LimeSurvey Community Edition (CE) on a fresh Fedora 28 Vultr instance.

Requirements

  • Minimum 180 MB disk space.
  • Apache >= 2.4, Nginx >= 1.1 or any other PHP ready webserver.
  • Minimum PHP 5.5.9+ or later. PHP 7.0.0+ is recommended with the following modules/libraries enabled:
    • MBstring, PDO database driver for MySQL or PostgreSQL, GD-Library, IMAP, LDAP, ZIP
  • MySQL >= 5.5.3, PostgreSQL >= 9 or MariaDB >= 5.5

Before you begin

Check OS version.

cat /etc/fedora-release
# Fedora release 28 (Twenty Eight)

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

useradd -c "John Doe" johndoe && passwd johndoe
usermod -aG wheel johndoe
su - johndoe

Ensure that your system is up to date.

sudo dnf check-upgrade || sudo dnf upgrade -y

Set up the timezone.

timedatectl list-timezones
sudo timedatectl set-timezone 'Region/City'

Install required and useful packages.

sudo dnf install -y wget vim unzip bash-completion

For simplicity, disable SELinux and firewall.

sudo setenforce 0; sudo systemctl stop firewalld; sudo systemctl disable firewalld

Install PHP

Install PHP and required PHP extensions.

sudo dnf install -y php-cli php-fpm php-common php-mbstring php-xml php-mysqlnd php-gd php-zip php-ldap php-imap php-json

Check PHP version.

php --version

Start and enable php-fpm.service.

sudo systemctl start php-fpm.service
sudo systemctl enable php-fpm.service

Install MariaDB and setup database

Install MariaDB database server.

sudo dnf install -y mariadb-server

Check MariaDB version.

mysql --version

Start and enable MariaDB service.

sudo systemctl start mariadb.service
sudo systemctl enable mariadb.service

Run the mysql_secure_installation script to improve the security of your MariaDB installation.

sudo mysql_secure_installation

Log into MariaDB as the root user.

mysql -u root -p
# Enter password:

Create a new MariaDB database and user, 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 dnf install -y nginx

Check the Nginx version.

sudo nginx -v

Start and enable the Nginx service.

sudo systemctl start nginx.service
sudo systemctl enable nginx.service

Configure Nginx. Run sudo vim /etc/nginx/conf.d/limesurvey.conf and populate the file with the following configuration.

server {
    listen 80;

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

    index index.php;

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

    location ~ \.php$ {
        try_files $uri =404;
        include fastcgi_params;
        fastcgi_pass unix:/run/php-fpm/www.sock;
        fastcgi_index index.php;
        fastcgi_param SCRIPT_FILENAME $document_root$fastcgi_script_name;
    }

}

Test the Nginx configuration.

sudo nginx -t

Reload Nginx.

sudo systemctl reload nginx.service

Install LimeSurvey

Navigate to /var/www directory.

sudo mkdir -p /var/www
cd /var/www

Download the latest stable LimeSurvey CE ZIP package and unpack it to your disk. If there is a newer version, you should update the LimeSurvey download URL and version numbers.

sudo wget https://www.limesurvey.org/stable-release?download=2415:limesurvey3123%20180627zip -O limesurvey.zip
sudo unzip limesurvey.zip
sudo rm limesurvey.zip

Navigate to document root folder.

cd /var/www/limesurvey

Change ownership of the /var/www/limesurvey folder to user nginx.

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

Create /var/lib/php/session directory and set ownership to nginx.

sudo mkdir -p /var/lib/php/session && sudo chown -R nginx:nginx /var/lib/php

Run sudo vi /etc/php-fpm.d/www.conf and set user and group to nginx. Initially, it will be set to user and group apache.

sudo vim /etc/php-fpm.d/www.conf
# user = nginx
# group = nginx

Restart the PHP-FPM service.

sudo systemctl restart php-fpm.service

Navigate to your server in a web browser and follow the LimeSurvey web installer.

Want to contribute ?

You could earn up to $300 by adding new articles