How To Install Elgg on Ubuntu 24.04 LTS

Elgg is an award-winning open-source social networking engine that empowers organizations, educational institutions, and communities to build customized social platforms. With its flexible plugin architecture and robust framework, Elgg provides essential features like user profiles, activity streams, blogs, file sharing, groups, and messaging capabilities. Whether you’re creating an internal collaboration platform for your university, building a professional networking site, or establishing a community hub, Elgg offers the tools you need without vendor lock-in or licensing fees. This comprehensive guide walks you through installing Elgg on Ubuntu 24.04 LTS, covering everything from system requirements to post-installation security hardening.
Prerequisites
Before beginning the Elgg installation process, ensure your environment meets these fundamental requirements. You’ll need a fresh Ubuntu 24.04 LTS server installation with at least 2GB of RAM and 20GB of available storage space for optimal performance. Root or sudo user access is essential for installing packages and configuring system services. While optional, having a domain name pointed to your server’s IP address improves accessibility and enables SSL certificate installation later. Basic familiarity with Linux command line operations will help you navigate the installation steps more efficiently. You should also have SSH access configured to your server for remote administration.
A stable internet connection is required throughout the installation to download packages and dependencies. If you’re deploying Elgg for production use, consider implementing a backup strategy from the outset. Understanding basic firewall concepts will help when configuring UFW security rules. Finally, allocate sufficient time to complete the installation in one session to avoid configuration inconsistencies.
Understanding Elgg System Requirements
Elgg operates on the LAMP stack architecture, requiring Linux, Apache, MySQL, and PHP components working in harmony. The platform requires PHP version 7.0 or higher, though PHP 8.1 or 8.2 is recommended for Ubuntu 24.04 LTS to leverage performance improvements and security enhancements. Your database layer needs MySQL 5.6 or newer, or MariaDB 10.0 and above, providing the relational database foundation for storing user data, content, and configuration settings.
The web server component supports both Apache 2.4 and Nginx, though this guide focuses on Apache for its widespread adoption and excellent documentation. Critical PHP extensions include php-mysql for database connectivity, php-xml for processing XML data structures, php-mbstring for multi-byte string handling, php-zip for archive management, php-gd for image manipulation and thumbnail generation, php-curl for HTTP requests, and php-json for handling JSON-formatted data. These extensions enable Elgg’s full feature set, from media uploads to API interactions. Adequate disk space ensures smooth operation, especially as your social network grows and users upload files, images, and videos.
Step 1: Update Ubuntu System Packages
Keeping your system current is the foundation of server security and stability. Begin by updating the package index, which refreshes the list of available packages and their versions from Ubuntu’s repositories. Open your terminal and execute:
sudo apt update -y
This command synchronizes your local package database with upstream repositories, ensuring you have access to the latest versions. Next, upgrade all installed packages to their newest releases:
sudo apt upgrade -y
The upgrade process may take several minutes depending on your system’s current state and internet connection speed. You’ll see package installation progress as the system downloads and applies updates. If kernel updates are included, you’ll need to reboot your server after completion for changes to take effect. Verify your Ubuntu version matches 24.04 LTS by running lsb_release -a. This verification step confirms you’re working with the correct operating system version, preventing compatibility issues down the line. Regular updates patch security vulnerabilities, fix bugs, and improve system performance, making this step critical before installing any new software.
Step 2: Install Apache Web Server
Apache HTTP Server forms the backbone of your web infrastructure, serving Elgg’s PHP files to visitors. Install Apache using Ubuntu’s package manager:
sudo apt install apache2 -y
The installation process downloads Apache and its dependencies, configuring basic settings automatically. Once installed, start the Apache service and configure it to launch automatically at system boot:
sudo systemctl start apache2
sudo systemctl enable apache2
Verify Apache is running correctly by checking its service status:
sudo systemctl status apache2
You should see “active (running)” in green text, confirming successful initialization. Test Apache functionality by navigating to your server’s IP address in a web browser. You’ll see the default Ubuntu Apache welcome page, indicating the web server is operational. Elgg requires Apache’s mod_rewrite module for clean URLs and proper routing. Enable this essential module:
sudo a2enmod rewrite
The rewrite module processes URL rewrites defined in .htaccess files, transforming user-friendly URLs into server-processable paths. After enabling mod_rewrite, restart Apache to apply the configuration change:
sudo systemctl restart apache2
Apache is now ready to serve dynamic PHP content, providing the web server foundation for your Elgg installation.
Step 3: Install and Configure MySQL Database Server
MySQL serves as Elgg’s data persistence layer, storing everything from user credentials to blog posts and activity streams. Install the MySQL server package:
sudo apt install mysql-server -y
Ubuntu configures MySQL to start automatically after installation. Secure your MySQL installation using the built-in security script that removes dangerous defaults:
sudo mysql_secure_installation
The interactive script guides you through security hardening steps. First, you’ll encounter the VALIDATE PASSWORD component prompt. For production environments, enable this feature to enforce strong password policies. Choose a password validation level (0 for low, 1 for medium, 2 for strong). Next, set a secure root password using a combination of uppercase letters, lowercase letters, numbers, and special characters.
The script then asks whether to remove anonymous users—answer “Yes” to eliminate these security risks. Disallow root login remotely by selecting “Yes,” restricting database administration to local connections only. Remove the test database by confirming “Yes,” as it’s unnecessary and presents potential vulnerabilities. Finally, reload privilege tables to ensure all changes take immediate effect. This comprehensive security configuration protects your database from common attack vectors and unauthorized access attempts.
Step 4: Create Elgg Database and User
Database isolation improves security and manageability by dedicating specific credentials to Elgg. Log into MySQL as the root user:
sudo mysql -u root -p
Enter the root password you configured during the security setup. At the MySQL prompt, create a dedicated database for Elgg:
CREATE DATABASE elgg_db;
This command establishes a separate database namespace for all Elgg tables and data. Next, create a database user with appropriate privileges:
CREATE USER 'elgg_user'@'localhost' IDENTIFIED BY 'YourSecurePassword123!';
Replace “YourSecurePassword123!” with a strong, unique password. Use a password manager to generate and store complex credentials securely. Grant the new user full privileges on the Elgg database:
GRANT ALL PRIVILEGES ON elgg_db.* TO 'elgg_user'@'localhost';
This permission set allows the Elgg application to create tables, insert data, update records, and perform all necessary database operations. Flush the privilege tables to activate the new permissions:
FLUSH PRIVILEGES;
Exit the MySQL prompt by typing:
EXIT;
You’ve successfully configured database isolation, following the principle of least privilege by creating a dedicated user rather than using the root account for application access.
Step 5: Install PHP and Required Extensions
PHP processes Elgg’s server-side logic, generating dynamic content for users. Install PHP along with all required extensions in a single command:
sudo apt install php php-mysql php-xml php-mbstring php-zip php-gd php-curl php-json php-cli libapache2-mod-php -y
Each extension serves a specific purpose in Elgg’s ecosystem. The php-mysql extension provides PDO and mysqli interfaces for database communication. The php-xml extension handles XML parsing and generation for data interchange formats. The php-mbstring extension manages multi-byte character encodings, essential for international character support. The php-zip extension enables archive compression and extraction for file management features.
The php-gd extension powers image manipulation, allowing Elgg to generate thumbnails, resize uploads, and apply image transformations. The php-curl extension facilitates HTTP requests to external APIs and web services. The php-json extension processes JSON-formatted data for modern web APIs. The php-cli package provides command-line PHP execution for administrative scripts. The libapache2-mod-php module integrates PHP processing directly into Apache.
Verify your PHP installation and check the version:
php -v
You should see PHP 8.1 or newer listed. Confirm all required modules loaded correctly:
php -m
This command lists all installed PHP modules. Scan the output to verify mysql, xml, mbstring, zip, gd, curl, and json appear. Restart Apache to activate PHP processing:
sudo systemctl restart apache2
Your server now has a complete LAMP stack configured and ready for Elgg deployment.
Step 6: Download Elgg
Navigate to your web server’s document root directory:
cd /var/www/html
This directory contains files Apache serves to web visitors. Download the latest stable Elgg release using wget. As of October 2025, Elgg 6.3.1 represents the current stable version:
sudo wget https://github.com/Elgg/Elgg/releases/download/6.3.1/elgg-6.3.1.zip
If wget isn’t installed, add it with sudo apt install wget -y. The download typically completes within a minute depending on your connection speed. Install the unzip utility if it’s not already available:
sudo apt install unzip -y
Extract the Elgg archive:
sudo unzip elgg-6.3.1.zip
The extraction process creates a directory named “elgg-6.3.1” containing all Elgg files. Rename the directory for cleaner URLs and easier management:
sudo mv elgg-6.3.1 elgg
Clean up by removing the downloaded zip file to free disk space:
sudo rm elgg-6.3.1.zip
Your Elgg files are now in place at /var/www/html/elgg, ready for permission configuration and installation.
Step 7: Create Elgg Data Directory
Elgg separates its code files from user-uploaded data for security and organizational purposes. The data directory stores user-uploaded files, cached content, and session data. Create this directory outside the web root to prevent direct web access:
sudo mkdir -p /var/www/elgg_data
Placing the data directory outside /var/www/html/elgg prevents visitors from directly accessing uploaded files through URLs, improving security. Set proper ownership for both the Elgg installation and data directories. Apache runs as the www-data user, so these directories must be owned accordingly:
sudo chown -R www-data:www-data /var/www/html/elgg/
sudo chown -R www-data:www-data /var/www/elgg_data/
The -R flag applies ownership recursively to all subdirectories and files. Configure appropriate permissions:
sudo chmod -R 755 /var/www/html/elgg/
sudo chmod -R 755 /var/www/elgg_data/
The 755 permission set allows the owner (www-data) full read, write, and execute access, while group and world users have read and execute permissions only. This configuration balances security with functionality, preventing unauthorized modifications while allowing Apache to serve files and write data.
Step 8: Configure Apache Virtual Host for Elgg
Virtual hosts enable Apache to serve multiple websites from a single server. Create a dedicated virtual host configuration for Elgg:
sudo nano /etc/apache2/sites-available/elgg.conf
Enter the following configuration, replacing “yourdomain.com” with your actual domain name:
<VirtualHost *:80>
ServerAdmin admin@yourdomain.com
ServerName yourdomain.com
ServerAlias www.yourdomain.com
DocumentRoot /var/www/html/elgg
<Directory /var/www/html/elgg>
Options FollowSymLinks
AllowOverride All
Require all granted
</Directory>
ErrorLog ${APACHE_LOG_DIR}/elgg_error.log
CustomLog ${APACHE_LOG_DIR}/elgg_access.log combined
</VirtualHost>
The ServerAdmin directive specifies the administrator’s email for error messages. ServerName defines the primary domain, while ServerAlias handles the www subdomain variant. DocumentRoot points to your Elgg installation directory. The Directory block grants permissions and crucially sets “AllowOverride All,” enabling Elgg’s .htaccess file to function properly for URL rewriting. ErrorLog and CustomLog directives configure logging for troubleshooting.
Save the file by pressing Ctrl+X, then Y, then Enter. Enable the new virtual host:
sudo a2ensite elgg.conf
Optionally disable the default Apache site to prevent conflicts:
sudo a2dissite 000-default.conf
Test your Apache configuration for syntax errors:
sudo apache2ctl configtest
You should see “Syntax OK.” If errors appear, review your virtual host configuration for typos. Restart Apache to activate the new configuration:
sudo systemctl restart apache2
Your virtual host now directs traffic from your domain to the Elgg installation.
Step 9: Configure Firewall (UFW)
UFW (Uncomplicated Firewall) provides straightforward firewall management on Ubuntu. Check UFW’s current status:
sudo ufw status
If inactive, you’ll configure rules before enabling it. Allow Apache traffic through the firewall. The “Apache Full” profile permits both HTTP (port 80) and HTTPS (port 443):
sudo ufw allow 'Apache Full'
Alternatively, specify ports individually:
sudo ufw allow 80/tcp
sudo ufw allow 443/tcp
Critical: Before enabling UFW, allow SSH access to prevent lockout from your server:
sudo ufw allow 22/tcp
Or use the rate-limiting option to mitigate brute-force attacks:
sudo ufw limit ssh
Enable UFW with:
sudo ufw enable
Confirm the action when prompted. Verify your firewall rules:
sudo ufw status numbered
You should see entries for SSH (22), HTTP (80), and HTTPS (443). This firewall configuration protects your server while allowing legitimate web traffic and administrative access.
Step 10: Complete Elgg Web Installation
Open your web browser and navigate to your Elgg installation:
http://yourdomain.com/install.php
Or use your server’s IP address if you haven’t configured a domain. The Elgg installation wizard presents a welcome screen explaining the installation process. Click “Next” to proceed. The requirements check page verifies your server meets all necessary specifications. Review the checklist—all items should display green checkmarks. If any requirements show red X marks, return to previous steps to install missing components.

