Alternative content
Elgg is an open source social networking engine that allows the creation of social environments such as campus social networks and internal collaborative platforms for organizations. Elgg offers a number of social networking features including microblogging, messaging, file-sharing and groups. This tutorial will guide you through the process of installing Elgg on a Ubuntu 18.04 VPS.
Elgg requires MySQL, PHP, and a web server. Before you can install Elgg, you will need to install the Apache web server, MySQL, and PHP.
Update the repository list.
apt-get update
Install the Apache web server.
apt-get install apache2 -y
Install MySQL.
apt-get install mysql-server -y
Complete the MySQL installation by executing the following command.
/usr/bin/mysql_secure_installation
During the installation, you will be asked to enter a root password. Enter a secure password. This will be the MySQL root password.
Would you like to setup VALIDATE PASSWORD plugin? [Y/N] N
New password: password
Re-enter new password: password
Remove anonymous users? [Y/N] Y
Disallow root login remotely? [Y/N] Y
Remove test database and access to it? [Y/N] Y
Reload privilege tables now? [Y/N] Y
Install PHP 7.2, as well as the PHP modules required by Elgg.
apt-get install php7.2 libapache2-mod-php7.2 php7.2-common php7.2-sqlite3 php7.2-curl php7.2-intl php7.2-mbstring php7.2-xmlrpc php7.2-mysql php7.2-gd php7.2-xml php7.2-cli php7.2-zip -y
Elgg will require a MySQL database. Log into the MySQL console.
mysql -u root -p
When prompted for a password, enter the MySQL root password you set in step 1. Once you are logged in to the MySQL console, create a new database.
CREATE DATABASE elgg;
Create a new MySQL user and grant it privileges to the newly created database. You can replace username
and password
with the username and password of your choice.
GRANT ALL PRIVILEGES on elgg.* to 'username'@'localhost' identified by 'password';
FLUSH PRIVILEGES;
Exit the MySQL console.
exit
Download the latest version of Elgg.
cd /var/www/html
rm -r index.html
wget https://elgg.org/download/elgg-2.3.7.zip
Unzip the downloaded archive and move the files to the root of the Apache web server.
apt install unzip
unzip elgg-2.3.7.zip
mv ./elgg-2.3.7/* . && rm elgg-2.3.7.zip && rm -r elgg-2.3.7
Create a data directory for Elgg.
sudo mkdir -p /var/www/html/data
Set the appropriate file permissions.
sudo chown -R www-data:www-data /var/www/html/
sudo chmod -R 755 /var/www/html/
Elgg requires the Apache rewrite module. Enable the Apache rewrite module.
sudo a2enmod rewrite
Create an Apache configuration file for the Elgg installation.
sudo nano /etc/apache2/sites-available/elgg.conf
Paste the following snippet to the file, replacing example.com
with your own domain name.
<VirtualHost *:80>
DocumentRoot /var/www/html/
ServerName example.com
<Directory /var/www/html/>
Options FollowSymlinks
AllowOverride All
Require all granted
</Directory>
ErrorLog ${APACHE_LOG_DIR}/error.log
CustomLog ${APACHE_LOG_DIR}/access.log combined
</VirtualHost>
Enable the configuration and restart the Apache server.
sudo a2ensite elgg.conf
sudo systemctl restart apache2.service