How to Install Elgg on a Debian or Ubuntu VPS

Elgg is an open source social networking engine that allows individuals and organizations to create an online social environment. Blogging, micro-blogging, networking and file sharing are just few of its features that made it an award winning software. Elgg provides a great support through a great community of developers and services.

System Prerequisites

Before  proceeding with the installation of Elgg, its better to have an idea of its specific requirements. For Elgg to run, you need to have a combination of Apache server, MySQL and PHP already installed.

  • Debian 7 or Ubuntu 12.04 version on your system
  • MySQL 5+
  • Apache web server with mod_rewrite module installed
  • PHP 5.2+ with specific libraries such as GD and Freetype, JSON, XML and Multibyte string support.


Installation of Web and Database Server

Before starting the installation process, run a complete system update as shown below:

apt-get update

apt-get upgrade

Now, install apache and mysql by giving the following command.

apt-get install apache2 mysql-server

While the mysql server installation is in progress, you will have to enter the password for root. Make a note of the password as you will need it further for creating database and new user for Elgg.


Apache Configuration

Once apache is installed, you can enable the rewrite module as follows:

a2enmod rewrite

Now, open the apache configuration file and replace AllowOverride None as AllowOverride All within the directory section defined for ‘/var/www’ folder.

nano /etc/apache2/sites-available/default

Before:     AllowOverride None

After:       AllowOverride All

Save the configuration file and restart the apache server.

service apache2 restart


MySQL User and Database Set Up

You have to create a new database and a user for Elgg. For that, go to MySQL prompt using:

mysql -u root –p

Follow these commands to create a new database, a user and to grant permissions for database access to the user.

CREATE USER elgguser IDENTIFIED BY 'elggpassword';
GRANT ALL ON elgg.* TO elgguser;

Note: You may change the name of the database, user and password as you wish.


PHP Installation

Install PHP using the command given below, so that all the required modules for Elgg also will be installed.

apt-get install php5 php5-gd php-xml-parser php5-mysql unzip


Download and Configuration of Elgg

Download Elgg’s source code from web server’s root directory.

cd /var/www/

wget -O


Run the commands to unzip and remove

unzip && rm

mv elgg-1.8.18/* . && rmdir elgg-1.8.18


Next step is to set up a data directory for storing user uploaded and system generated data. Create a writeable folder outside web server’s root directory.

mkdir <span style='color: red'>/var/elggdata</span>
chown -R www-data:www-data /var/elggdata


This command grants apache the ownership of the data directory. www-data in the above command is apache’s user for writing into the file systems.


Move the .htaccess and settings.php files as given below:

mv /var/www/htaccess_dist /var/www/.htaccess
mv /var/www/engine/settings.example.php /var/www/engine/settings.php


Now, the settings file has to be updated for database access.


Open the settings.php file and enter correct values for the fields shown:

nano /var/www/engine/settings.php

$CONFIG->dbuser = 'elgguser';
$CONFIG->dbpass = 'elggpassword';
$CONFIG->dbname = 'elgg';
$CONFIG->dbhost = 'localhost';
$CONFIG->dbprefix = ''; // or anything else you like



Finishing Up with Installation of Elgg

Open your browser and go to /install.php of your site or IP address. You can use either of the two:   

Now, you will be able to see the installation page waiting for your response. Just follow the instructions at each step of the process. During the installation process, Elgg wil create a database and an admin user. It may want you to enter your site details.

support2 has written 111 articles

Leave a Reply