Change the “web directory” (called the document root) to /home/username/elgg/html If that doesn’t work change it back to what it was before and re-install elgg but don’t install it into a subdirectory. Elgg is open source social networking software that provides individuals and organizations with the components needed to create an online social environment. It offers blogging, microblogging, file sharing, networking, groups and a number of other features.
![]() ![]() On this page
Elgg is a free, open source and self-hosted social networking application that can be used to create your own social networking website. You can easily create social networks for your university, organization, school and college using Elgg. Elgg is simple, easy to use and highly customizable. You can extend Elgg functionality with built-in plugins and themes.
In this tutorial, we will show you how to install Elgg with Apache web server on Ubuntu 18.04 server.
Requirements
Getting Started
First, update your system with the latest version by running the following command:
Once your system is updated, restart your system to apply the changes.
Install LAMP Server
Elgg is written in PHP and uses MariaDB to store their database. So, you will need to install Apache, PHP and MariaDB server to your system.
You can install all the packages by running the following command:
Once all the packages are installed, open the PHP default configuration file and make some changes:
Make the following changes:
Save and close the file. Then, start Apache and MariaDB service and enable them to start on boot time:
Configure Database
By default, MariaDB is not secure. So, you will need to secure it first. You can secure it by running the following command:
Answer all the questions as shown below:
Once the MariaDB is secured, log in to MariaDB shell:
Enter your root password, then create a database and user for Elgg:
Replace the word 'howtoforge' in the command above with a secure password. Next, grant all the privileges to the Elgg database:
Replace the word 'howtoforge' in the command above with a secure password. Next, flush the privileges and exit from the MariaDB shell:
Install Elgg on Ubuntu
First, download the latest version of Elgg with the following command:
Next, unzip the downloaded file with the following command:
Next, copy the extracted directory to the Apache root directory:
Next, create a data directory for Elgg:
Next, give proper permissions to the Elgg:
Configure Apache for Elgg
Next, create an Apache virtual host file for Elgg with the following command:
add the following lines:
Replace example.com with your domain name. Save and close the file. Then, enable Apache virtual host file with the following command:
Next, enable Apache rewrite module and restart Apache web service with the following command:
Access Elgg Web Interface
Now, open your web browser and type the URL http://example.com. You will be redirected to the following page:
Click on the Next button. You should see the following page:
Once all the Elgg requirements are satisfies. Click on the Next button. You should see the following page:
Provide your database details and click on the Next button. You should see the following page:
Now, provide your site name, data directory '/var/www/html/elgg/data', site URL. Then, click on the Next button. You should see the following page:
Now, provide your admin username and password. Then, click on the Next button. Once the installation has been finished, you should see the following page:
Now, click on the Go to site button. You should see the Elgg dashboard in the following page:
An this is how the Elgg frontend looks like:
Virtual machine image download of this tutorial
This tutorial is available as ready to use virtual machine image in ovf/ova format that is compatible with VMWare and Virtualbox for HowtoForge subscribers. The virtual machine image uses the following login details:
SSH / Shell Login
Username: administrator
Password: howtoforge
This user has sudo rights.
Elgg Login
Username: admin
Password: howtoforge
MySQL Login
Username: root
Password: howtoforge
and
Username: elgg
Password: howtoforge
The IP of the VM is 192.168.1.100, it can be changed in the file /etc/netplan/01-netcfg.yaml. Please change all the above passwords to secure the virtual machine. The Download-Link for the VM is in the menu on the right side, near the top.
LinksOn this page
In this tutorial, I will show you how to install and configure the latest Elgg version on Debian 9 in order to create a free online social network.
Elgg is a free open source social engine framework software written in PHP programming language. The Elgg framework can help individuals or organizations to create powerful social environments in Linux under Apache/Nginx web servers, PHP and MySQL/MariaDB database management system, also known as LAMP or LEMP stack. It also has built-in features that can power file sharing, blogging, social groups or educational platforms on public or private networks.
In order to successfully deploy the Elgg platform on your premises, you will need to meet the following requirements.
Pre-Requirements
As the first step, login to the Debian 9 server with root privileges or with a user having root powers and issue the following command in order to update your system with the latest security patches, software and kernel updates.
Next, make sure you configure the name of your machine by executing the following commands. You should replace the hostname variable used in this example to match your own domain.
After you’ve configured the machine hostname, verify if the host has been properly configured by checking the hosts file with the following commands.
Finally, in order to apply machine hostname and kernel updates, reboot the system by issuing the following command.
After the system reboots, login back to the console and run the following command to install some system utilities that will help us download software over internet and extract some archive files types
Install LAMP Stack
In order to deploy the Elgg social network framework on our server, we need to install the LAMP stack components. The first component that we’ll install is the database - MariaDB - a fork of the popular MySQL database, as database backend. The MariaDB database will be used by the application to store users, sessions, contacts, posts, comments and other information. In order to install MariaDB database server and client software in Debian 9 via the official repositories, issue the command below in terminal.
After the database installation completes, log in to the MySQL console and issue the following commands in order to secure database root account, which can be accessed by default without supplying a password.
MariaDB [(none)]> use mysql;
MariaDB [mysql]> update user set plugin=' where user='root';
MariaDB [mysql]> flush privileges;
MariaDB [mysql]> exit
After you’ve completed the above step, execute the mysql_secure_installation script provided by Debian stretch repositories, in order to further secure MariaDB server and set up a strong password for database root account. Mainly, answer “yes” on all asked questions by the script, such as: to change MySQL root password, to remove anonymous users, to disable remote root logins and delete the test database, as illustrated in the below script excerpt.
In order to test MariaDB security, try logging in to the database from the console with no root password. The access to the database should be denied if no password is provided for the root account, as illustrated in the below command excerpt:
If the password is supplied, the login process should be granted to MySQL console, as shown in the command sample:
After you’ve installed and secured MariaDB database, it’s time to install the next components required to deploy the Elgg application: Apache HTTP server and PHP programming language processing gateway. In order to install Apache web server and the PHP interpreter alongside with all required PHP modules through which the server will execute the application scripts, execute the following command in your server console.
Next, open and modify PHP default configuration file by altering the following PHP variables. Open /etc/php/7.0/apache2/php.ini file for editing and change the following lines. initially, make a backup of PHP configuration file.
Search, edit and change the following variables in php.ini configuration file:
Increase upload_max_file_size variable as suitable in order to support large file attachments for your application. Also, change PHP timezone setting to your system's geographical location by consulting the list of time zones provided by PHP docs at the following link http://php.net/manual/en/timezones.php
Enable OPCache plugin available for PHP7 in order to increase website load speed by appending the following OPCache settings at the bottom of the PHP interpreter configuration file, below the [opcache] statement, as detailed below:
After you’ve made all the above changes, save and close the php.ini configuration file, restart the Apache web server to apply PHP interpreter changes by issuing the below command.
Configure the Firewall
To add the required UFW firewall application rules to allow HTTP traffic to pass through system firewall, issue the following commands in the server console.
or
In case you’re remotely connected to your server via SSH, add the rule below to open SSH port 22 in your firewall.
If you manage the firewall rules in your Debian server via iptables raw rules, add the following rules to allow port 80 and 22 inbound traffic to pass the firewall so that external clients can access the application. Open port 22/TCP only if you’re remotely connected to the server via SSH.
Configure Apache Web Server
On the next step, enable Apache rewrite module required for altering web server configurations on the fly via .htacccess file and the TLS module required to secure HTTP transactions, by issuing the below command.
Next, open the Apache default SSL site configuration file for editing with your favorite text editor, and add the following URL rewrite rules after DocumentRoot directive:
SSL site configuration file excerpt:
Also, make the change shown below to the VirtualHost line to make it look like what's shown in the excerpt that follows:
Add the same changes to Apache default configuration file by opening /etc/apache2/sites-enabled/000-default.conf file for editing. Insert the following lines of code after DocumentRoot statement as shown in the example below.
Finally, restart Apache daemon to apply all rules configured so far and visit your domain or server IP address via HTTP protocol.
Because you’re using the automatically Self-Signed certificates pairs issued by Apache at installation, for a certificate that is untrusted by the browser, an error warning should be displayed in the browser. Accept the warning in order to accept the untrusted certificate and continue to be redirected to Apache default web page, as illustrated in the below image.
https://yourdomain.tld
In order to allow HTTPS traffic to pass through the UFW firewall, you should add the following rule to allow incoming 443/TCP traffic by issuing the command below.
or
If iptables is the default firewall application installed to protect your Debian system at network level, add the following rule to allow port 443 inbound traffic in the firewall so that visitors can browse your domain name.
Finally, create the PHP info file in your web server document root path by executing the following command.
Visit the PHP info script file by opening a browser at the following URL:
https://yourdomain.tld/info.php
Verify PHP settings and scroll down to date configuration to check the PHP timezone configuration.
Install Elgg Software
In order to deploy the Elgg social network platform in your system, first visit the Elgg official download page at https://elgg.org/about/download and grab the latest zip package compressed archive by issuing the below command.
Next, extract the Elgg zip archive file to your current working directory and list the extracted files by issuing the following commands.
On the next step, delete the default index.html file installed by Apache web server to webroot path and the info.php file created earlier by issuing the below commands.
Next, copy all the content of the extracted Elgg directory, including the hidden .htaccess file, into your web server document root path by issuing the following command.
After you’ve copied Elgg installation files to your domain webroot path, create a directory named data for Elgg application, one level up your domain webroot, by issuing the following command. The data directory will be used by Elgg application to store diverse user related files. This data directory can be created anywhere in your server filesystem hierarchy, with the remark that you must grant Apache runtime user the write permissions to this directory.
Next, execute the below commands in order to grant Apache runtime user with full write permissions to the web root path. Use the ls command to list permissions for application’s installed files located in the /var/www/html/ directory.
Before beginning with the installation process via a web browser, log in to the MariaDB database console and create the Elgg database and a user with a password that will be used to manage this database, by issuing the following commands. Make sure you replace the database name, user and password used in this tutorial accordingly.
MariaDB [(none)]> create database elgg_db;
MariaDB [(none)]> grant all privileges on elgg_db.* to 'elgg_user'@'localhost' identified by 'password1234';
MariaDB [(none)]> flush privileges;
MariaDB [(none)]> exit
Now, let’s proceed with Elgg installation. First open a browser and navigate to your server’s IP address or domain name or server FQDN via HTTPS protocol.
https://yourdomain.tld
On the welcome screen, the installer will display an introduction message that informs you that Elgg platform software will require six steps to follow in order to install the application. Just hit on Next button in order to start the installation process, as illustrated in the below screenshot.
Next, the Elgg installer will parse your system and check if PHP and web server requirements are met for installing the application. Hit on Next button, to continue the installation process, as shown in the below screenshot.
In the next installation screen, configure the MySQL database settings by supplying MySQL database name, server host (use localhost if the database is installed on the same node), the database username and the password created earlier for installing Elgg. Use the database table prefix as default or change it if you want to add an extra layer of security for your application. Finally, select your default timezone setting for the application and hit on Next button to move to the next installation screen. Use the below screenshot as a guide to configuring this step.
On the next step, configure the Elgg website by adding a name for the site and an email address for user communication. Also, change the site URL address if it was not correctly detected and add the full path to website data directory. Finally, setup your default website access level for newbies and hit on Next button to continue the installation process.
Next, create the first admin account for your website, by filling the Display Name field with the name of your admin account. Also, add the admin account email address, username and password, as illustrated in the below image. When you complete this step, hit on Next button to continue and finish the installation process.
After the installation process completes, hit on “Go to site” button in order to be redirected to the Elgg admin dashboard.
After you’ve been logged in to Elgg dashboard, navigate to Configure -> Plugins menu from right panel and start enabling your required Elgg plugins by hitting on the Activate button for the selected plugin.
You can also visit Elgg application by navigating to your server IP address or domain name via HTTPS protocol. Use the credentials configured for admin account during the installation process in order to log in to Elgg social engine application, as shown in the below screenshot.
https://yourdomain.tld
As the final step, if you want to force visitors to securely browse the Elgg website via HTTPS protocol that encrypts the traffic between the server and client browsers, return to the Debian server console and edit the .htaccess file located in your website document root path, by issuing the below command.
In .htaccess file, search for the <IfModule mod_rewrite.c> line and add the below rules after RewriteEngine On statement in order to automatically redirect all your domain traffic to HTTPS.
Here, you can also change some PHP variables for your website. Search for <IfModule mod_php7.c> directive and under this line add your own PHP settings such as: increase the file upload size for the domain or disable some server default PHP configurations, as shown in the below excerpt:
In order for the Elgg application to send out queued notifications, rotate system logs in database and collect garbage in the database (compacting the database by removing entries that are no longer required), create a crontab file for with the below configurations. Also, this crontab job must be owned and executed by Apache runtime user.
Crontab file excerpt. The cron task output of each job will be discarded to Linux /dev/null blackhole file. Replace the domain name variable ($ELGG) used in this script accordingly.
Congratulations! The Elgg social media platform has been successfully installed and configured at your premises in a Debian 9 server. In case you’re using a registered public domain name to expose Elgg application to public-facing visitors, you should consider buying an SSL certificate issued by a trusted Certificate Authority or get a free certificate pair from Let’s Encrypt CA.
In order to further administer the Elgg application, visit the documentation pages at the following address: http://learn.elgg.org/en/stable/index.html
![]() Comments are closed.
|
AuthorWrite something about yourself. No need to be fancy, just an overview. Archives
December 2022
Categories |