The database configuration screen requests connection details. Select “MySQL” as the database type. Enter “localhost” for the database server since MySQL runs on the same machine. Input “elgg_db” as the database name, “elgg_user” as the username, and the password you created in Step 4. Leave the database prefix as the default “elgg_” or customize it for multiple installations.
Click “Next” to test the database connection. If errors occur, verify your credentials match those created earlier. The site configuration screen collects information about your Elgg installation. Enter a descriptive site name that reflects your community or organization. Provide a site email address for system notifications and password resets. Confirm the site URL matches your domain or IP address.
Enter the data directory path as /var/www/elgg_data—exactly as created in Step 7. The installer validates this path is writable. The administrator account creation page establishes your initial admin credentials. Choose a memorable username and a strong password. Provide a valid email address for account recovery. This account has full administrative privileges, so protect these credentials carefully.
Review your configuration summary and click “Install” to begin the installation process. Elgg creates database tables, configures settings, and initializes the platform. This process typically completes within one to two minutes. Upon completion, you’ll see a success message. For security, delete the installation file:
sudo rm /var/www/html/elgg/install.php
Navigate to your site’s homepage and log in with your administrator credentials to access your new social networking platform.
Step 11: Post-Installation Configuration
After logging into your Elgg admin dashboard, explore the administration panel accessible from the account menu. The site settings section lets you configure visibility—choose whether your network is public, requires login for viewing content, or remains completely private. Configure email settings to ensure notifications reach users correctly. Navigate to Configure → Settings → Email and verify your server’s email configuration or configure SMTP settings for reliable delivery.
User registration settings control whether new users can self-register or require administrator approval. Access this through Configure → Users → Registration. For private networks, disable public registration and manually create user accounts. The plugins section displays available extensions. Core plugins like blogs, file sharing, groups, and messaging come pre-installed. Explore the plugin library to discover additional functionality such as polls, wikis, events, and analytics tools.
Theme customization options let you modify colors, logos, and layouts to match your brand identity. Upload a custom logo through Configure → Appearance. Configure caching mechanisms to improve performance. Navigate to Configure → Advanced Settings and enable system cache, view cache, and simplecache for significant speed improvements. Set content moderation policies appropriate for your community, establishing clear guidelines for acceptable use and consequences for violations.
Step 12: Secure Elgg Installation
Security hardening protects your social network from vulnerabilities and attacks. You’ve already removed install.php—verify it’s gone by attempting to access it in your browser. Configure PHP security settings by editing the PHP configuration file:
sudo nano /etc/php/8.1/apache2/php.ini
Adjust the version number (8.1) if you installed a different PHP version. Locate and modify these directives for improved security:
expose_php = Off
display_errors = Off
log_errors = On
upload_max_filesize = 50M
post_max_size = 50M
memory_limit = 256M
max_execution_time = 300
Setting expose_php to Off hides PHP version information from HTTP headers. Disabling display_errors prevents sensitive information leakage in production. The upload and post size limits should reflect your storage capacity and user needs. Save the file and restart Apache.
Implement SSL/TLS encryption by installing a Let’s Encrypt certificate. Install Certbot:
sudo apt install certbot python3-certbot-apache -y
Obtain and install a certificate:
sudo certbot --apache -d yourdomain.com -d www.yourdomain.com
Follow the prompts to complete certificate installation. Certbot automatically configures Apache for HTTPS and sets up renewal. Establish a backup strategy to protect against data loss. Create a backup script that exports your MySQL database:
mysqldump -u elgg_user -p elgg_db > /backup/elgg_db_$(date +%Y%m%d).sql
Schedule regular backups using cron jobs. Back up the data directory and Elgg installation files regularly. Implement automated security updates for Ubuntu packages:
sudo apt install unattended-upgrades -y
sudo dpkg-reconfigure --priority=low unattended-upgrades
Monitor log files for suspicious activity:
sudo tail -f /var/log/apache2/elgg_error.log
Keep Elgg updated by checking the official website regularly for security releases and feature updates.
Step 13: Testing Elgg Installation
Thoroughly test your Elgg installation to ensure all components function correctly. Access your site’s homepage and verify the interface loads without errors. Create a test user account through the registration process if enabled, or create one through the admin panel. Log in with the test account to experience the user perspective.
Test core features systematically. Create and publish a blog post, verifying the rich text editor functions properly and posts display correctly. Upload various file types—images, PDFs, documents—to confirm file-sharing capabilities work without errors. Create a test group with different privacy settings (public, private, secret) and verify access controls function as expected. Test the messaging system by sending messages between your admin and test accounts.
Post comments on various content types and verify notifications trigger correctly. Check that email notifications arrive in inboxes, not spam folders. Test the friend connection feature by having accounts follow each other and verifying activity streams update appropriately. Access your site from mobile devices to confirm responsive design functions across screen sizes.
If issues arise, check Apache error logs:
sudo tail -f /var/log/apache2/elgg_error.log
Review Elgg’s system log through the admin panel under Administer → Utilities → System Log for application-level errors. Test performance under load by having multiple users perform actions simultaneously, monitoring server resource usage with htop or similar tools.
Troubleshooting Common Issues
Database connection errors typically indicate incorrect credentials or database server issues. Verify your database name, username, and password match those configured in Step 4. Check MySQL is running with sudo systemctl status mysql. Review database permissions by logging into MySQL and running SHOW GRANTS FOR 'elgg_user'@'localhost';.
PHP extension missing errors appear when required modules aren’t installed or enabled. Verify all extensions are installed by running php -m | grep -E 'mysql|xml|mbstring|zip|gd|curl|json'. Install any missing extensions with apt and restart Apache.
Permission denied errors occur when file ownership or permissions are incorrect. Reset ownership with sudo chown -R www-data:www-data /var/www/html/elgg/ /var/www/elgg_data/ and permissions with sudo chmod -R 755 on both directories. Check the data directory path in Elgg’s admin settings matches your configuration.
Apache .htaccess not working means mod_rewrite isn’t enabled or AllowOverride is restricted. Verify mod_rewrite is active: apache2ctl -M | grep rewrite. Check your virtual host configuration includes AllowOverride All in the Directory block. Restart Apache after changes.
Blank page or white screen of death usually indicates fatal PHP errors. Temporarily enable error display by editing php.ini: display_errors = On and restart Apache. Check error logs for specific error messages. Common causes include memory exhaustion, missing dependencies, or configuration errors.
404 errors for clean URLs suggest rewrite rules aren’t processing correctly. Verify .htaccess exists in your Elgg directory and contains rewrite rules. Confirm mod_rewrite is enabled and AllowOverride permits .htaccess directives. Clear Elgg’s cache through the admin panel.
Upload errors and size limitations relate to PHP configuration. Adjust upload_max_filesize and post_max_size in php.ini to accommodate larger files. Ensure adequate disk space exists in the data directory. Check data directory permissions allow www-data to write files.
Memory exhausted errors occur when PHP processes exceed available memory. Increase memory_limit in php.ini from 256M to 512M or higher depending on your server resources. Monitor memory usage and optimize if your site consistently hits limits.
Slow performance can stem from disabled caching, inefficient queries, or resource constraints. Enable all caching mechanisms in Elgg’s admin panel. Optimize MySQL with proper indexing. Monitor server resources and upgrade if CPU, RAM, or I/O consistently max out. Consider implementing Redis or Memcached for session storage and object caching.
Optimizing Elgg Performance
Enable Elgg’s built-in caching system through the admin panel under Configure → Advanced Settings. Activate system cache, view cache, and simplecache to reduce database queries and file system operations. Configure PHP’s OPcache for bytecode caching by editing php.ini:
opcache.enable=1
opcache.memory_consumption=128
opcache.max_accelerated_files=10000
opcache.revalidate_freq=2
For advanced setups, implement Redis or Memcached for distributed caching and session storage. Install Redis:
sudo apt install redis-server php-redis -y
Configure Elgg to use Redis through plugin settings. Optimize MySQL by running periodic maintenance. Connect to MySQL and optimize tables:
OPTIMIZE TABLE elgg_entities, elgg_metadata, elgg_annotations;
Enable MySQL slow query logging to identify bottlenecks. Configure Apache’s Multi-Processing Module (MPM) for better resource utilization. The event MPM provides excellent performance for modern systems. Consider implementing a Content Delivery Network (CDN) for static assets like images, CSS, and JavaScript. Services like Cloudflare provide free CDN functionality with additional security benefits.
Optimize images before upload by compressing them to reduce bandwidth and storage requirements. Implement lazy loading for images and media to improve initial page load times. Monitor server resources regularly using tools like htop, iotop, and vmstat to identify resource constraints before they impact performance.
Maintaining and Updating Elgg
Check for Elgg updates regularly by visiting elgg.org or subscribing to the security mailing list. Security updates address vulnerabilities and should be applied promptly. Before updating, always create complete backups of your database and files. Test updates on a staging environment that mirrors your production setup to identify potential issues before they affect users.
To update Elgg, download the latest version and extract it to a temporary location. Backup your current installation completely. Replace Elgg files while preserving your data directory and settings.php file. Access your site and follow any upgrade prompts to update database schemas. Verify plugin compatibility after updates—some plugins may require updates to work with newer Elgg versions.
Maintain your Ubuntu system with regular updates. Schedule monthly maintenance windows for applying system updates and security patches. Implement automated database optimization scheduled during low-traffic periods. Configure log rotation to prevent log files from consuming excessive disk space. Ubuntu’s logrotate handles most logs automatically, but verify Elgg logs are included.
Join the Elgg community through their official forums, GitHub repository, and documentation site. The community provides support, shares best practices, and announces security updates. Monitor your site’s health through uptime monitoring services and configure alerts for downtime or performance degradation.
Congratulations! You have successfully installed Elgg. Thanks for using this tutorial for installing Elgg open source community platform on Ubuntu 24.04 LTS system. For additional help or useful information, we recommend you check the official Elgg website.