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
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:
sudo yum install epel-release -y
sudo yum update -y
sudo shutdown -r nowOnce 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:
sudo yum install httpd -yIn a production setup, it's a good idea to disable the default Apache welcome page:
sudo sed -i 's/^/#&/g' /etc/httpd/conf.d/welcome.confFor added security, modify Apache's configuration to restrict access to directory listings under the web root /var/www/html:
sudo sed -i "s/Options Indexes FollowSymLinks/Options FollowSymLinks/" /etc/httpd/conf/httpd.confNow, launch Apache and enable it to start automatically at boot:
sudo systemctl start httpd.service
sudo systemctl enable httpd.serviceStep 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:
cd
wget https://centos7.iuscommunity.org/ius-release.rpm
sudo rpm -Uvh ius-release.rpmOnce the repository is configured, install PHP 5.6.x and its required extensions with the following command:
sudo yum install php56u php56u-common php56u-xml php56u-gd php56u-mbstring php56u-mysqlnd php56u-mcrypt php56u-imap php56u-ldap -yTo activate the newly installed PHP modules, restart the Apache service:
sudo systemctl restart httpd.serviceStep 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:
sudo yum install mariadb mariadb-server -yEnable the MariaDB service and start it immediately:
sudo systemctl start mariadb.service
sudo systemctl enable mariadb.serviceProceed to secure your MariaDB instance by running the built-in security script:
sudo /usr/bin/mysql_secure_installationDuring 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:
mysql -u root -pWhen 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.
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:
cd
wget https://www.limesurvey.org/stable-release?download=1853:limesurvey2514%20160908targz -O limesurvey2.51.4.tar.gzExtract the downloaded archive, move the content into the web server root, and set the appropriate permissions:
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/configNext, update your firewall rules to allow incoming HTTP traffic:
sudo firewall-cmd --zone=public --permanent --add-service=http
sudo firewall-cmd --reloadNow, 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:
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.phpConclusion
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.
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.