How to Install Elgg on Alpine Linux Latest

This tutorial will guide you through the steps to install Elgg, a powerful open-source social networking engine, on Alpine Linux, a lightweight and secure operating system.

Prerequisites

Before proceeding with the installation, make sure the following prerequisites are met:

Step 1: Update and Upgrade

First, update the package index and upgrade the existing packages:

sudo apk update && sudo apk upgrade

Step 2: Install Required Packages

Install the required packages for Elgg:

sudo apk add apache2 mariadb mariadb-client php7-apache2 php7-gd php7-intl php7-mysqli php7-opcache php7-zip php7-xmlrpc php7-mbstring php7-json php7-xml php7-curl

Step 3: Download and Extract Elgg

Download the latest stable release of Elgg from the official website. You can use wget to download the package directly to your Alpine Linux machine:

wget https://elgg.org/getelgg.php?forward=elgg-3.3.16.zip -O elgg.zip

Extract the downloaded package to the root directory of your web server:

sudo unzip elgg.zip -d /var/www/localhost/htdocs/

Now, rename the elgg directory to something more meaningful:

sudo mv /var/www/localhost/htdocs/elgg-* /var/www/localhost/htdocs/elgg

Step 4: Configure MariaDB

Start and enable the MariaDB service:

sudo rc-service mariadb start
sudo rc-update add mariadb

Next, secure your database installation by running the mysql_secure_installation script:

sudo mysql_secure_installation

Follow the instructions to set up a new root password, remove anonymous users, disallow root login remotely, and remove the test database.

Create a new database and user for Elgg:

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

Step 5: Configure Apache

Edit the Apache configuration file to enable the necessary modules and set the document root:

sudo nano /etc/apache2/httpd.conf

Add the following lines at the end of the file:

LoadModule rewrite_module modules/mod_rewrite.so
LoadModule php7_module modules/libphp7.so

<Directory "/var/www/localhost/htdocs">
    AllowOverride All
    Order Allow,Deny
    Allow from all
    Require all granted
</Directory>

DocumentRoot "/var/www/localhost/htdocs/elgg"

Save and close the file.

Restart the Apache service to apply the changes:

sudo rc-service apache2 restart

Step 6: Run the Elgg Installation Script

Open your web browser and visit http://localhost/elgg/install.php. Follow the prompts to complete the installation, using the following database credentials:

Once the installation is complete, remove the install.php file for security reasons:

sudo rm /var/www/localhost/htdocs/elgg/install.php

Now you can log in to your Elgg site and start customizing it.

Conclusion

In this tutorial, you learned how to install Elgg on Alpine Linux Latest. You can further enhance your Elgg site by installing additional plugins and themes from the Elgg community site.

If you want to self-host in an easy, hands free way, need an external IP address, or simply want your data in your own hands, give IPv6.rs a try!