How To Install Moodle on Fedora 42
Moodle stands as the world’s most popular open-source Learning Management System, empowering educators and organizations to deliver engaging online education. Fedora 42, released in April 2025 with GNOME 48 and Linux Kernel 6.14, provides a cutting-edge platform for hosting robust e-learning environments. This comprehensive guide walks through every step needed to successfully deploy Moodle on Fedora 42, from initial system preparation to post-installation optimization.
Installing Moodle on Fedora 42 requires careful configuration of the LAMP stack, proper security settings, and attention to performance optimization. Whether setting up a small institutional portal or planning a large-scale deployment, this tutorial provides the foundation for a secure, high-performance Moodle installation.
Prerequisites and System Requirements
Hardware Requirements
Modern Moodle installations demand adequate system resources to ensure smooth operation. A dual-core processor running at 2 GHz represents the absolute minimum, though production environments benefit significantly from quad-core configurations. RAM allocation proves critical—4 GB serves as the baseline, while 8 GB or more ensures optimal performance under concurrent user loads.
Storage planning requires foresight. Start with 20 GB minimum for the base installation, but factor in substantial growth as course materials, user files, and backups accumulate over time. Production systems serving hundreds of users typically require several hundred gigabytes to maintain adequate headroom.
Software Requirements
Fedora 42 ships with updated package repositories perfectly suited for Moodle 5.0 deployment. The installation requires PHP 8.2 or higher, MariaDB 10.11+ or MySQL 8.4+, and Apache 2.4. Essential PHP extensions include mysqlnd, gd, intl, mbstring, xml, zip, curl, soap, xmlrpc, json, opcache, and sodium.
Administrative access through sudo privileges enables the necessary system configurations. An active internet connection facilitates package downloads and future updates. Basic familiarity with Linux command-line operations, text editors like nano or vi, and fundamental networking concepts streamlines the installation process.
Step 1: Update Fedora 42 System
System updates form the foundation of secure server operations. Fedora 42 introduces DNF5 as the default package manager, bringing significant performance improvements over previous versions.
Execute the system update command:
sudo dnf update
This command refreshes package repositories and upgrades all installed software to their latest versions. The update process typically completes within minutes, depending on internet speed and the number of outdated packages.
Check if kernel updates require a reboot:
sudo needs-restarting -r
Reboot the system if kernel updates were applied to ensure the latest security patches take effect. A fresh start guarantees optimal performance for the subsequent installation steps.
Step 2: Install and Configure Apache Web Server
Apache serves as the web server foundation for Moodle. Installing httpd on Fedora 42 provides the necessary infrastructure for serving web content.
Install Apache:
sudo dnf install httpd
Start and enable Apache to launch automatically at system boot:
sudo systemctl start httpd
sudo systemctl enable httpd
Verify Apache runs correctly:
sudo systemctl status httpd
The firewall blocks web traffic by default. Configure firewalld to permit HTTP and HTTPS connections:
sudo firewall-cmd --permanent --add-service=http
sudo firewall-cmd --permanent --add-service=https
sudo firewall-cmd --reload
Test the installation by accessing the server’s IP address through a web browser. The default Apache test page confirms successful installation. Apache’s modular architecture supports future enhancements like SSL certificates and performance optimizations.
Step 3: Install PHP and Required Extensions
Moodle 5.0 requires PHP 8.2 or newer to leverage modern performance features and security enhancements. Fedora 42 repositories include compatible PHP versions ready for immediate deployment.
Install PHP with all required extensions:
sudo dnf install php php-mysqlnd php-gd php-intl php-mbstring php-xml php-zip php-curl php-soap php-xmlrpc php-json php-opcache php-sodium php-cli php-common
Each extension serves specific purposes: php-mysqlnd enables database connectivity, php-gd handles image processing, php-intl provides internationalization support, and php-opcache dramatically improves performance through bytecode caching.
Verify the PHP installation:
php -v
Configure critical PHP settings by editing php.ini:
sudo nano /etc/php.ini
Locate and modify these parameters:
max_input_vars = 5000
upload_max_filesize = 128M
post_max_size = 128M
memory_limit = 256M
max_execution_time = 300
These adjustments prevent timeout errors during large file uploads and complex course operations. Restart Apache to load the PHP modules:
sudo systemctl restart httpd
Step 4: Install and Configure Database Server (MariaDB)
MariaDB provides the relational database backend where Moodle stores all course data, user information, and system configurations. This open-source MySQL fork offers excellent performance and reliability.
Install MariaDB server:
sudo dnf install mariadb-server
Start and enable MariaDB:
sudo systemctl start mariadb
sudo systemctl enable mariadb
Secure the installation by running the security script:
sudo mysql_secure_installation
Answer the prompts: set a strong root password, remove anonymous users, disallow remote root login, remove test databases, and reload privilege tables. These security measures protect against unauthorized access.
Log into MariaDB to create the Moodle database:
sudo mysql -u root -p
Execute these SQL commands:
CREATE DATABASE moodledb DEFAULT CHARACTER SET utf8mb4 COLLATE utf8mb4_unicode_ci;
CREATE USER 'moodle_user'@'localhost' IDENTIFIED BY 'StrongPassword123!';
GRANT ALL PRIVILEGES ON moodle.* TO 'moodle_user'@'localhost';
FLUSH PRIVILEGES;
EXIT;
The utf8mb4 character set supports full Unicode, including emojis and special characters commonly used in modern educational content. Replace ‘StrongPassword123!’ with a secure password combining letters, numbers, and special characters.
Step 5: Download and Extract Moodle
Obtaining Moodle through Git provides the easiest upgrade path for future versions. The Git method maintains version control and simplifies applying security patches.
Navigate to the web root directory:
cd /var/www
Clone the Moodle repository:
sudo git clone -b MOODLE_503_STABLE git://git.moodle.org/moodle.git
This command downloads Moodle 5.0.3, the latest stable release as of October 2025. The branch parameter ensures the stable version rather than development code.
Alternatively, download using wget:
wget https://download.moodle.org/download.php/stable501/moodle-latest-501.tgz
tar -xzf moodle-latest-501.tgz -C /var/www/
The extraction creates a moodle directory containing the complete application structure. This directory serves as the web-accessible root for the Moodle installation.
Step 6: Create Moodle Data Directory
Moodle stores uploaded files, session data, and cached content in a dedicated data directory. Security best practices mandate placing this directory outside the web root to prevent direct browser access.
Create the moodledata directory:
sudo mkdir /var/www/moodledata
This location remains inaccessible through web requests while maintaining fast local access for the application. The data directory grows substantially over time as users upload course materials and assignments.
Set appropriate ownership:
sudo chown -R apache:apache /var/www/moodledata
Configure permissions:
sudo chmod -R 755 /var/www/moodledata
These permissions allow Apache to read, write, and execute while restricting access from other users. Proper directory security prevents unauthorized access to user files and system data.
Step 7: Set File Permissions and Ownership
Correct permissions prove critical for both security and functionality. Fedora 42’s SELinux enforcement adds additional security layers requiring specific configuration.
Set ownership for the Moodle directory:
sudo chown -R apache:apache /var/www/moodle
Configure directory and file permissions:
sudo chmod -R 755 /var/www/moodle
For systems with SELinux enabled, configure the security context:
sudo semanage fcontext -a -t httpd_sys_rw_content_t '/var/www/moodle(/.*)?'
sudo restorecon -Rv /var/www/moodle
sudo semanage fcontext -a -t httpd_sys_rw_content_t '/var/www/moodledata(/.*)?'
sudo restorecon -Rv /var/www/moodledata
These commands grant Apache appropriate SELinux permissions to read and write files. Enable network connections for Apache:
sudo setsebool -P httpd_can_network_connect on
This boolean allows Moodle to connect to external services and APIs. SELinux troubleshooting requires checking audit logs if permission errors occur after installation.
Step 8: Configure Apache for Moodle
Virtual host configuration directs Apache to serve Moodle content correctly. Proper configuration ensures clean URLs and optimal security settings.
Create a new virtual host file:
sudo nano /etc/httpd/conf.d/moodle.conf
Add this configuration:
<VirtualHost *:80>
ServerAdmin admin@yourdomain.com
ServerName yourdomain.com
ServerAlias www.yourdomain.com
DocumentRoot /var/www/moodle
<Directory /var/www/moodle>
Options -Indexes +FollowSymLinks
AllowOverride All
Require all granted
</Directory>
ErrorLog /var/log/httpd/moodle-error.log
CustomLog /var/log/httpd/moodle-access.log combined
</VirtualHost>
Replace yourdomain.com with the actual domain or server IP address. The configuration disables directory listing for security while enabling .htaccess overrides.
Test the Apache configuration:
sudo apachectl configtest
Restart Apache to apply changes:
sudo systemctl restart httpd
SSL configuration using Let’s Encrypt certificates adds encryption for production environments. Free certificates protect user data during transmission and improve search engine rankings.
Step 9: Run Moodle Installation Through Web Interface
The web-based installer completes the final configuration steps. This interactive process validates system requirements and creates necessary database tables.
Open a web browser and navigate to the server’s domain or IP address. The Moodle installation wizard appears automatically for new installations. Select the preferred installation language from the dropdown menu.
Confirm the directory paths:
- Web address:
http://yourdomain.com
- Moodle directory:
/var/www/moodle
- Data directory:
/var/www/moodledata
Click Next to proceed to database configuration. Select “MariaDB” as the database driver. Enter the database details:
- Host: localhost
- Database name: moodledb
- Database user: moodle_user
- Database password: [your password]
- Tables prefix: mdl_
The tables prefix allows multiple Moodle installations to share a single database if needed. Accept the license agreement and review environment checks.
Moodle validates the server environment, checking PHP extensions, directory permissions, and configuration settings. Address any warnings or errors before proceeding. The installer then creates database tables—this process takes several minutes depending on server performance.
Step 10: Complete Initial Moodle Configuration
Administrator account creation establishes the primary system management account. Choose a strong username that doesn’t reveal administrative privileges.
Complete the administrator profile form with valid information:
- Username: Choose something secure, not “admin”
- Password: Use a complex password with mixed characters
- Email: Provide a working email address for notifications
- First name and Last name: Full administrative contact details
Configure basic site settings:
- Full site name: The official name appearing throughout the platform
- Short site name: Abbreviated version for mobile and emails
- Front page summary: Welcome message for users
Set timezone to match the primary user base location. Language defaults affect new user accounts but users can change their personal preferences. Email configuration enables notifications, password resets, and course communications.
Step 11: Configure Cron Job for Moodle
Moodle’s cron job handles essential background tasks including sending notifications, processing forum subscriptions, executing scheduled tasks, and performing cleanup operations. Running cron every minute ensures timely task execution.
Create a cron job for the Apache user:
sudo crontab -u apache -e
Add this line:
* * * * * /usr/bin/php /var/www/moodle/admin/cli/cron.php > /dev/null 2>&1
This configuration runs the Moodle cron script every minute without generating email output. Verify cron execution by checking Moodle’s site administration dashboard.
Test cron manually:
sudo -u apache /usr/bin/php /var/www/moodle/admin/cli/cron.php
Successful execution displays task completion messages. Monitor initial cron runs to ensure proper functionality. Cron logs appear in Moodle’s site administration under Reports > Logs.
Step 12: Post-Installation Security Hardening
Security hardening protects the Moodle installation from common vulnerabilities and attacks. Multiple layers of security create defense in depth.
Remove write permissions from config.php after installation completes:
sudo chmod 444 /var/www/moodle/config.php
This prevents unauthorized modification of critical configuration. Install and configure fail2ban to prevent brute force attacks:
sudo dnf install fail2ban
sudo systemctl enable fail2ban
sudo systemctl start fail2ban
Create a custom fail2ban filter for Moodle login attempts. Configure HTTPS using Let’s Encrypt certificates:
sudo dnf install certbot python3-certbot-apache
sudo certbot --apache -d yourdomain.com
SSL encryption protects sensitive data during transmission. Regular backup strategies ensure data recovery capabilities. Implement automated backups of both the moodle directory and database:
sudo cp -r /var/www/moodle /backup/moodle-$(date +%Y%m%d)
sudo mysqldump -u root -p moodle > /backup/moodle-db-$(date +%Y%m%d).sql
Schedule these commands through cron for automated daily backups.
Step 13: Install Additional PHP Extensions (Optional)
Performance-enhancing extensions accelerate page loads and improve user experience. Optional extensions support advanced features and scalability.
Install Redis for caching:
sudo dnf install redis php-redis
sudo systemctl start redis
sudo systemctl enable redis
Redis dramatically improves performance through session storage and application caching. Configure Moodle to use Redis through Site Administration > Plugins > Caching > Configuration.
Install APCu for opcode caching:
sudo dnf install php-apcu
Opcode caching eliminates repeated PHP compilation, reducing server load significantly. LDAP extensions enable directory integration for enterprise authentication:
sudo dnf install php-ldap
Restart Apache after installing new extensions.
Step 14: Performance Optimization Tips
Optimizing Moodle performance ensures responsive page loads even under heavy concurrent usage. Multiple optimization strategies compound their effects.
Enable and configure OPcache settings in php.ini:
opcache.enable=1
opcache.memory_consumption=256
opcache.interned_strings_buffer=16
opcache.max_accelerated_files=10000
These settings cache compiled PHP code in memory. Configure Moodle’s cache stores through Site Administration > Plugins > Caching > Configuration. Select Redis or Memcached for application and session caches rather than file-based storage.
Database optimization includes regular cleanup of old logs and temporary data. Adjust MariaDB configuration in /etc/my.cnf.d/server.cnf:
[mysqld]
innodb_buffer_pool_size = 2G
query_cache_size = 64M
max_connections = 200
Buffer pool size should equal approximately 70% of available RAM for dedicated database servers. Content Delivery Networks offload static content delivery, reducing server load for images, CSS, and JavaScript.
Troubleshooting Common Installation Issues
Database Connection Errors
Database connection failures typically stem from incorrect credentials or service status issues. Verify MariaDB runs properly:
sudo systemctl status mariadb
Test database connectivity manually:
mysql -u moodleuser -p moodle
Check config.php contains accurate database parameters. Firewall rules blocking MySQL port 3306 prevent connections between distributed services.
PHP Extension Missing Errors
Missing PHP extensions cause installation failures or feature limitations. The Moodle environment check identifies missing packages. Install missing extensions through dnf:
sudo dnf search php-
This command lists available PHP packages. Install required extensions and restart Apache to load them.
Permission Denied Errors
Permission errors frequently result from incorrect ownership or SELinux policies. Check file ownership:
ls -la /var/www/moodle
Files should belong to apache:apache. Review SELinux audit logs:
sudo ausearch -m AVC -ts recent
SELinux denials require context adjustments or boolean changes. Temporarily set SELinux to permissive mode for troubleshooting:
sudo setenforce 0
Restore enforcing mode after identifying and fixing the issue.
White Screen or 500 Errors
Server errors indicate PHP configuration problems or fatal application errors. Examine Apache error logs:
sudo tail -f /var/log/httpd/error_log
Enable PHP error display temporarily by editing php.ini:
display_errors = On
error_reporting = E_ALL
Remember to disable error display in production environments. Check memory limits and execution timeouts handle resource-intensive operations.
Verifying Successful Installation
Confirming proper installation prevents discovering issues during critical operations. Access the Moodle site through a web browser and log in with administrator credentials.
Navigate to Site Administration > Notifications to check for system messages. No notifications indicate proper configuration. Run environment checks under Site Administration > Server > Environment.
All checks should display green status indicators. Verify cron execution through Site Administration > Reports > Task logs. Recent task completion confirms proper scheduling.
Test basic functionality by creating a test course, uploading a file, and enrolling a test user. Successful operations validate core Moodle features work correctly.
Next Steps After Installation
Post-installation configuration customizes Moodle for specific organizational needs. Install themes from the Moodle plugins directory to match institutional branding. Navigate to Site Administration > Plugins > Install plugins to browse available extensions.
Configure authentication methods under Site Administration > Plugins > Authentication. Options include manual accounts, email-based self-registration, LDAP directory integration, and OAuth providers. Set up course categories to organize educational content logically.
Enable and configure email notifications through Site Administration > Messaging. Establish regular backup schedules under Site Administration > Courses > Backups. Automated backups protect against data loss from hardware failures or user errors.
Join the Moodle community forums to access extensive knowledge bases and peer support. The Moodle documentation provides comprehensive guidance for advanced features. Plan a maintenance schedule for security updates, plugin upgrades, and database optimization.
Congratulations! You have successfully installed Moodle. Thanks for using this tutorial for installing Moodle Learning Platform or course management system on Fedora 42 Linux system. For additional help or useful information, we recommend you check the official Moodle website.