Elgg is an open source development framework used to build an online social environment. It is highly customizable with a simple and powerful user interface that makes it easy to build and manage content online over the web. Elgg is managed by the Elgg Foundation, which is a nonprofit organization. This organization aims at providing a stable, commercially and individually independent organization in the best interest of Elgg. This project was started in 2004 by Ben Werdmuller and Dave Tosh

It has many amazing features, among them are:

  • User authentication
  • Security
  • Groups
  • File sharing
  • RPC web services
  • Well-documented core API
  • Extendable system of views
  • A large Elgg community to help with arising issues

This guide demonstrates how to install Elgg social networking engine on Ubuntu 20.04 | Debian 10

Getting Started

To run Elgg social networking platform on Ubuntu 20.04 | Debian 10, we need the following:

  • MySQL 5.5.3 and above
  • PHP 7.2 and above with its extensions
  • A web server(Apache/Nginx)

Step 1: Install LEMP stack on Ubuntu 20.04 | Debian 10

LAMP stack stands for Linux, Apache, MariaDB and PHP this combination of application is required for Elgg social networking engine.

All the above applications can be installed using the simple commands below:

Install MariaDB:

sudo apt-get update
sudo apt-get upgrade
sudo apt install mariadb-server mariadb-client

Agree to start the installation of MariDB database server and client:

The following NEW packages will be installed:
  galera-3 libcgi-fast-perl libcgi-pm-perl libconfig-inifiles-perl
  libdbd-mysql-perl libdbi-perl libencode-locale-perl libfcgi-perl
  libhtml-parser-perl libhtml-tagset-perl libhtml-template-perl
  libhttp-date-perl libhttp-message-perl libio-html-perl
  liblwp-mediatypes-perl libsnappy1v5 libterm-readkey-perl libtimedate-perl
  liburi-perl mariadb-client mariadb-client-10.3 mariadb-client-core-10.3
  mariadb-common mariadb-server mariadb-server-10.3 mariadb-server-core-10.3
  mysql-common socat
0 upgraded, 28 newly installed, 0 to remove and 0 not upgraded.
Need to get 21.3 MB of archives.
After this operation, 173 MB of additional disk space will be used.
Do you want to continue? [Y/n] y

Install Nginx Web Server:

sudo apt install nginx

Allow http and https service through the firewall

sudo ufw allow proto tcp from any to any port 80,443

Install php-fpm

sudo apt update
sudo apt install php php-cli php-fpm php-json php-pdo php-mysql php-zip php-gd  php-mbstring php-curl php-xml php-pear php-bcmath

1. Configure php-fpm

Edit the file www.conf and set listen unix socket like below:

listen = /run/php/php-fpm.sock

Configure fastcgi_pass by editing the file /etc/nginx/php_fastcgi.conf as below

sudo vim /etc/nginx/php_fastcgi.conf

Edit the file to resemble this:

# 404
try_files $fastcgi_script_name =404;

# default fastcgi_params
include fastcgi_params;

# fastcgi settings
fastcgi_pass			unix:/run/php/php-fpm.sock;
fastcgi_index			index.php;
fastcgi_buffers			8 16k;
fastcgi_buffer_size		32k;
fastcgi_hide_header             X-Powered-By;
fastcgi_hide_header             X-CF-Powered-By;

Start and enbale php-fpm

# Ubuntu 20.04
sudo systemctl enable php7.4-fpm
sudo systemctl restart php7.4-fpm

# Debian 10
sudo systemctl enable php7.3-fpm
sudo systemctl restart php7.3-fpm

2. Configure Nginx

Unlink the default configuration file from /etc/nginx/sites-enabled

sudo unlink /etc/nginx/sites-enabled/default

Create a new configuration file for elgg at /etc/nginx/sites-available

sudo vim /etc/nginx/sites-available/elgg.conf

In the file, paste this content:

