Tutorials  /  Linux Basics

Install LimeSurvey on CentOS 7 with Apache, PHP & MariaDB

Ccentron Redaktion · June 2025 ·7 min read ·Linux Basics, Tutorial

LimeSurvey is a popular open-source tool for creating and managing online surveys. This guide explains how to set up LimeSurvey on a CentOS 7 server from scratch.

Requirements Before Installation

  • An initial CentOS 7 server instance
  • A user account with sudo privileges
VM

Matching infrastructure at centron

No hardware needed to follow along: ccloud³ VMs with full root access start at €3.12 per month, billed by the hour and ready in seconds. Rent a cloud server →

Step 1: Bring the System Up to Date

First, update your server to ensure all packages are current:

Console
sudo yum install epel-release -y
sudo yum update -y
sudo shutdown -r now

Once the system reboots, sign back in with your sudo-enabled user account to continue the setup.

Step 2: Set Up Apache Web Server

Install Apache using the YUM package manager:

Console
sudo yum install httpd -y

In a production setup, it's a good idea to disable the default Apache welcome page:

Console
sudo sed -i 's/^/#&/g' /etc/httpd/conf.d/welcome.conf

For added security, modify Apache's configuration to restrict access to directory listings under the web root /var/www/html:

Console
sudo sed -i "s/Options Indexes FollowSymLinks/Options FollowSymLinks/" /etc/httpd/conf/httpd.conf

Now, launch Apache and enable it to start automatically at boot:

Console
sudo systemctl start httpd.service
sudo systemctl enable httpd.service

Step 3: Install PHP 5.6.x and Required Extensions

LimeSurvey requires at least PHP version 5.3.3. However, as PHP 5.5 and older versions are no longer supported, we'll proceed with installing PHP 5.6.x along with its necessary modules using the IUS third-party YUM repository.

Begin by setting up the IUS repository:

Console
cd
wget https://centos7.iuscommunity.org/ius-release.rpm
sudo rpm -Uvh ius-release.rpm

Once the repository is configured, install PHP 5.6.x and its required extensions with the following command:

Console
sudo yum install php56u php56u-common php56u-xml php56u-gd php56u-mbstring php56u-mysqlnd php56u-mcrypt php56u-imap php56u-ldap -y

To activate the newly installed PHP modules, restart the Apache service:

Console
sudo systemctl restart httpd.service

Step 4: Set Up MariaDB and Create a Database for LimeSurvey

LimeSurvey requires a database engine such as MySQL version 5.5.3 or newer. On CentOS 7, you can satisfy this requirement by installing MariaDB version 5.5.50 or higher through the default YUM repositories.

Install MariaDB and its server components:

Console
sudo yum install mariadb mariadb-server -y

Enable the MariaDB service and start it immediately:

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

Proceed to secure your MariaDB instance by running the built-in security script:

Console
sudo /usr/bin/mysql_secure_installation

During the guided process, provide responses to the prompts as shown:

  • Enter current password for root (enter for none): Enter
  • Set root password? [Y/n]: Y
  • New password:
  • Re-enter new password:
  • Remove anonymous users? [Y/n]: Y
  • Disallow root login remotely? [Y/n]: Y
  • Remove test database and access to it? [Y/n]: Y
  • Reload privilege tables now? [Y/n]: Y

Once MariaDB is secured, log into the database system using the root user:

Code
mysql -u root -p

When prompted, enter the root password you set earlier. Inside the MySQL interface, execute the following to create a new database and a dedicated user account with the appropriate access permissions. Make sure to replace the placeholder credentials with your own secure values.

Code
CREATE DATABASE limesurvey;
CREATE USER 'limesurveyuser'@'localhost' IDENTIFIED BY 'yourpassword';
GRANT ALL PRIVILEGES ON limesurvey.* TO 'limesurveyuser'@'localhost' IDENTIFIED BY 'yourpassword' WITH GRANT OPTION;
FLUSH PRIVILEGES;
EXIT;

Step 5: Install LimeSurvey

Begin by downloading the most recent stable release of LimeSurvey directly from their official website. At the time this was written, version 2.51.4 was the latest:

