Skip to main content

Installing WordPress on Fedora

This is our tutorial on installing WordPress on Fedora. WordPress is a powerful, open-source content management system (CMS) that powers a significant portion of the web. It's renowned for its flexibility and ease of use, making it an excellent choice for bloggers, businesses, and everyone in between. Fedora, with its cutting-edge features and stability, provides a robust platform for hosting WordPress websites.

In this tutorial, we'll cover everything from setting up the necessary software stack to configuring WordPress. Be it for a seasoned sysadmin or a newcomer to the world of web hosting, this guide will help you get your WordPress site up and running on Fedora.

Prerequisites​

Before we dive in, ensure you have the following:.

  • A Fedora system with root access or a user with sudo privileges.
  • A basic understanding of the Linux command line.
  • A registered domain name pointing to your server's IP address.
  • Access to your server's command line via SSH or a console.

Step 1: Update Your System​

Start by updating your Fedora system to ensure all your packages are up to date:.

sudo dnf update -y

Step 2: Install LAMP Stack (Linux, Apache, MySQL, PHP)​

WordPress requires a LAMP stack to run. Here's how to install each component:.

Linux (Fedora)​

You're already using Fedora, which is the Linux component of the LAMP stack.

Apache​

Install Apache using the following command:.

sudo dnf install httpd -y

Enable and start the Apache service:.

sudo systemctl enable httpd
sudo systemctl start httpd

MySQL​

Install MySQL and secure the installation:.

sudo dnf install mysql-server
sudo systemctl enable mysqld
sudo systemctl start mysqld
sudo mysql_secure_installation

Follow the prompts to set a root password, remove anonymous users, and secure your MySQL installation.

PHP​

Install PHP along with the necessary extensions for WordPress:.

sudo dnf install php php-mysqlnd php-gd php-mbstring php-xml php-pear php-json -y

Restart Apache to apply the changes:.

sudo systemctl restart httpd

Step 3: Configure MySQL for WordPress​

Log in to MySQL and create a database and user for WordPress:.

mysql -u root -p

Once logged in, execute the following SQL commands:.

CREATE DATABASE wordpressdb;
CREATE USER 'wordpressuser'@'localhost' IDENTIFIED BY 'your_secure_password';
GRANT ALL PRIVILEGES ON wordpressdb.* TO 'wordpressuser'@'localhost';
FLUSH PRIVILEGES;
EXIT;

Replace your_secure_password with a strong password of your choice.

Step 4: Install WordPress​

Download WordPress​

Download the latest version of WordPress:.

cd /var/www/html
sudo wget https://wordpress.org/latest.tar.gz

Extract the files:.

sudo tar xzf latest.tar.gz

Move the WordPress files into the web root directory:.

sudo cp -a wordpress/* /var/www/html

Configure Permissions​

Set the correct permissions for the WordPress files:.

sudo chown -R apache:apache /var/www/html
sudo find /var/www/html -type d -exec chmod 755 {} \;
sudo find /var/www/html -type f -exec chmod 644 {} \;

Configure WordPress​

Rename the wp-config-sample.php file to wp-config.php:.

cd /var/www/html
sudo cp wp-config-sample.php wp-config.php

Edit the wp-config.php file to enter your database details:.

sudo nano wp-config.php

Find the following lines and replace them with your database information:.

define('DB_NAME', 'wordpressdb');
define('DB_USER', 'wordpressuser');
define('DB_PASSWORD', 'your_secure_password');
define('DB_HOST', 'localhost');

Save and close the file.

Step 5: Complete WordPress Installation​

Open your web browser and navigate to your server's domain name or IP address. You should be greeted by the WordPress installation wizard. Follow the on-screen instructions to complete the installation. You'll need to provide:.

  • A site title.

  • An admin username and password.

  • An admin email address.

Once completed, you'll be able to log in to your WordPress dashboard and begin customizing your site.

Step 6: Secure Your WordPress Site​

  • SSL Certificate: It's highly recommended to secure your site with an SSL certificate. You can obtain a free certificate from Let's Encrypt.
  • Firewall: Consider setting up a firewall with firewalld or ufw to enhance server security.
  • WordPress Security Plugins: Install security plugins like Wordfence or Sucuri to protect your WordPress site from various attacks.

Step 7: Regular Maintenance​

  • Updates: Keep your Fedora server, WordPress core, themes, and plugins up to date.
  • Backups: Implement a regular backup routine for your WordPress files and database.

Troubleshooting Common Issues​

  • Permission Issues: Ensure the Apache user (usually apache) has the correct permissions on the WordPress directory and files.
  • White Screen of Death: This can be due to a plugin or theme conflict. Try disabling all plugins and switching to a default theme to diagnose the issue.
  • Error Establishing Database Connection: Verify your database credentials in wp-config.php and ensure the MySQL service is running.

Last word​

You now have a fully functional WordPress installation on your Fedora server. Keep your system updated and regularly check for WordPress updates to maintain security and performance. Enjoy your new WordPress site!