How To Install WordPress on Fedora 42
WordPress powers over 40% of all websites on the internet, making it the world’s most popular content management system. Installing WordPress locally on Fedora 42 provides developers and administrators with a powerful testing environment for website development, theme customization, and plugin testing. This comprehensive guide walks you through every step of setting up WordPress on Fedora 42 using the LAMP stack (Linux, Apache, MariaDB, PHP).
Whether you’re a system administrator preparing a production server, a web developer creating a local development environment, or a Linux enthusiast expanding your technical expertise, this tutorial provides detailed instructions to establish a fully functional WordPress installation. By following this guide, you’ll have a robust web server environment capable of hosting everything from personal blogs to complex web applications.
Prerequisites and System Requirements
Before beginning the WordPress installation process on Fedora 42, ensure your system meets the necessary requirements for optimal performance and functionality.
System Requirements
Your Fedora 42 installation should have at least 2GB of RAM and 20GB of available disk space for a basic WordPress setup. For production environments or development servers handling multiple sites, consider allocating additional resources based on anticipated workload. A fresh Fedora 42 installation is recommended to prevent potential package conflicts or security vulnerabilities.
Administrative Access and Network Requirements
Root access or a user account with sudo privileges is essential for installing packages and configuring system services. An active internet connection is required for downloading packages from Fedora repositories and WordPress core files. Basic familiarity with Linux command-line operations will help you navigate the installation process more efficiently.
Required Knowledge Base
Understanding fundamental Linux concepts such as file permissions, system services, and basic web server principles will enhance your ability to troubleshoot issues and customize your installation. While this guide provides comprehensive instructions, familiarity with these concepts ensures smoother implementation.
Step 1: Update Your Fedora 42 System
Starting with an updated system prevents compatibility issues and ensures you have the latest security patches installed. Open a terminal application and execute the following commands to refresh package repositories and upgrade existing packages.
Begin by cleaning the package cache and updating your system:
sudo dnf clean all
sudo dnf update
This process may take several minutes depending on your internet connection and the number of packages requiring updates. The system will download and install all available updates, including kernel updates, security patches, and application improvements.
If kernel updates are installed during this process, reboot your system to ensure all changes take effect properly:
sudo reboot
After rebooting, verify your system is running the latest kernel version and all services have started correctly.
Step 2: Installing Apache Web Server
Apache HTTP Server serves as the foundation of your WordPress installation, handling web requests and serving your website content to visitors. Fedora 42 includes Apache in its repositories, making installation straightforward through the DNF package manager.
Installation Process
Install the Apache web server package using the following command:
sudo dnf install httpd
The installation process automatically resolves dependencies and installs necessary components for Apache functionality. Once installation completes, enable Apache to start automatically at boot time and start the service immediately:
sudo systemctl enable httpd.service
sudo systemctl start httpd.service
Verification and Testing
Verify Apache installation by checking the service status:
sudo systemctl status httpd
The output should indicate that Apache is active and running. Test Apache functionality by opening a web browser and navigating to http://localhost
or http://your-server-ip
. You should see the default Apache test page confirming successful installation.
Basic Apache Configuration
Apache stores its main configuration file at /etc/httpd/conf/httpd.conf
, while additional configuration files reside in /etc/httpd/conf.d/
. The default document root is located at /var/www/html/
, where you’ll eventually place your WordPress files.
Step 3: Installing and Configuring MariaDB Database Server
WordPress requires a database to store content, user information, and configuration settings. MariaDB, a MySQL fork, provides excellent performance and compatibility with WordPress installations on Fedora systems.
MariaDB Installation
Install MariaDB server and client packages:
sudo dnf install mariadb-server mariadb
After installation, start the MariaDB service and enable it to run at boot:
sudo systemctl start mariadb.service
sudo systemctl enable mariadb.service
Security Configuration
Run the MySQL security installation script to enhance database security:
sudo mysql_secure_installation
This interactive script prompts you to configure several security settings. When prompted, set a strong root password, remove anonymous users, disable remote root login, remove the test database, and reload privilege tables. Answer “Y” to all security questions for maximum protection.
Creating WordPress Database
Access the MariaDB command line interface as the root user:
sudo mysql -u root -p
Create a dedicated database for your WordPress installation:
CREATE DATABASE wordpress_db;
CREATE USER 'wordpress_user'@'localhost' IDENTIFIED BY 'secure_password';
GRANT ALL PRIVILEGES ON wordpress_db.* TO 'wordpress_user'@'localhost';
FLUSH PRIVILEGES;
EXIT;
Replace wordpress_db
, wordpress_user
, and secure_password
with your preferred database name, username, and a strong password. These credentials will be used later in the WordPress configuration process.
Step 4: Installing PHP and Required Extensions
PHP processes WordPress code and generates dynamic web content. Fedora 42 includes PHP in its repositories along with essential extensions required for WordPress functionality.
PHP Installation
Install PHP and necessary extensions for WordPress:
sudo dnf install php php-mysqlnd php-gd php-xml php-mbstring php-curl php-zip php-intl php-json
These extensions provide database connectivity, image processing, XML parsing, multibyte string handling, and other essential WordPress features. The php-mysqlnd extension specifically enables PHP to communicate with MariaDB databases.
PHP Configuration Optimization
Edit the PHP configuration file to optimize settings for WordPress:
sudo nano /etc/php.ini
Locate and modify the following settings for optimal WordPress performance:
memory_limit = 256M
upload_max_filesize = 64M
post_max_size = 64M
max_execution_time = 300
max_input_vars = 3000
These adjustments increase memory allocation, allow larger file uploads, and extend execution time for WordPress operations. After making changes, restart Apache to apply the new PHP configuration:
sudo systemctl restart httpd
PHP Verification
Create a PHP info file to verify your installation:
echo "<?php phpinfo(); ?>" | sudo tee /var/www/html/info.php
Navigate to http://localhost/info.php
in your web browser to view PHP configuration details. Remove this file after verification for security reasons:
sudo rm /var/www/html/info.php
Step 5: Downloading and Preparing WordPress
With your LAMP stack components installed and configured, download and prepare WordPress files for installation.
WordPress Download
Navigate to the Apache document root and download the latest WordPress version:
cd /var/www/html
sudo wget https://wordpress.org/latest.tar.gz
Extract the WordPress archive:
sudo tar -xzf latest.tar.gz
This creates a wordpress
directory containing all WordPress core files. Remove the downloaded archive to save disk space:
sudo rm latest.tar.gz
File Ownership and Permissions
Set proper ownership and permissions for WordPress files:
sudo chown -R apache:apache /var/www/html/wordpress
sudo chmod -R 755 /var/www/html/wordpress
These commands ensure the Apache web server can read and execute WordPress files while maintaining appropriate security permissions.
WordPress Configuration File
Copy the sample configuration file to create your WordPress configuration:
cd /var/www/html/wordpress
sudo cp wp-config-sample.php wp-config.php
Step 6: Configuring WordPress Database Connection
Edit the WordPress configuration file to establish database connectivity and configure essential settings.
Database Configuration
Open the WordPress configuration file:
sudo nano /var/www/html/wordpress/wp-config.php
Locate the database configuration section and update the following values with your database credentials:
define('DB_NAME', 'wordpress_db');
define('DB_USER', 'wordpress_user');
define('DB_PASSWORD', 'secure_password');
define('DB_HOST', 'localhost');
Security Keys Configuration
WordPress uses authentication keys and salts to secure user sessions and protect against various attacks. Visit https://api.wordpress.org/secret-key/1.1/salt/
to generate unique security keys, then replace the placeholder values in wp-config.php:
define('AUTH_KEY', 'your-unique-auth-key');
define('SECURE_AUTH_KEY', 'your-unique-secure-auth-key');
define('LOGGED_IN_KEY', 'your-unique-logged-in-key');
define('NONCE_KEY', 'your-unique-nonce-key');
define('AUTH_SALT', 'your-unique-auth-salt');
define('SECURE_AUTH_SALT', 'your-unique-secure-auth-salt');
define('LOGGED_IN_SALT', 'your-unique-logged-in-salt');
define('NONCE_SALT', 'your-unique-nonce-salt');
Additional WordPress Settings
Configure additional WordPress options in wp-config.php:
define('WP_DEBUG', false);
define('WP_DEBUG_LOG', false);
define('WP_DEBUG_DISPLAY', false);
$table_prefix = 'wp_';
These settings disable debugging for production use and set the database table prefix. Save and close the configuration file after making all necessary changes.
Step 7: Creating Apache Virtual Host (Optional)
While you can access WordPress through a subdirectory, creating a virtual host provides better organization and allows you to use a custom domain name for your installation.
Virtual Host Configuration
Create a new virtual host configuration file:
sudo nano /etc/httpd/conf.d/wordpress.conf
Add the following virtual host configuration:
<VirtualHost *:80>
ServerName wordpress.local
DocumentRoot /var/www/html/wordpress
<Directory /var/www/html/wordpress>
AllowOverride All
Require all granted
</Directory>
ErrorLog /var/log/httpd/wordpress_error.log
CustomLog /var/log/httpd/wordpress_access.log combined
</VirtualHost>
Hosts File Configuration
For local development, add an entry to your hosts file:
sudo echo "127.0.0.1 wordpress.local" >> /etc/hosts
Restart Apache to activate the virtual host:
sudo systemctl restart httpd
Test the virtual host by navigating to http://wordpress.local
in your web browser.
Step 8: Database Setup and Connection Testing
Before proceeding with the WordPress web-based installation, verify that all components are properly configured and communicating.
Database Connection Verification
Test the database connection using the credentials configured in wp-config.php:
mysql -u wordpress_user -p wordpress_db
If the connection succeeds, you’ll see the MariaDB prompt. Exit the database:
EXIT;
WordPress Database Tables
WordPress automatically creates necessary database tables during the web-based installation process. These tables store posts, pages, users, options, and other essential WordPress data. The database prefix specified in wp-config.php is prepended to all table names for security and organization.
Common Connection Issues
If database connection fails, verify that MariaDB is running:
sudo systemctl status mariadb
Check that the database and user exist:
sudo mysql -u root -p -e "SHOW DATABASES; SELECT User, Host FROM mysql.user;"
Ensure your wp-config.php credentials match the database setup exactly.
Step 9: Completing WordPress Web-Based Installation
With all components configured, complete the WordPress installation through the web interface.
Installation Wizard Access
Open your web browser and navigate to your WordPress installation:
- If using virtual host:
http://wordpress.local
- If using subdirectory:
http://localhost/wordpress
The WordPress installation wizard should appear automatically. If you see database connection errors, review your wp-config.php
settings and database configuration.
Site Configuration
The installation wizard prompts for the following information:
- Site Title: Choose a descriptive name for your website
- Username: Create an administrative username (avoid “admin” for security)
- Password: Use a strong, unique password
- Email: Provide a valid email address for notifications
- Search Engine Visibility: Choose whether to discourage search engines during development
Administrative Account Creation
Create your WordPress administrator account with a secure username and strong password. This account has full access to your WordPress installation, including theme and plugin management, user administration, and system configuration.
Complete the installation by clicking “Install WordPress.” The process typically takes a few seconds to create database tables and configure initial settings.
Step 10: Security Hardening and Best Practices
Securing your WordPress installation protects against common vulnerabilities and ensures reliable operation.
System-Level Security
Configure SELinux policies for WordPress functionality:
sudo setsebool -P httpd_can_network_connect_db 1
sudo setsebool -P httpd_unified 1
These settings allow Apache to connect to databases and manage files properly under SELinux protection.
Firewall Configuration
Configure the Fedora firewall to allow web traffic:
sudo firewall-cmd --permanent --add-service=http
sudo firewall-cmd --permanent --add-service=https
sudo firewall-cmd --reload
WordPress Security Measures
Install security plugins like Wordfence or Sucuri Security through the WordPress admin panel. These plugins provide malware scanning, firewall protection, and login security features.
Implement two-factor authentication for all user accounts, especially administrators. Regular security updates for WordPress core, themes, and plugins are essential for maintaining security.
File Permissions
Set restrictive file permissions for enhanced security:
sudo find /var/www/html/wordpress/ -type d -exec chmod 755 {} \;
sudo find /var/www/html/wordpress/ -type f -exec chmod 644 {} \;
sudo chmod 600 /var/www/html/wordpress/wp-config.php
SSL/TLS Implementation
For production environments, implement SSL/TLS encryption using Let’s Encrypt or commercial certificates. This protects data transmission and improves search engine rankings.
Step 11: Troubleshooting Common Issues
Understanding common WordPress installation problems helps you resolve issues quickly and maintain smooth operation.
Database Connection Errors
If WordPress cannot connect to the database, verify the following:
- MariaDB service status:
sudo systemctl status mariadb
- Database credentials in wp-config.php
- Database user permissions
- Network connectivity between PHP and MariaDB
File Permission Problems
Incorrect file permissions prevent WordPress from functioning properly. Symptoms include white screens, plugin installation failures, or update errors. Reset permissions using the commands provided in the security section.
Apache Configuration Issues
Apache misconfiguration can cause 500 internal server errors or prevent WordPress from loading. Check Apache error logs:
sudo tail -f /var/log/httpd/error_log
Common issues include mod_rewrite not enabled or insufficient directory permissions in virtual host configurations.
PHP Extension Errors
Missing PHP extensions cause various WordPress malfunctions. Verify required extensions are installed:
php -m | grep -E "(mysqli|gd|xml|mbstring|curl|zip)"
Install any missing extensions using DNF and restart Apache.
Performance Optimization
Implement caching solutions like Redis or Memcached for improved performance. Configure PHP-FPM for better resource management in high-traffic environments. Regular database optimization helps maintain responsiveness as content grows.
Backup and Recovery
Establish automated backup procedures for both database and files. Test backup restoration regularly to ensure data recovery capability. Consider using WordPress backup plugins or system-level backup solutions.
Congratulations! You have successfully installed WordPress. Thanks for using this tutorial for installing WordPress on your Fedora 42 Linux system. For additional or useful information, we recommend you check the official WordPress website.