How To Install Drupal on Fedora 42
Installing Drupal on Fedora 42 represents one of the most powerful combinations for modern web development. Drupal, powering approximately 2.5% of the world’s websites, stands as a robust, secure, and highly customizable content management system. When paired with Fedora 42’s cutting-edge features and stability, this combination delivers exceptional performance for developers and organizations seeking enterprise-grade web solutions.
This comprehensive guide walks you through every step of installing Drupal on Fedora 42, from initial system preparation to post-installation optimization. Whether you’re a system administrator, web developer, or Linux enthusiast, this tutorial provides the technical depth needed to achieve a successful deployment. The entire process takes approximately 30-45 minutes and results in a fully functional, secure Drupal installation ready for development or production use.
Prerequisites and System Requirements
Hardware Requirements
Before beginning the Drupal installation on Fedora 42, ensure your system meets the minimum hardware specifications. A minimum of 2GB RAM is required, though 4GB or more is strongly recommended for optimal performance during content management and module operations. Your system needs at least 5GB of free storage space to accommodate the operating system, Drupal files, database storage, and future content growth.
Any modern x86_64 processor will sufficiently handle Drupal operations. However, multi-core processors provide better performance when handling concurrent user sessions and complex database queries. SSD storage significantly improves database performance and overall system responsiveness compared to traditional hard drives.
Software Requirements and Dependencies
Fedora 42 serves as an excellent foundation for Drupal installations due to its modern package repositories and robust security features. Your system requires root or sudo access for installing packages and configuring services. A stable internet connection is essential for downloading packages, updates, and Drupal core files.
Familiarity with command-line text editors such as nano, vim, or gedit proves invaluable during configuration file editing. Basic Linux system administration knowledge helps troubleshoot potential issues and customize installations according to specific requirements.
Drupal System Requirements
Drupal’s modern architecture demands specific software versions for optimal security and functionality. PHP 8.1 or higher is mandatory for Drupal 10 installations, providing enhanced performance and security features. The PHP memory limit must be set to at least 64MB, though 512MB is recommended for complex sites with multiple modules.
Apache 2.4.7 or newer serves as the recommended web server, offering robust virtual host support and modern security features. MariaDB 10.3.7 or MySQL 5.7.8 provides the database foundation, with MariaDB being the preferred choice due to its enhanced performance and open-source commitment.
Essential PHP extensions include gd for image processing, xml for XML document handling, mbstring for multibyte string operations, curl for HTTP requests, and opcache for performance optimization. These extensions enable Drupal’s core functionality and support thousands of available modules.
Step 1: Update System and Install Apache Web Server
System Update Process
Begin by updating your Fedora 42 system to ensure all packages are current and security patches are applied. Open a terminal and execute the system update command:
sudo dnf update -y
This command refreshes package repositories and installs available updates. The process may take several minutes depending on your internet connection and the number of pending updates. System updates are crucial for security and compatibility with newly installed software packages.
After the update completes, consider rebooting your system if kernel updates were installed. This ensures all system components are running the latest versions and reduces potential compatibility issues during subsequent installations.
Apache HTTP Server Installation
Apache HTTP Server forms the foundation of your web hosting environment. Install Apache using Fedora’s DNF package manager:
sudo dnf install httpd -y
The installation process automatically handles dependencies and configures basic Apache settings. Once installation completes, enable Apache to start automatically at system boot:
sudo systemctl enable httpd
sudo systemctl start httpd
Verify Apache installation and service status:
sudo systemctl status httpd
A successful installation displays active status and confirms Apache is running properly. Test the web server by opening a browser and navigating to http://localhost
or your server’s IP address. The default Fedora Apache test page confirms successful installation.
Apache Performance Optimization
Modern web applications benefit from Apache’s event-driven architecture. Enable the mpm_event module for improved performance:
sudo nano /etc/httpd/conf.modules.d/00-mpm.conf
Ensure the following line is uncommented:
LoadModule mpm_event_module modules/mod_mpm_event.so
Enable HTTP/2 support for faster page loading:
sudo nano /etc/httpd/conf.modules.d/10-h2.conf
Verify this line is present and uncommented:
LoadModule http2_module modules/mod_http2.so
Restart Apache to apply performance optimizations:
sudo systemctl restart httpd
These optimizations significantly improve concurrent connection handling and reduce server resource consumption during high-traffic periods.
Step 2: Install and Configure MariaDB Database Server
MariaDB Server Installation
MariaDB provides robust, scalable database services essential for Drupal operations. Install MariaDB server using DNF:
sudo dnf install mariadb-server -y
The installation includes the MariaDB server, client tools, and essential libraries. Start and enable MariaDB services:
sudo systemctl enable mariadb
sudo systemctl start mariadb
Verify MariaDB installation and service status:
sudo systemctl status mariadb
Successful installation displays active status and confirms the database server is operational. MariaDB’s compatibility with MySQL ensures seamless integration with Drupal’s database requirements.
Database Security Configuration
Secure your MariaDB installation by running the security script:
sudo mysql_secure_installation
The interactive script guides you through essential security configurations. Initially, press Enter when prompted for the root password since none is set. Choose ‘Y’ to set a root password and create a strong, unique passphrase.
Remove anonymous users by selecting ‘Y’ when prompted. Anonymous accounts pose security risks and are unnecessary for production environments. Disallow root login remotely by choosing ‘Y’, preventing external access to the administrative account.
Remove the test database by selecting ‘Y’. Test databases contain sample data and default permissions that could compromise security. Reload privilege tables by choosing ‘Y’ to ensure all changes take immediate effect.
Drupal Database Creation
Access MariaDB as the root user to create Drupal’s database and user account:
mysql -u root -p
Enter the root password you configured during the security setup. Create a dedicated database for Drupal:
CREATE DATABASE drupal CHARACTER SET utf8mb4 COLLATE utf8mb4_unicode_ci;
The utf8mb4 character set ensures full Unicode support, including emojis and special characters. Create a dedicated user account for Drupal:
CREATE USER 'drupaluser'@'localhost' IDENTIFIED BY 'secure_password_here';
Replace ‘secure_password_here’ with a strong, unique password containing uppercase letters, lowercase letters, numbers, and special characters. Grant appropriate privileges to the Drupal user:
GRANT ALL PRIVILEGES ON drupal.* TO 'drupaluser'@'localhost';
FLUSH PRIVILEGES;
EXIT;
Test database connectivity using the new credentials:
mysql -u drupaluser -p drupal
Successful connection confirms proper database setup and user permissions.
Step 3: Install PHP and Required Extensions
PHP Installation with Essential Extensions
PHP serves as Drupal’s runtime environment, processing dynamic content and database interactions. Install PHP 8.3 and core extensions:
sudo dnf install php php-fpm php-mysqlnd php-opcache php-gd php-xml php-mbstring php-curl php-json -y
This command installs PHP along with essential extensions for Drupal functionality. Each extension serves specific purposes:
- php-mysqlnd: Native MySQL driver for database connectivity
- php-opcache: Bytecode cache for improved performance
- php-gd: Graphics library for image processing
- php-xml: XML document processing capabilities
- php-mbstring: Multibyte string handling for international content
- php-curl: HTTP client library for external API connections
- php-json: JSON data format processing
Verify PHP installation and version:
php -v
The output should display PHP 8.1 or higher with installed extensions listed.
PHP Configuration Optimization
Edit PHP configuration to optimize performance for Drupal:
sudo nano /etc/php.ini
Locate and modify these critical settings:
memory_limit = 512M
max_execution_time = 300
max_input_time = 300
post_max_size = 256M
upload_max_filesize = 256M
max_file_uploads = 20
These settings accommodate Drupal’s memory requirements during module installations and content uploads. Set the appropriate timezone:
date.timezone = America/New_York
Replace “America/New_York” with your server’s timezone. Check /usr/share/zoneinfo/
for available timezone options.
PHP-FPM Configuration
PHP-FPM provides better performance and resource management compared to mod_php. Start and enable PHP-FPM:
sudo systemctl enable php-fpm
sudo systemctl start php-fpm
Verify PHP-FPM status:
sudo systemctl status php-fpm
Configure Apache to work with PHP-FPM by ensuring the following modules are loaded:
sudo nano /etc/httpd/conf.modules.d/10-php.conf
Verify or add these lines:
LoadModule proxy_module modules/mod_proxy.so
LoadModule proxy_fcgi_module modules/mod_proxy_fcgi.so
Restart Apache to apply PHP-FPM integration:
sudo systemctl restart httpd
Step 4: Download and Prepare Drupal Files
Drupal Core Download
Navigate to a temporary directory for downloading Drupal:
cd /tmp
Download the latest Drupal version directly from the official repository:
wget https://www.drupal.org/download-latest/tar.gz -O drupal-latest.tar.gz
This command downloads the most current stable release. Extract the downloaded archive:
tar -zxf drupal-latest.tar.gz
The extraction creates a directory named with the Drupal version number. List the contents to identify the exact directory name:
ls -la drupal-*
Drupal Directory Setup
Move Drupal files to the Apache document root:
sudo mv drupal-* /var/www/html/drupal
This placement allows Apache to serve Drupal content from the /drupal
URL path. Navigate to the Drupal directory:
cd /var/www/html/drupal
Create the settings file from the template:
sudo cp sites/default/default.settings.php sites/default/settings.php
Create the files directory for uploaded content:
sudo mkdir sites/default/files
File Permissions Configuration
Set proper ownership for Apache access:
sudo chown -R apache:apache /var/www/html/drupal
Configure directory permissions for security and functionality:
sudo find /var/www/html/drupal -type d -exec chmod 755 {} \;
sudo find /var/www/html/drupal -type f -exec chmod 644 {} \;
Temporarily set write permissions for the installation process:
sudo chmod 666 sites/default/settings.php
sudo chmod 775 sites/default/files
These permissions allow Drupal’s installer to modify configuration files and create necessary directories. Permissions will be secured after installation completion.
Step 5: Configure Apache Virtual Host for Drupal
Virtual Host Creation
Create a dedicated Apache configuration file for Drupal:
sudo nano /etc/httpd/conf.d/drupal.conf
Add the following virtual host configuration:
<VirtualHost *:80>
ServerAdmin webmaster@example.com
DocumentRoot /var/www/html/drupal
ServerName drupal.example.com
ServerAlias www.drupal.example.com
<Directory /var/www/html/drupal>
Options Indexes FollowSymLinks
AllowOverride All
Require all granted
</Directory>
# Enable URL rewriting for clean URLs
RewriteEngine On
# Security headers
Header always set X-Content-Type-Options nosniff
Header always set X-Frame-Options DENY
Header always set X-XSS-Protection "1; mode=block"
ErrorLog /var/log/httpd/drupal_error.log
CustomLog /var/log/httpd/drupal_access.log combined
</VirtualHost>
Replace “example.com” with your actual domain name. This configuration enables clean URLs, security headers, and proper logging.
URL Rewriting Configuration
Ensure mod_rewrite is enabled for clean URL functionality:
sudo nano /etc/httpd/conf.modules.d/00-base.conf
Verify this line is uncommented:
LoadModule rewrite_module modules/mod_rewrite.so
Test Apache configuration syntax:
sudo httpd -t
A successful test displays “Syntax OK”. If errors appear, review the configuration file for syntax issues.
Apache Service Restart
Apply configuration changes by restarting Apache:
sudo systemctl restart httpd
Verify the service started successfully:
sudo systemctl status httpd
The virtual host is now configured and ready to serve Drupal content.
Step 6: Configure SELinux and Firewall Settings
SELinux Configuration for Drupal
SELinux provides additional security layers but requires specific configuration for web applications. Enable database connections from Apache:
sudo setsebool -P httpd_can_network_connect_db=1
Allow Apache to send emails for notifications:
sudo setsebool -P httpd_can_sendmail=1
These boolean settings persist across system reboots. Verify SELinux contexts for Drupal files:
sudo restorecon -Rv /var/www/html/drupal
This command applies appropriate SELinux contexts to Drupal files and directories. Check SELinux status:
sestatus
Ensure SELinux is enabled and enforcing for optimal security.
Firewall Configuration
Configure the firewall to allow HTTP and HTTPS traffic:
sudo firewall-cmd --permanent --add-service=http
sudo firewall-cmd --permanent --add-service=https
Reload firewall rules to apply changes:
sudo firewall-cmd --reload
Verify active firewall rules:
sudo firewall-cmd --list-services
The output should include both http and https services. Test connectivity by accessing your server’s IP address from a web browser.
Security Considerations
Review and customize firewall rules based on your specific requirements. Consider restricting SSH access to specific IP addresses:
sudo firewall-cmd --permanent --add-rich-rule='rule family="ipv4" source address="YOUR_IP_ADDRESS" service name="ssh" accept'
sudo firewall-cmd --permanent --remove-service=ssh
Replace “YOUR_IP_ADDRESS” with your actual IP address. This configuration enhances security by limiting administrative access.
Step 7: Complete Drupal Web Installation Wizard
Accessing the Installation Interface
Open a web browser and navigate to your Drupal installation. Use one of these URLs depending on your configuration:
- Local installation:
http://localhost/drupal
- Domain-based:
http://your-domain.com/drupal
- IP-based:
http://your-server-ip/drupal
The Drupal installation wizard appears, beginning with language selection. Choose your preferred language and click “Save and continue.”
Installation Profile Selection
Select an installation profile that matches your requirements:
- Standard: Recommended for most users, includes common functionality
- Minimal: Basic installation with essential features only
- Demo: Includes sample content for testing and evaluation
The Standard profile provides a balanced foundation with essential modules pre-configured. Click “Save and continue” after making your selection.
Database Configuration Setup
The database configuration page requires the connection details you created earlier:
- Database type: Select “MySQL, MariaDB, Percona Server, or equivalent”
- Database name: Enter “drupal”
- Database username: Enter “drupaluser”
- Database password: Enter the secure password you created
- Host: Enter “localhost”
- Port number: Leave as default (3306)
- Table name prefix: Leave empty unless multiple Drupal sites share the database
Click “Save and continue” to test the database connection. Drupal validates the credentials and creates necessary tables.
Site Information Configuration
Configure your Drupal site’s basic information:
- Site name: Choose a descriptive name for your website
- Site email address: Enter an email for administrative notifications
- Username: Create an administrative user account
- Password: Use a strong password for the admin account
- Email address: Admin user’s email address
- Default country: Select your geographic location
- Default time zone: Choose your time zone
These settings establish your site’s identity and administrative access. Click “Save and continue” to finalize the installation.
Installation Completion
Drupal installs core modules and configures the database structure. This process takes several minutes depending on your system’s performance. Upon completion, you’ll see the Drupal dashboard with a welcome message.
The installation wizard automatically creates essential content types, user roles, and basic configurations. Your Drupal site is now functional and ready for customization.
Step 8: Post-Installation Security and Optimization
File Permission Security
Secure file permissions after installation completion:
sudo chmod 644 /var/www/html/drupal/sites/default/settings.php
This change prevents unauthorized modifications to critical configuration files. Verify directory permissions remain appropriate:
sudo chmod 755 /var/www/html/drupal/sites/default/files
Remove write access from directories where it’s not required:
sudo find /var/www/html/drupal -name "*.php" -exec chmod 644 {} \;
Essential Security Configuration
Access your Drupal administration panel and configure security settings:
- Navigate to Configuration → System → Site information
- Set error reporting to “None” for production environments
- Configure automatic updates under Configuration → System → Updates
Enable Drupal’s built-in security features:
drush pm:enable automated_cron update
These modules provide automatic maintenance and security monitoring capabilities.
Performance Optimization Settings
Configure Drupal’s performance settings for optimal speed:
- Navigate to Configuration → Development → Performance
- Enable “Aggregate CSS files” and “Aggregate JavaScript files”
- Set cache maximum age to 1 hour or longer
- Enable “Compress cached pages”
Configure PHP OPcache for improved performance:
sudo nano /etc/php.d/10-opcache.ini
Optimize OPcache settings:
opcache.memory_consumption=256
opcache.interned_strings_buffer=16
opcache.max_accelerated_files=10000
opcache.validate_timestamps=0
opcache.save_comments=1
Restart PHP-FPM to apply changes:
sudo systemctl restart php-fpm
Backup Configuration
Implement regular backup procedures for your Drupal installation:
sudo mkdir -p /backups/drupal
Create a backup script for automated maintenance:
sudo nano /usr/local/bin/drupal-backup.sh
Add backup automation:
#!/bin/bash
DATE=$(date +%Y%m%d_%H%M%S)
tar -czf /backups/drupal/drupal_files_$DATE.tar.gz /var/www/html/drupal
mysqldump -u drupaluser -p drupal > /backups/drupal/drupal_db_$DATE.sql
Make the script executable:
sudo chmod +x /usr/local/bin/drupal-backup.sh
Schedule regular backups using cron:
sudo crontab -e
Add a weekly backup schedule:
0 2 * * 0 /usr/local/bin/drupal-backup.sh
Troubleshooting Common Installation Issues
Database Connection Problems
If Drupal cannot connect to the database, verify MariaDB service status:
sudo systemctl status mariadb
Test manual database connectivity:
mysql -u drupaluser -p drupal
Check database user permissions:
SHOW GRANTS FOR 'drupaluser'@'localhost';
Ensure the user has appropriate privileges on the Drupal database. Review MariaDB error logs if connection issues persist:
sudo tail -f /var/log/mariadb/mariadb.log
File Permission and Access Issues
Permission errors typically manifest as inability to upload files or modify configurations. Verify Apache user ownership:
ls -la /var/www/html/drupal/sites/default/
Reset ownership if necessary:
sudo chown -R apache:apache /var/www/html/drupal
Check SELinux contexts if permission errors persist:
sudo ls -laZ /var/www/html/drupal
Restore proper SELinux contexts:
sudo restorecon -Rv /var/www/html/drupal
Apache Configuration and Virtual Host Issues
Syntax errors in Apache configuration prevent service startup. Test configuration validity:
sudo httpd -t
Review Apache error logs for specific issues:
sudo tail -f /var/log/httpd/error_log
Common issues include incorrect directory paths, missing modules, or syntax errors in virtual host configurations. Verify mod_rewrite is enabled:
sudo httpd -M | grep rewrite
PHP Memory and Performance Issues
Memory limit errors occur during module installations or large content uploads. Monitor PHP error logs:
sudo tail -f /var/log/php-fpm/www-error.log
Increase memory limits in php.ini if necessary:
sudo nano /etc/php.ini
Adjust memory_limit and max_execution_time values based on your requirements. Restart PHP-FPM after configuration changes:
sudo systemctl restart php-fpm
Advanced Configuration and Next Steps
SSL Certificate Installation
Secure your Drupal installation with HTTPS encryption. Install Certbot for Let’s Encrypt certificates:
sudo dnf install certbot python3-certbot-apache -y
Obtain an SSL certificate for your domain:
sudo certbot --apache -d your-domain.com -d www.your-domain.com
Certbot automatically configures Apache for HTTPS and sets up certificate renewal.
Essential Module Installation
Install popular Drupal modules to extend functionality:
cd /var/www/html/drupal
composer require drupal/admin_toolbar drupal/pathauto drupal/token
These modules provide enhanced administration interfaces and URL management capabilities. Enable modules through the Drupal interface or Drush:
drush pm:enable admin_toolbar pathauto token
Performance Monitoring Setup
Implement monitoring tools to track your Drupal installation’s performance:
sudo dnf install htop iotop nethogs -y
Configure log monitoring for proactive maintenance:
sudo nano /etc/logrotate.d/drupal
Add log rotation configuration:
/var/log/httpd/drupal_*.log {
daily
missingok
rotate 52
compress
notifempty
create 644 apache apache
postrotate
systemctl reload httpd
endscript
}