{"id":5267,"date":"2018-07-05T20:17:32","date_gmt":"2018-07-05T16:17:32","guid":{"rendered":"https:\/\/www.howtoforge.com\/tutorial\/debian-elgg-social-network-installation\/"},"modified":"2018-07-05T20:17:32","modified_gmt":"2018-07-05T16:17:32","slug":"create-an-online-social-network-with-elgg-on-debian-9","status":"publish","type":"post","link":"https:\/\/afaghhosting.net\/blog\/create-an-online-social-network-with-elgg-on-debian-9\/","title":{"rendered":"Create an Online Social Network with Elgg on Debian 9"},"content":{"rendered":"<p>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.<\/p>\n<p>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.\u00a0 It also has built-in features that can power file sharing, blogging, social groups or educational platforms on public or private networks.<\/p>\n<p><strong\/>In order to successfully deploy the Elgg platform on your premises, you will need to meet the following requirements.<\/p>\n<ul>\n<li>A virtual machine or a virtual private server powered by Debian 9, preferably minimal installation<\/li>\n<li>Direct access to root account or a local user with root powers via server console or remote management via SSH<\/li>\n<li>The server needs a static IP address configured for the external network interface in order to access via its public IP address to visitors<\/li>\n<li>You might also need a public or private domain name configured for your server so visitors can access the platform via a domain name, such as www.yourdomain.com, although you can still access the platform via your server IP address.<\/li>\n<li>In order to use Elgg website registration via e-mail address, or use other platform features, you need to deploy a mail server at your premises or use a public mail server.<\/li>\n<\/ul>\n<h2 id=\"prerequirements\">Pre-Requirements<\/h2>\n<p>As the first step, login to the Debian 9 server with root privileges or with a user having\u00a0root powers and issue the following\u00a0command in order to update your system with the latest security patches, software and kernel updates.<\/p>\n<p class=\"command\">apt update<\/p>\n<p class=\"command\">apt upgrade<\/p>\n<p>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.<\/p>\n<p class=\"command\">hostnamectl set-hostname www.socialnet.org<\/p>\n<p>After you\u2019ve configured the machine hostname, verify if the host has been properly configured by checking the hosts file with the following\u00a0commands.<\/p>\n<p class=\"command\">hostnamectl<\/p>\n<p class=\"command\">cat \/etc\/hostname<\/p>\n<p class=\"command\">hostname \u2013s<\/p>\n<p class=\"command\">hostname \u2013f<\/p>\n<p>Finally, in order to apply machine hostname and kernel updates, reboot the system by issuing the following command.<\/p>\n<p class=\"command\">systemctl reboot<\/p>\n<p>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<\/p>\n<p class=\"command\">apt install wget zip unzip curl<\/p>\n<h2 id=\"install-lamp-stack\">Install LAMP Stack<\/h2>\n<p>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\u2019ll install is the database &#8211; MariaDB &#8211; 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.<\/p>\n<p class=\"command\">apt install mariadb-server mariadb-client<\/p>\n<p>After the database installation completes, log in to the MySQL console and issue the following\u00a0commands in order to secure database root account, which can be accessed by default without supplying a password.<\/p>\n<p class=\"command\">mysql -h localhost<\/p>\n<pre readability=\"14\">Welcome to the MariaDB monitor.\u00a0 Commands end with ; or \\g.<p>Your MariaDB connection id is 2<\/p><p>Server version: 10.1.26-MariaDB-0+deb9u1 Debian 9.1<\/p><p>Copyright (c) 2000, 2017, Oracle, MariaDB Corporation Ab and others.<\/p><p>Type 'help;' or '\\h' for help. Type '\\c' to clear the current input statement.<\/p><\/pre>\n<p class=\"system command\">MariaDB [(none)]&gt; use mysql;<\/p>\n<pre readability=\"5\">Reading table information for completion of table and column names<p>You can turn off this feature to get a quicker startup with -A<\/p><p>Database changed<\/p><\/pre>\n<p class=\"system command\">MariaDB [mysql]&gt; update user set plugin=&#8221; where user=&#8217;root&#8217;;<\/p>\n<pre readability=\"5\">Query OK, 1 row affected (0.00 sec)<p>Rows matched: 1\u00a0 Changed: 1\u00a0 Warnings: 0<\/p><\/pre>\n<p class=\"system command\">MariaDB [mysql]&gt; flush privileges;<\/p>\n<pre class=\"system\">Query OK, 0 rows affected (0.00 sec)<\/pre>\n<p class=\"system command\">MariaDB [mysql]&gt; exit<\/p>\n<pre class=\"system\">Bye<\/pre>\n<p>After you\u2019ve completed the above step, execute the\u00a0<strong>mysql_secure_installation<\/strong>\u00a0script provided by Debian stretch repositories, in order to further secure MariaDB server and set up a strong password for database root account. Mainly, answer \u201cyes\u201d 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.<\/p>\n<p class=\"command\">mysql_secure_installation<\/p>\n<pre readability=\"83\">NOTE: RUNNING ALL PARTS OF THIS SCRIPT IS RECOMMENDED FOR ALL MariaDB<p>\u00a0\u00a0\u00a0\u00a0\u00a0 SERVERS IN PRODUCTION USE!\u00a0 PLEASE READ EACH STEP CAREFULLY!<\/p><p>In order to log into MariaDB to secure it, we'll need the current<\/p><p>password for the root user.\u00a0 If you've just installed MariaDB, and<\/p><p>you haven't set the root password yet, the password will be blank,<\/p><p>so you should just press enter here.<\/p><p>Enter current password for root (enter for none):<\/p><p>OK, successfully used password, moving on...<\/p><p>Setting the root password ensures that nobody can log into the MariaDB<\/p><p>root user without the proper authorisation.<\/p><p>You already have a root password set, so you can safely answer 'n'.<\/p><p>Change the root password? [Y\/n] y<\/p><p>New password:<\/p><p>Re-enter new password:<\/p><p>Password updated successfully!<\/p><p>Reloading privilege tables..<\/p><p>\u00a0... Success!<\/p><p>By default, a MariaDB installation has an anonymous user, allowing anyone<\/p><p>to log into MariaDB without having to have a user account created for<\/p><p>them.\u00a0 This is intended only for testing, and to make the installation<\/p><p>go a bit smoother.\u00a0 You should remove them before moving into a<\/p><p>production environment.<\/p><p>Remove anonymous users? [Y\/n] y<\/p><p>\u00a0... Success!<\/p><p>Normally, root should only be allowed to connect from 'localhost'.\u00a0 This<\/p><p>ensures that someone cannot guess at the root password from the network.<\/p><p>Disallow root login remotely? [Y\/n] y<\/p><p>\u00a0... Success!<\/p><p>By default, MariaDB comes with a database named 'test' that anyone can<\/p><p>access.\u00a0 This is also intended only for testing, and should be removed<\/p><p>before moving into a production environment.<\/p><p>Remove test database and access to it? [Y\/n] y<\/p><p>\u00a0- Dropping test database...<\/p><p>\u00a0... Success!<\/p><p>\u00a0- Removing privileges on test database...<\/p><p>\u00a0... Success!<\/p><p>Reloading the privilege tables will ensure that all changes made so far<\/p><p>will take effect immediately.<\/p><p>Reload privilege tables now? [Y\/n] y<\/p><p>\u00a0... Success!<\/p><p>Cleaning up...<\/p><p>All done!\u00a0 If you've completed all of the above steps, your MariaDB<\/p><p>installation should now be secure.<\/p><p>Thanks for using MariaDB!<\/p><\/pre>\n<p>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:<\/p>\n<p class=\"command\">mysql -h localhost -u root<\/p>\n<pre class=\"system\">ERROR 1045 (28000): Access denied for user 'root'@'localhost' (using password: NO)<\/pre>\n<p>If the password is supplied, the login process should be granted to MySQL console, as shown in the command sample:<\/p>\n<p class=\"command\">mysql -h localhost -u root -p<\/p>\n<pre readability=\"16\">Enter password:<p>Welcome to the MariaDB monitor.\u00a0 Commands end with ; or \\g.<\/p><p>Your MariaDB connection id is 15<\/p><p>Server version: 10.1.26-MariaDB-0+deb9u1 Debian 9.1<\/p><p>Copyright (c) 2000, 2017, Oracle, MariaDB Corporation Ab and others.<\/p><p>Type 'help;' or '\\h' for help. Type '\\c' to clear the current input statement.<\/p><p>MariaDB [(none)]&gt; exit<\/p><p>Bye<\/p><\/pre>\n<p>After you\u2019ve installed and secured MariaDB database, it\u2019s 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.<\/p>\n<p class=\"command\">apt install apache2 libapache2-mod-php7.0 php7.0 php7.0-gd php7.0-opcache php7.0-mbstring php7.0-xml php7.0-mysql<\/p>\n<p>Next, open and modify PHP default configuration file by altering the following PHP variables.\u00a0 Open <strong>\/etc\/php\/7.0\/apache2\/php.ini<\/strong> file for editing and change the following lines. initially, make a backup of PHP configuration file.<\/p>\n<p class=\"command\">cp \/etc\/php\/7.0\/apache2\/php.ini{,.backup}<\/p>\n<p class=\"command\">nano \/etc\/php\/7.0\/apache2\/php.ini<\/p>\n<p>Search, edit and change the following variables in <strong>php.ini<\/strong> configuration file:<\/p>\n<pre>file_uploads = On<br\/>default_charset = UTF-8<br\/>memory_limit = 128M<br\/>upload_max_filesize = 100M<br\/>date.timezone = Europe\/London<\/pre>\n<p>Increase <strong>upload_max_file_size<\/strong> variable as suitable in order to support large file attachments for your application. Also, change PHP <strong>timezone<\/strong> setting to your system&#8217;s geographical location by consulting the list of time zones provided by PHP docs at the following link <a href=\"http:\/\/php.net\/manual\/en\/timezones.php\" target=\"_blank\" rel=\"noopener\">http:\/\/php.net\/manual\/en\/timezones.php<\/a><\/p>\n<p>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 <strong><em>[opcache]<\/em><\/strong> statement, as detailed below:<\/p>\n<pre>opcache.enable=1 <br\/>opcache.enable_cli=1 <br\/>opcache.interned_strings_buffer=8 <br\/>opcache.max_accelerated_files=10000 <br\/>opcache.memory_consumption=128 <br\/>opcache.save_comments=1<br\/>opcache.revalidate_freq=1 <\/pre>\n<p>After you\u2019ve made all the above changes, save and close the <strong><em>php.ini<\/em><\/strong> configuration file, restart the Apache web server to apply PHP interpreter changes by issuing the below command.<\/p>\n<p class=\"command\">systemctl restart apache2<\/p>\n<h2 id=\"configure-the-firewall\">Configure the Firewall<\/h2>\n<p>To add the required UFW firewall application rules to allow HTTP traffic to pass through system firewall, issue the following\u00a0commands in the server console.<\/p>\n<p class=\"command\">ufw allow WWW<\/p>\n<p>or<\/p>\n<p class=\"command\">ufw allow 80\/tcp<\/p>\n<p>In case you\u2019re remotely connected to your server via SSH, add the rule below to open SSH port 22 in your firewall.<\/p>\n<p class=\"command\">ufw allow 22\/tcp<\/p>\n<p>If you manage the firewall rules in your Debian server via <strong>iptables<\/strong> 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\u2019re remotely connected to the server via SSH.<\/p>\n<p class=\"command\">apt-get install -y iptables-persistent<\/p>\n<p class=\"command\">iptables -I INPUT -p tcp &#8211;destination-port 80 -j ACCEPT<\/p>\n<p class=\"command\">iptables -I INPUT -p tcp &#8211;destination-port 22 -j ACCEPT<\/p>\n<p class=\"command\">netfilter-persistent save<\/p>\n<p class=\"command\">systemctl restart netfilter-persistent<\/p>\n<p class=\"command\">systemctl status netfilter-persistent<\/p>\n<p class=\"command\">systemctl enable netfilter-persistent.service<\/p>\n<h2 id=\"configure-apache-web-server\">Configure Apache Web Server<\/h2>\n<p>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.<\/p>\n<p class=\"command\">a2enmod rewrite ssl<\/p>\n<p class=\"command\">a2ensite default-ssl.conf<\/p>\n<p>Next, open the Apache default SSL site configuration file for editing with your favorite text editor, and add the following\u00a0URL rewrite rules after <strong><em>DocumentRoot<\/em><\/strong> directive:<\/p>\n<p class=\"command\"><em>nano \/etc\/apache2\/sites-enabled\/default-ssl.conf<\/em><\/p>\n<p>SSL site configuration file excerpt:<\/p>\n<pre>&lt;Directory \/var\/www\/html&gt;<br\/>\u00a0 Options +FollowSymlinks<br\/>\u00a0 AllowOverride All<br\/>\u00a0 Require all granted<br\/>&lt;\/Directory&gt;<\/pre>\n<p>Also, make the change shown below to the VirtualHost line to make it look like what&#8217;s shown in the excerpt that follows:<\/p>\n<pre class=\"command\">&lt;VirtualHost *:443&gt;<\/pre>\n<p>Add the same changes to Apache default configuration file by opening <strong>\/etc\/apache2\/sites-enabled\/000-default.conf<\/strong> file for editing. Insert the following\u00a0lines of code after <strong>DocumentRoot<\/strong> statement as shown in the example below.<\/p>\n<pre>&lt;Directory \/var\/www\/html&gt;<br\/>\u00a0 Options +FollowSymlinks<br\/>\u00a0 AllowOverride All<br\/>\u00a0 Require all granted<br\/>&lt;\/Directory<\/pre>\n<p>Finally, restart Apache daemon to apply all rules configured so far and visit your domain or server IP address via HTTP protocol.<\/p>\n<p class=\"command\">systemctl restart apache2<\/p>\n<p>Because you\u2019re 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.<\/p>\n<p><em><strong>https:\/\/yourdomain.tld<\/strong><\/em><\/p>\n<p><a class=\"fancybox\" id=\"img-Capture\" href=\"https:\/\/www.howtoforge.com\/images\/create_an_online_social_network_with_elgg_on_debian_9\/big\/Capture.PNG\" target=\"_blank\" rel=\"noopener\"><img loading=\"lazy\" decoding=\"async\" src=\"https:\/\/afaghhosting.net\/blog\/wp-content\/uploads\/2018\/07\/create-an-online-social-network-with-elgg-on-debian-9.png\" alt=\"SSL Warning\" width=\"550\" height=\"490\" title=\"\"><\/a><\/p>\n<p><a class=\"fancybox\" id=\"img-Capture1\" href=\"https:\/\/www.howtoforge.com\/images\/create_an_online_social_network_with_elgg_on_debian_9\/big\/Capture1.PNG\" target=\"_blank\" rel=\"noopener\"><img loading=\"lazy\" decoding=\"async\" src=\"https:\/\/afaghhosting.net\/blog\/wp-content\/uploads\/2018\/07\/create-an-online-social-network-with-elgg-on-debian-9-1.png\" alt=\"Apache default page\" width=\"550\" height=\"372\" title=\"\"><\/a><\/p>\n<p>In order to allow HTTPS traffic to pass through the UFW firewall, you should add the following\u00a0rule to allow incoming 443\/TCP traffic by issuing the command below.<\/p>\n<p class=\"command\">ufw allow &#8216;WWW Full&#8217;<\/p>\n<p>or<\/p>\n<p class=\"command\">ufw allow 443\/tcp<\/p>\n<p>If <em>iptables<\/em> 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.<\/p>\n<p class=\"command\">iptables -I INPUT -p tcp &#8211;destination-port 443 -j ACCEPT<\/p>\n<p class=\"command\">netfilter-persistent save<\/p>\n<p class=\"command\">systemctl restart netfilter-persistent<\/p>\n<p class=\"command\">systemctl status netfilter-persistent<\/p>\n<p><strong\/>Finally, create the PHP info file in your web server document root path by executing the following command.<\/p>\n<p class=\"command\">echo &#8216;&lt;?php phpinfo(); ?&gt;&#8217;| tee \/var\/www\/html\/info.php<\/p>\n<p>Visit the PHP info script file by opening a browser at the following URL:<\/p>\n<p><em><strong>https:\/\/yourdomain.tld\/info.php<\/strong><\/em><\/p>\n<p>Verify PHP settings and scroll down to <strong>date<\/strong> configuration to check the PHP timezone configuration.<\/p>\n<p><a class=\"fancybox\" id=\"img-Capture2\" href=\"https:\/\/www.howtoforge.com\/images\/create_an_online_social_network_with_elgg_on_debian_9\/big\/Capture2.PNG\" target=\"_blank\" rel=\"noopener\"><img loading=\"lazy\" decoding=\"async\" src=\"https:\/\/afaghhosting.net\/blog\/wp-content\/uploads\/2018\/07\/create-an-online-social-network-with-elgg-on-debian-9-2.png\" alt=\"PHP date settings\" width=\"550\" height=\"292\" title=\"\"><\/a><\/p>\n<h2 id=\"install-elgg-software\">Install Elgg Software<\/h2>\n<p>In order to deploy the Elgg social network platform in your system, first visit the Elgg official download page at <a href=\"https:\/\/elgg.org\/about\/download\" target=\"_blank\" rel=\"noopener\">https:\/\/elgg.org\/about\/download<\/a>\u00a0 and grab the latest zip package compressed archive by issuing the below command.<\/p>\n<p class=\"command\">wget -O elgg-2.3.5.zip https:\/\/elgg.org\/getelgg.php?forward=elgg-2.3.5.zip<\/p>\n<p class=\"command\">ls<\/p>\n<p>Next, extract the Elgg zip archive file to your current working directory and list the extracted files by issuing the following\u00a0commands.<\/p>\n<p class=\"command\">unzip elgg-2.3.5.zip<\/p>\n<p class=\"command\">ls -al elgg-2.3.5<\/p>\n<p><strong\/>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.<\/p>\n<p class=\"command\">rm \/var\/www\/html\/index.html<\/p>\n<p class=\"command\">rm \/var\/www\/html\/info.php<\/p>\n<p><strong\/>Next, copy all the content of the extracted Elgg directory, including the hidden <em>.htaccess<\/em> file, into your web server document root path by issuing the following command.<\/p>\n<p class=\"command\">cp -rf elgg-2.3.5\/* \/var\/www\/html\/<\/p>\n<p class=\"command\">cp elgg-2.3.5\/.htaccess \/var\/www\/html\/<\/p>\n<p>After you\u2019ve copied Elgg installation files to your domain webroot path, create a directory named <strong>data<\/strong> for Elgg application, one level up your domain webroot, by issuing the following\u00a0command. The data directory will be used by Elgg application to store diverse user related files. This <em>data<\/em> 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.<\/p>\n<p class=\"command\">mkdir\u00a0 \/var\/www\/data<\/p>\n<p class=\"command\">chown www-data:www-data \/var\/www\/data<\/p>\n<p>Next, execute the below commands in order to grant Apache runtime user with full write permissions to the web root path. Use the\u00a0<strong>ls<\/strong> command to list permissions for application\u2019s installed files located in the\u00a0<em>\/var\/www\/html\/<\/em> directory.<\/p>\n<p class=\"command\">chown -R www-data:www-data \/var\/www\/html\/<\/p>\n<p class=\"command\">ls \u2013al \/var\/www\/html\/<\/p>\n<p><strong\/><strong\/>Before beginning with\u00a0the 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.<\/p>\n<p class=\"command\">mysql \u2013u root -p<\/p>\n<pre readability=\"14\">Welcome to the MariaDB monitor.\u00a0 Commands end with ; or \\g.<p>Your MariaDB connection id is 2<\/p><p>Server version: 10.1.26-MariaDB-0+deb9u1 Debian 9.1<\/p><p>Copyright (c) 2000, 2017, Oracle, MariaDB Corporation Ab and others.<\/p><p>Type 'help;' or '\\h' for help. Type '\\c' to clear the current input statement.<\/p><\/pre>\n<p class=\"system command\">MariaDB [(none)]&gt; create database elgg_db;<\/p>\n<pre class=\"system\">Query OK, 1 row affected (0.00 sec) <\/pre>\n<p class=\"system command\">MariaDB [(none)]&gt; grant all privileges on elgg_db.* to &#8216;elgg_user&#8217;@&#8217;localhost&#8217; identified by &#8216;password1234&#8217;;<\/p>\n<pre class=\"system\">Query OK, 0 rows affected (0.00 sec) <\/pre>\n<p class=\"system command\">MariaDB [(none)]&gt; flush privileges;<\/p>\n<pre class=\"system\">Query OK, 0 rows affected (0.00 sec) <\/pre>\n<p class=\"system command\">MariaDB [(none)]&gt; exit<\/p>\n<pre>Bye<em> <br\/><\/em><\/pre>\n<p>Now, let\u2019s proceed with Elgg installation. First open a browser and navigate to your server\u2019s IP address or domain name or server FQDN via HTTPS protocol.<\/p>\n<p><em><strong>https:\/\/yourdomain.tld<\/strong><\/em><\/p>\n<p>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.<\/p>\n<p><a class=\"fancybox\" id=\"img-Capture4\" href=\"https:\/\/www.howtoforge.com\/images\/create_an_online_social_network_with_elgg_on_debian_9\/big\/Capture4.PNG\" target=\"_blank\" rel=\"noopener\"><img loading=\"lazy\" decoding=\"async\" src=\"https:\/\/afaghhosting.net\/blog\/wp-content\/uploads\/2018\/07\/create-an-online-social-network-with-elgg-on-debian-9-3.png\" alt=\"Welcome to Elgg\" width=\"550\" height=\"396\" title=\"\"><\/a><\/p>\n<p>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.<\/p>\n<p><a class=\"fancybox\" id=\"img-Capture5\" href=\"https:\/\/www.howtoforge.com\/images\/create_an_online_social_network_with_elgg_on_debian_9\/big\/Capture5.PNG\" target=\"_blank\" rel=\"noopener\"><img loading=\"lazy\" decoding=\"async\" src=\"https:\/\/afaghhosting.net\/blog\/wp-content\/uploads\/2018\/07\/create-an-online-social-network-with-elgg-on-debian-9-4.png\" alt=\"Elgg Requirements\" width=\"550\" height=\"425\" title=\"\"><\/a><\/p>\n<p>In the next installation screen, configure the MySQL database settings by supplying MySQL database name, server host (use <em>localhost<\/em> 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.<\/p>\n<p><a class=\"fancybox\" id=\"img-Capture6\" href=\"https:\/\/www.howtoforge.com\/images\/create_an_online_social_network_with_elgg_on_debian_9\/big\/Capture6.PNG\" target=\"_blank\" rel=\"noopener\"><img loading=\"lazy\" decoding=\"async\" src=\"https:\/\/afaghhosting.net\/blog\/wp-content\/uploads\/2018\/07\/create-an-online-social-network-with-elgg-on-debian-9-5.png\" alt=\"Database settings\" width=\"550\" height=\"475\" title=\"\"><\/a><\/p>\n<p>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 <strong><em>data<\/em><\/strong> directory. Finally, setup your default website access level for newbies and hit on Next button to continue the installation process.<\/p>\n<p><a class=\"fancybox\" id=\"img-Capture8\" href=\"https:\/\/www.howtoforge.com\/images\/create_an_online_social_network_with_elgg_on_debian_9\/big\/Capture8.PNG\" target=\"_blank\" rel=\"noopener\"><img loading=\"lazy\" decoding=\"async\" src=\"https:\/\/afaghhosting.net\/blog\/wp-content\/uploads\/2018\/07\/create-an-online-social-network-with-elgg-on-debian-9-6.png\" alt=\"Configure site in Elgg\" width=\"550\" height=\"473\" title=\"\"><\/a><\/p>\n<p>Next, create the first admin account for your website, by filling the Display Name field\u00a0with 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.<\/p>\n<p><a class=\"fancybox\" id=\"img-Capture91\" href=\"https:\/\/www.howtoforge.com\/images\/create_an_online_social_network_with_elgg_on_debian_9\/big\/Capture91.PNG\" target=\"_blank\" rel=\"noopener\"><img loading=\"lazy\" decoding=\"async\" src=\"https:\/\/afaghhosting.net\/blog\/wp-content\/uploads\/2018\/07\/create-an-online-social-network-with-elgg-on-debian-9-7.png\" alt=\"Create admin account\" width=\"550\" height=\"454\" title=\"\"><\/a><\/p>\n<p>After the installation process completes, hit on \u201cGo to site\u201d button in order to be redirected to the Elgg admin dashboard.<\/p>\n<p><a class=\"fancybox\" id=\"img-Capture10\" href=\"https:\/\/www.howtoforge.com\/images\/create_an_online_social_network_with_elgg_on_debian_9\/big\/Capture10.PNG\" target=\"_blank\" rel=\"noopener\"><img loading=\"lazy\" decoding=\"async\" src=\"https:\/\/afaghhosting.net\/blog\/wp-content\/uploads\/2018\/07\/create-an-online-social-network-with-elgg-on-debian-9-8.png\" alt=\"Elgg Installation is finished\" width=\"550\" height=\"338\" title=\"\"><\/a><\/p>\n<p>After you\u2019ve been logged in to Elgg dashboard, navigate to Configure -&gt; Plugins menu from right panel and start enabling your required Elgg plugins by hitting on the Activate button for\u00a0the selected plugin.<\/p>\n<p><a class=\"fancybox\" id=\"img-Capture12\" href=\"https:\/\/www.howtoforge.com\/images\/create_an_online_social_network_with_elgg_on_debian_9\/big\/Capture12.PNG\" target=\"_blank\" rel=\"noopener\"><img loading=\"lazy\" decoding=\"async\" src=\"https:\/\/afaghhosting.net\/blog\/wp-content\/uploads\/2018\/07\/create-an-online-social-network-with-elgg-on-debian-9-9.png\" alt=\"Elgg admin panel\" width=\"550\" height=\"410\" title=\"\"><\/a><\/p>\n<p>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.<\/p>\n<p><em><strong>https:\/\/yourdomain.tld<\/strong><\/em><\/p>\n<p><a class=\"fancybox\" id=\"img-Capture13\" href=\"https:\/\/www.howtoforge.com\/images\/create_an_online_social_network_with_elgg_on_debian_9\/big\/Capture13.PNG\" target=\"_blank\" rel=\"noopener\"><img loading=\"lazy\" decoding=\"async\" src=\"https:\/\/afaghhosting.net\/blog\/wp-content\/uploads\/2018\/07\/create-an-online-social-network-with-elgg-on-debian-9-10.png\" alt=\"Elgg Social network\" width=\"550\" height=\"443\" title=\"\"><\/a><\/p>\n<p>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 <em>.htaccess<\/em> file located in your website document root path, by issuing the below command.<\/p>\n<p class=\"command\">nano \/var\/www\/html\/.htaccess<\/p>\n<p>In .htaccess file, search for the\u00a0<strong><em>&lt;IfModule mod_rewrite.c&gt; <\/em><\/strong>line and add the below rules after <strong><em>RewriteEngine On <\/em><\/strong>statement in order to automatically redirect all your domain traffic to HTTPS.<\/p>\n<pre>RewriteEngine On<br\/># Redirect to HTTPS<br\/>RewriteCond %{HTTPS} off<br\/>RewriteRule (.*) https:\/\/%{SERVER_NAME}\/$1 [R,L]<\/pre>\n<p>Here, you can also change some PHP variables for your website. Search for <strong><em>&lt;IfModule mod_php7.c&gt; <\/em><\/strong>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:<\/p>\n<pre># Alter web server PHP settings<br\/>php_value session.use_trans_sid 0<br\/>php_value register_globals 1<br\/>php_value upload_max_filesize 100M<br\/>php_value post_max_size 100M<\/pre>\n<p>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),\u00a0 create a crontab file for with the below configurations.\u00a0 Also, this crontab job must be owned and executed by Apache runtime user.<\/p>\n<p class=\"command\">crontab -u www-data \u2013e<\/p>\n<p>Crontab file excerpt. The cron task output of each job will be discarded to Linux <strong><em>\/dev\/null<\/em><\/strong> blackhole file. Replace the domain name variable (<em>$ELGG<\/em>) used in this script accordingly.<\/p>\n<pre readability=\"12\">GET=\"curl -k\"<br\/>ELGG=\"https:\/\/www.socialnet.org\/\"<p>OUT=\" &gt; \/dev\/null 2&gt;&amp;1\"<\/p><p>* * * * * $GET ${ELGG}cron\/minute\/${OUT}<br\/>*\/5 * * * * $GET ${ELGG}cron\/fiveminute\/${OUT}<br\/>15,30,45,59 * * * * $GET ${ELGG}cron\/fifteenmin\/${OUT}<br\/>30,59 * * * * $GET ${ELGG}cron\/halfhour\/${OUT}<br\/>@hourly $GET ${ELGG}cron\/hourly\/${OUT}<br\/>@daily $GET ${ELGG}cron\/daily\/${OUT}<br\/>@weekly $GET ${ELGG}cron\/weekly\/${OUT}<br\/>@monthly $GET ${ELGG}cron\/monthly\/${OUT}<br\/>@yearly $GET ${ELGG}cron\/yearly\/${OUT}<br\/>@reboot $GET ${ELGG}cron\/reboot\/${OUT}<\/p><\/pre>\n<p>Congratulations! The Elgg social media platform has been successfully installed and configured at your premises in a Debian 9 server. In case you\u2019re 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\u2019s Encrypt CA.<\/p>\n<p>In order to further administer the Elgg application, visit the documentation pages at the following address: \u00a0<a href=\"http:\/\/learn.elgg.org\/en\/stable\/index.html\" target=\"_blank\" rel=\"noopener\">http:\/\/learn.elgg.org\/en\/stable\/index.html<\/a><\/p>\n<div>\n<p><b>Share this page:<\/b><\/p>\n<p>\n<a href=\"https:\/\/www.facebook.com\/sharer.php?u=https%3A%2F%2Fwww.howtoforge.com%2Ftutorial%2Fdebian-elgg-social-network-installation%2F\" target=\"_blank\" rel=\"nofollow noopener noreferrer\"><img decoding=\"async\" src=\"https:\/\/afaghhosting.net\/blog\/wp-content\/uploads\/2018\/07\/create-an-online-social-network-with-elgg-on-debian-9-11.png\" height=\"20\" alt=\"\" title=\"\"><\/a><br \/>\n<a href=\"https:\/\/twitter.com\/intent\/tweet?url=https%3A%2F%2Fwww.howtoforge.com%2Ftutorial%2Fdebian-elgg-social-network-installation%2F&amp;text=Create+an+Online+Social+Network+with+Elgg+on+Debian+9&amp;via=howtoforgecom&amp;related=howtoforgecom\" target=\"_blank\" rel=\"nofollow noopener noreferrer\"><img decoding=\"async\" src=\"https:\/\/afaghhosting.net\/blog\/wp-content\/uploads\/2018\/07\/create-an-online-social-network-with-elgg-on-debian-9-12.png\" height=\"20\" alt=\"\" title=\"\"><\/a><br \/>\n<a href=\"https:\/\/twitter.com\/howtoforgecom\/\" target=\"_blank\" rel=\"nofollow noopener noreferrer\"><img decoding=\"async\" src=\"https:\/\/afaghhosting.net\/blog\/wp-content\/uploads\/2018\/07\/create-an-online-social-network-with-elgg-on-debian-9-13.png\" height=\"20\" alt=\"\" title=\"\"><\/a><br \/>\n<a href=\"https:\/\/plus.google.com\/share?url=https%3A%2F%2Fwww.howtoforge.com%2Ftutorial%2Fdebian-elgg-social-network-installation%2F\" target=\"_blank\" rel=\"nofollow noopener noreferrer\"><img decoding=\"async\" src=\"https:\/\/afaghhosting.net\/blog\/wp-content\/uploads\/2018\/07\/create-an-online-social-network-with-elgg-on-debian-9-14.png\" height=\"20\" alt=\"\" title=\"\"><\/a>\n<\/p>\n<\/div>\n","protected":false},"excerpt":{"rendered":"<p>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 &hellip;<\/p>\n","protected":false},"author":1,"featured_media":0,"comment_status":"closed","ping_status":"closed","sticky":false,"template":"","format":"standard","meta":{"footnotes":""},"categories":[36],"tags":[],"class_list":["post-5267","post","type-post","status-publish","format-standard","hentry","category-36"],"_links":{"self":[{"href":"https:\/\/afaghhosting.net\/blog\/wp-json\/wp\/v2\/posts\/5267","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/afaghhosting.net\/blog\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/afaghhosting.net\/blog\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/afaghhosting.net\/blog\/wp-json\/wp\/v2\/users\/1"}],"replies":[{"embeddable":true,"href":"https:\/\/afaghhosting.net\/blog\/wp-json\/wp\/v2\/comments?post=5267"}],"version-history":[{"count":0,"href":"https:\/\/afaghhosting.net\/blog\/wp-json\/wp\/v2\/posts\/5267\/revisions"}],"wp:attachment":[{"href":"https:\/\/afaghhosting.net\/blog\/wp-json\/wp\/v2\/media?parent=5267"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/afaghhosting.net\/blog\/wp-json\/wp\/v2\/categories?post=5267"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/afaghhosting.net\/blog\/wp-json\/wp\/v2\/tags?post=5267"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}