Console
cd
wget https://www.limesurvey.org/stable-release?download=1853:limesurvey2514%20160908targz -O limesurvey2.51.4.tar.gz

Extract the downloaded archive, move the content into the web server root, and set the appropriate permissions:

Code
tar -zxvf limesurvey2.51.4.tar.gz
sudo mv limesurvey/ /var/www/html && sudo chown root:root -R /var/www/html
sudo chown -R apache:apache /var/www/html/limesurvey/tmp /var/www/html/limesurvey/upload /var/www/html/limesurvey/application/config

Next, update your firewall rules to allow incoming HTTP traffic:

Console
sudo firewall-cmd --zone=public --permanent --add-service=http
sudo firewall-cmd --reload

Now, launch your web browser and access the following URL, replacing the IP with your actual server address (example shown uses 203.0.113.1):

http://203.0.113.1/limesurvey

Installation Wizard Steps

  • Welcome Page: Click the Start installation button.
  • License Agreement: Accept the license by clicking I accept.
  • Pre-installation Check: Verify that all system requirements are met, then click Next.
  • Database Configuration: Fill in your database details and click Next.

Replace the example values with your own credentials:

  • Database type*: MySQL
  • Database location*: localhost
  • Database user*: limesurveyuser
  • Database password: yourpassword
  • Database name*: limesurvey
  • Table prefix: lime_

When you reach the Database Settings screen, it will detect that the limesurvey database already exists. Click the Populate database button to initialize it.

On the Optional Settings page, fill out the necessary admin details. For security reasons, avoid using the default admin username (admin) and password (password). Choose a unique username and a strong password instead.

On the final Success! screen, click the Administration button to go to the admin login page and log in with the credentials you just created:

http://203.0.113.1/limesurvey/index.php/admin

Post-Installation Security Tip

By default, LimeSurvey stores sensitive configuration data—including database credentials—in the file:

/var/www/html/limesurvey/application/config/config.php

To mitigate the risk of accidental file exposure, move this file outside the web-accessible directory and replace it with a PHP include statement:

Console
sudo cp /var/www/html/limesurvey/application/config/config.php /etc/limesurvey-config.php
sudo chown apache:apache /etc/limesurvey-config.php
echo '<!--?php return include("/etc/limesurvey-config.php"); ?-->' | sudo tee /var/www/html/limesurvey/application/config/config.php

Conclusion

You've now successfully completed the full installation and setup process of LimeSurvey on a CentOS 7 server. From updating your system and installing Apache, PHP, and MariaDB, to securing your configuration and running the LimeSurvey installer, every essential step has been covered.

LimeSurvey is now fully operational and ready to support your survey initiatives. To ensure long-term security and performance, always keep your server and LimeSurvey installation up to date, regularly back up your database and configuration, and follow security best practices for web applications.

With this foundation in place, you're equipped to design, deploy, and analyze powerful surveys through a reliable and flexible open-source platform.

Jetzt 200 € Guthaben sichern

Testen Sie Ihr Setup auf ccloud³

Registrieren Sie sich in der ccloud³ und erhalten Sie 200 € Startguthaben für Ihr Projekt – z. B. für eine PostgreSQL-VM mit automatischen Backups.

centron Redaktion Technische Redaktion

Das Redaktionsteam von centron schreibt Anleitungen aus dem Betriebsalltag: getestet auf unserer eigenen Plattform, betrieben im Rechenzentrum in Hallstadt bei Bamberg.

Kategorie Linux Basics
Teilen
Noch offene Fragen?

Our team will help you with your specific setup - in German or English, by people who run the platform themselves.

War dieses Tutorial hilfreich?

Your answer is stored anonymously and helps us improve our tutorials.

Kommentare

No comments yet - be the first to ask a question about this tutorial.

Sign in to comment

Comments are open to centron customers. Sign in to your account to ask a question about this tutorial.

Weiterlesen

Das könnte Sie auch interessieren

Jetzt kostenlos anfangen

Melden Sie sich an und erhalten Sie in den ersten 60 Tagen ein Guthaben von 200 € bei centron.

Dieses Werbeangebot gilt nur für neue Konten. Angebot ausschließlich für Gewerbetreibende.

Jetzt loslegen Sales kontaktieren