Elgg: Set Up a Social Networking Platform on Ubuntu

Elgg is a powerful open-source social networking engine that enables users to create their own social networks and online communities. It’s highly customizable, making it a great choice for developers and users looking to build interactive websites.

In this guide, we will go through the entire process of installing Elgg on your Ubuntu server.

Step 1: Install Required Dependencies

First, start by updating your system to make sure all existing packages are up to date to their latest versions.

sudo apt update -y
sudo apt upgrade -y

Next, you need to install Apache (a web server), MySQL (a database server), PHP (the scripting language), and some PHP extensions to run Elgg properly on the server.

sudo apt install apache2 mysql-server php php-mysql php-xml php-mbstring php-zip php-gd php-curl php-json php-cli -y

After installing MySQL, you need to secure it by running the following security script, which will allow you to set up a root password and remove anonymous users.

sudo mysql_secure_installation

Next, we need to set up a MySQL database and user for Elgg.

sudo mysql -u root -p
CREATE DATABASE elgg_db;
CREATE USER 'your_username'@'localhost' IDENTIFIED BY 'your_password';
GRANT ALL PRIVILEGES ON elgg_db.* TO 'your_username'@'localhost';
FLUSH PRIVILEGES;
EXIT;

Step 2: Installing Elgg in Ubuntu

Now let’s download the latest version from the official Elgg download page or use the following wget command to download directly in the Apache web root directory.

cd /var/www/html/
wget https://elgg.org/download/elgg-6.0.5.zip

After downloading, unzip the file and rename the unzipped folder to the elgg directory:

sudo unzip elgg-6.0.5.zip
sudo mv elgg-6.0.5 elgg

Set the correct permissions for the Elgg directory to function correctly.

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

Step 3: Configure Apache for Elgg

Create a new Apache configuration file to serve the Elgg application.

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

Add the following configuration into the file (replace example.com with your actual domain):

<VirtualHost *:80>
    ServerAdmin [email protected]
    DocumentRoot /var/www/html/elgg
    ServerName example.com
    <Directory /var/www/html/elgg>
        Options Indexes FollowSymLinks MultiViews
        AllowOverride All
        Require all granted
    </Directory>
    ErrorLog ${APACHE_LOG_DIR}/error.log
    CustomLog ${APACHE_LOG_DIR}/access.log combined
</VirtualHost>

Next, you need to enable the new site, and required modules and restart the Apache service to apply changes:

sudo a2ensite elgg.conf
sudo a2enmod rewrite
sudo systemctl restart apache2

Step 4: Complete Elgg Installation via Web Interface

Now that everything is set up, open your web browser and navigate to http://localhost/elgg to complete the installation through the web interface.

Elgg Setup Wizard
Elgg Setup Wizard

Once you complete these steps, click on “Go to site” to access your newly installed Elgg platform.

Finish Elgg Setup
Finish Elgg Setup

Step 5: Elgg Post-Installation Setup

After installing Elgg, you should perform a few post-installation tasks:

For security reasons, it’s a good practice to remove the installation directory.

sudo rm -rf /var/www/elgg/installer

To secure your site, you can set up SSL using Let’s Encrypt.

sudo apt install certbot python3-certbot-apache -y
sudo certbot --apache

Follow the prompts to secure your site with SSL.

Now you can access your Elgg site through https by going to your domain name or IP address in your web browser.

https://localhost/elgg

You have successfully installed Elgg on Ubuntu, now you can use this powerful platform to create social networks tailored to your needs. You can now explore its features, customize it further, and start building your online community.

Hey TecMint readers,

Exciting news! Every month, our top blog commenters will have the chance to win fantastic rewards, like free Linux eBooks such as RHCE, RHCSA, LFCS, Learn Linux, and Awk, each worth $20!

Learn more about the contest and stand a chance to win by sharing your thoughts below!

Ravi Saive
I am an experienced GNU/Linux expert and a full-stack software developer with over a decade in the field of Linux and Open Source technologies

Each tutorial at TecMint is created by a team of experienced Linux system administrators so that it meets our high-quality standards.

Join the TecMint Weekly Newsletter (More Than 156,129 Linux Enthusiasts Have Subscribed)
Was this article helpful? Please add a comment or buy me a coffee to show your appreciation.

16 Comments

Leave a Reply
  1. I have already made an social networking site using elgg from xampp on windows 7. Now how to upload it? Please help me.

    Reply
  2. Hi there, First I am not a coder, never tried. So I thought I can try Elgg. I am trying to install elgg on XAMPP, I have Mac. I am receiving some Exception error. I tried MAMP and i receive same error I think its related to Mac permission somewhere. Can anyone please suggest me what to do? I am very upset because I am very new to all this.

    Many thanks in advance.

    Reply
    • @Sonu,

      I don’t think these instructions works on XAMPP with Mac OS, better try on Linux systems, or search for XAMPP related elgg documentation at their official site..

      Reply
  3. Please I need your help. I’m new to elgg and I’m trying to install version 1.21. I have tried several things and yet it does not pass the rewrite test. I’ve looked up the installation guide on elgg but it has not helped too. I’m using a Macbook and running xampp. Thanks

    Reply
  4. I’m getting this error after all the steps.

    Fatal Error.

    An unrecoverable error has occurred and has been logged. Contact the site administrator with the following information:

    Exception #1398146272

    Reply
  5. Hi,

    I tried to install elgg, in a subfolder of my website. I named the subfolder as “ncc” and have extracted all the files from the folder elgg to my subfolder “ncc”.

    When I try to install by going to my url ncc.yourgoal.in/install.php I get an error as mentioned below.

    “Web server
    We think your server is running the Apache web server.

    The rewrite test failed and the most likely cause is that AllowOverride is not set to All for Elgg’s directory. This prevents Apache from processing the .htaccess file which contains the rewrite rules.

    A less likely cause is Apache is configured with an alias for your Elgg directory and you need to set the RewriteBase in your .htaccess. There are further instructions in the .htaccess file in your Elgg directory.”

    I have checked the .htaccess file but couldn’t understand what I have to do there. Please help me on how to install elgg

    Reply
    • In Apache httpd.conf file, change “AllowOverride None” to “AllowOverride All” and restart Apache service, it will fix this issue.

      Reply
  6. Great post! I folloed it step by step and it worked perfectly.

    Just one thing you also have to install php mbstring

    sudo yum install php-mbstring

    Reply

Got Something to Say? Join the Discussion...

Thank you for taking the time to share your thoughts with us. We appreciate your decision to leave a comment and value your contribution to the discussion. It's important to note that we moderate all comments in accordance with our comment policy to ensure a respectful and constructive conversation.

Rest assured that your email address will remain private and will not be published or shared with anyone. We prioritize the privacy and security of our users.