Elgg is an open-source and highly customizable framework used for building an online social environment. It provides a simple and powerful user interface that helps to manage and build your content through a web browser. Elgg offers a rich set of features including messaging, microblogging, file-sharing, RSS support, access control, groups, and many more.

In this tutorial, we will show you how to install and configure Elgg social networking platform on Ubuntu 20.04.

Prerequisites

• A fresh Ubuntu 20.04 on the Atlantic.Net Cloud Platform
• A valid domain name pointed to your server IP
• A root password configured on your server

Step 1 – Install Apache, MariaDB and PHP

Elgg runs on Apache web server, is written in PHP, and uses MySQL/MariaDB as a database backend, so you will need to install the Apache, MariaDB, PHP and other required PHP extensions to your server. You can install all of them with the following command:

apt-get install apache2 mariadb-server php libapache2-mod-php php-common php-sqlite3 php-curl 
php-intl php-mbstring php-xmlrpc php-mysql php-gd php-xml php-cli php-zip unzip wget -y

After installing all the packages, edit the php.ini file and change some recommended settings.

nano /etc/php/7.4/apache2/php.ini

Change the following values:

max_execution_time = 300
memory_limit = 512M
upload_max_filesize = 100M
date.timezone = Asia/Kolkata

Save and close the file, then restart the Apache service to apply the configuration changes.

systemctl restart apache2

Step 2 – Create a Database for Elgg

Next, you will need to create a database and user for Elgg. First, log in to MySQL shell with the following command:

mysql

Once logged in, create a database and user with the following command:

CREATE DATABASE elgg;
CREATE USER 'elgg'@'localhost' IDENTIFIED BY 'secure-password';

Next, grant all the privileges to the elgg database with the following command:

GRANT ALL ON elgg.* TO 'elgg'@'localhost' IDENTIFIED BY 'secure-password' WITH GRANT 
OPTION;

Next, flush the privileges and exit from the MariaDB shell with the following command:

FLUSH PRIVILEGES;
EXIT;

At this point, the MariaDB database is created for Elgg.

Step 3 – Install Elgg

First, download the latest version of Elgg from its official website using the following command:

wget https://elgg.org/download/elgg-3.3.13.zip

Once the download is completed, unzip the downloaded file with the following command:

unzip elgg-3.3.13.zip

Next, move the extracted directory to the Apache root directory:

mv elgg-3.3.13 /var/www/html/elgg

Next, create a data directory and set proper ownership and permissions to the Elgg directory:

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

Once you are finished, you can proceed to the next step.

Step 4 – Configure Apache for Elgg

Next, you will need to configure Apache to serve Elgg. You can configure it by creating a new Apache virtual host configuration file:

nano /etc/apache2/sites-available/elgg.conf

Add the following lines:

<VirtualHost *:80>
ServerAdmin [email protected]
DocumentRoot /var/www/html/elgg/
ServerName elgg.example.com
Options FollowSymLinks
AllowOverride All
ErrorLog /var/log/apache2/elgg-error_log
CustomLog /var/log/apache2/elgg-access_log common
</VirtualHost>

Save and close the file, then enable the virtual host and Apache rewrite module with the following command:

a2ensite elgg.conf
a2enmod rewrite

Finally, restart the Apache service to apply the changes:

systemctl restart apache2

Step 5 – Access Elgg Web Interface

Now, open your web browser and access the Elgg web interface using the URL http://elgg.example.com. You should see the Elgg welcome screen:

Click on the Next button. You should see the PHP requirement check page:

Once all checks are passed, click on the Next button. You should see the database configuration page:

Provide your database information, data directory, and site URL and click on the Next button. You should see the site configuration page:

Provide your database table prefix, data directory, site URL, and timezone and click on the Next button. You should see the site creation page:

Provide your site name and email and click on the Next button. You should see the following page:

Provide your admin username, password, email and click on the Next button. You should see the following page:

Click on Go to site. You should see the Elgg login page:

Provide your admin username and password and click on the Log in button. You should see the Elgg dashboard in the following page:

Conclusion

In the above guide, you learned how to install and configure the Elgg social networking platform on Ubuntu 20.04. You can now deploy your own social networking platform in your internal network or live environment. Get started with Elgg today on VPS hosting from Atlantic.Net!