server {
        listen 80 default_server;
        listen [::]:80 default_server;

        root /var/www/html/elgg/;

        # Add index.php to the list if you are using PHP
        index index.php index.html index.htm index.nginx-debian.html;

        server_name _;

        location / {
                # First attempt to serve request as file, then
                # as directory, then fall back to displaying a 404.
                #try_files $uri $uri/ =404;
                 try_files $uri $uri/ /index.php?$args;

        # pass PHP scripts to FastCGI server
        location ~ \.php$ {
                include snippets/fastcgi-php.conf;

                # With php-fpm (or other unix sockets):
                fastcgi_pass unix:/var/run/php/php7.4-fpm.sock;
        #       # With php-cgi (or other tcp sockets):
        #       fastcgi_pass;

        # deny access to .htaccess files, if Apache's document root
        # concurs with nginx's one
        #location ~ /\.ht {
        #       deny all;

Add the config file elgg.conf to /etc/nginx/sites-enabled

sudo ln -s /etc/nginx/sites-available/elgg.conf /etc/nginx/sites-enabled/

Verify the syntax of the config file:

$ sudo nginx -t
nginx: the configuration file /etc/nginx/nginx.conf syntax is ok
nginx: configuration file /etc/nginx/nginx.conf test is successful

Now start and enable Nginx:

sudo systemctl enable nginx
sudo systemctl start nginx

Check the status of Nginx

$ sudo systemctl status nginx
● nginx.service - A high performance web server and a reverse proxy server
     Loaded: loaded (/lib/systemd/system/nginx.service; enabled; vendor preset: enabled)
     Active: active (running) since Thu 2021-07-15 19:02:03 UTC; 9s ago
       Docs: man:nginx(8)
    Process: 5508 ExecStartPre=/usr/sbin/nginx -t -q -g daemon on; master_process on; (code=exited, status=0/SUCCESS)
    Process: 5518 ExecStart=/usr/sbin/nginx -g daemon on; master_process on; (code=exited, status=0/SUCCESS)
   Main PID: 5521 (nginx)
      Tasks: 2 (limit: 1071)
     Memory: 2.6M
     CGroup: /system.slice/nginx.service
             ├─5521 nginx: master process /usr/sbin/nginx -g daemon on; master_process on;
             └─5522 nginx: worker process

Jul 15 19:02:03 elgg systemd[1]: Starting A high performance web server and a reverse proxy server...
Jul 15 19:02:03 elgg systemd[1]: Started A high performance web server and a reverse proxy server.

3. Configure Elgg Database

Start and enable MariaDB

sudo systemctl start mariadb
sudo systemctl enable mariadb

Harden MariaDB

$ sudo mysql_secure_installation


In order to log into MariaDB to secure it, we'll need the current
password for the root user.  If you've just installed MariaDB, and
you haven't set the root password yet, the password will be blank,
so you should just press enter here.

Enter current password for root (enter for none): 
OK, successfully used password, moving on...

Setting the root password ensures that nobody can log into the MariaDB
root user without the proper authorisation.

Set root password? [Y/n] y
New password: 
Re-enter new password: 
Password updated successfully!
Reloading privilege tables..
 ... Success!

By default, a MariaDB installation has an anonymous user, allowing anyone
to log into MariaDB without having to have a user account created for
them.  This is intended only for testing, and to make the installation
go a bit smoother.  You should remove them before moving into a
production environment.

Remove anonymous users? [Y/n] y
 ... Success!

Normally, root should only be allowed to connect from 'localhost'.  This
ensures that someone cannot guess at the root password from the network.

Disallow root login remotely? [Y/n] y
 ... Success!

By default, MariaDB comes with a database named 'test' that anyone can
access.  This is also intended only for testing, and should be removed
before moving into a production environment.

Remove test database and access to it? [Y/n] y
 - Dropping test database...
 ... Success!
 - Removing privileges on test database...
 ... Success!

Reloading the privilege tables will ensure that all changes made so far
will take effect immediately.

Reload privilege tables now? [Y/n] y
 ... Success!

Cleaning up...

All done!  If you've completed all of the above steps, your MariaDB
installation should now be secure.

Thanks for using MariaDB!

Allow normal user to access database as root:

$ sudo mysql -u root
UPDATE mysql.user SET plugin = 'mysql_native_password' WHERE User = 'root';

With MariaDB installed, we now want to create a database for Elgg. Login to MariaDB

mysql -u root -p

Then create database for Elgg:

CREATE USER 'elgg'@'localhost' IDENTIFIED BY '[email protected]';
GRANT ALL PRIVILEGES ON elgg.* TO 'elgg'@'localhost';

Step 2: Install Elgg Social networking engine on Ubuntu 20.04 | Debian 10

To install Elgg we first need to install the latest release of Elgg from the official release page. Always check for the latest version of Elgg before installation from the official release page.

During the time of documenting the article, the latest stable version was at 3.3.20. We will download it as below. Ensure Wget is installed on your system, if not install it with sudo apt-get install wget

rm -rf elgg-*.zip
curl -s  https://api.github.com/repos/Elgg/Elgg/releases/latest |grep browser_download_url  | cut -d '"' -f 4 | wget -i -

Then unzip it. Install unzip if you do not have it installed sudo apt install unzip

sudo apt install unzip -y
unzip elgg-*.zip

Move the extracted file to the Apache directory:

sudo mv elgg-*/ /var/www/html/elgg/

Create a data directory and set permissions to the files:

sudo mkdir /var/www/html/data
sudo chown -R nginx:nginx /var/www/html/elgg/
sudo chown -R nginx:nginx /var/www/html/data
sudo chmod -R 755 /var/www/html/elgg

Step 3: Acces Elgg Web Interface

With all the above configurations done, we are set to access Elgg via the web. This is achieved by opening the following URL on your browser http://HOSTNAME/elgg or http://IP_Address/elgg

You will see a landing page similar to this.

Click NEXT. You will see the PHP requirement check page

With PHP checks complete you will go to the database installation page, here you will be required to provide your database information that you created, also you will be required to give the data directory that we created earlier at /var/www/html/data :

This is the site creation page. You provide the name of your site and click NEXT

Next we create an Admin account, enter the details and proceed.

After providing the above details, you will have successfully created an admin account.

Now from here, proceed by clicking at Go to SIte. Here you are required login to elgg by providing your admin username and password.

On login, you will see this page.

Navigate to the account icon on the top right, then go to Administration > Administer>Plugins. Here you can start and enable your Elgg plugins by clicking activate on the selected plugin.

Now are set to go. You can now mange your content online add blogs, files,pages, bookmarks and wire posts from the Dashboard


From the above demonstration, we have installed and configured Elgg social networking engine on Ubuntu 20.04 | Debian 10. Now with this, you can deploy your social networking platform. I hope this article was of help to you.

Find more articles on our page:

Setup CTparental Parental Control Software on Ubuntu

Install Plesk Control Panel on Ubuntu | Debian

Install Ampache Music Streaming Server on Ubuntu | Debian

Install Concrete5 CMS with Apache on Ubuntu


Please enter your comment!
Please enter your name here