How To Install WordPress on Fedora 38
In this tutorial, we will show you how to install WordPress on Fedora 38. WordPress is a powerful and popular content management system (CMS) that allows you to create and manage websites with ease. Combining it with Fedora 38, Nginx, PHP 8, and MariaDB offers a robust and secure environment for your WordPress site.
This article assumes you have at least basic knowledge of Linux, know how to use the shell, and most importantly, you host your site on your own VPS. The installation is quite simple and assumes you are running in the root account, if not you may need to add ‘sudo
‘ to the commands to get root privileges. I will show you the step-by-step installation of WordPress on a Fedora 38.
Prerequisites
- A server running one of the following operating systems: Fedora 38.
- It’s recommended that you use a fresh OS install to prevent any potential issues.
- SSH access to the server (or just open Terminal if you’re on a desktop).
- A stable internet connection is crucial as we’ll be downloading and installing various packages and dependencies from remote repositories.
- A
non-root sudo user
or access to theroot user
. We recommend acting as anon-root sudo user
, however, as you can harm your system if you’re not careful when acting as the root.
Install WordPress on Fedora 38
Step 1. Before we can install WordPress on Fedora 38, it’s important to ensure that our system is up-to-date with the latest packages. This will ensure that we have access to the latest features and bug fixes and that we can install WordPress without any issues:
sudo dnf update
Step 2. Installing Nginx.
Nginx is a high-performance web server known for its reliability and speed. Let’s install it:
sudo dnf install nginx sudo systemctl start nginx sudo systemctl enable nginx
Step 3. Installing PHP.
PHP 8 is the latest PHP version, offering performance improvements and enhanced security. Install PHP 8 and necessary extensions:
sudo dnf install php php-fpm php-mysqlnd php-opcache php-gd php-xml php-json sudo systemctl start php-fpm sudo systemctl enable php-fpm
Verify the PHP installation:
php -v
Step 4. Installing MariaDB.
MariaDB is a drop-in replacement for MySQL and an excellent choice for WordPress. Install MariaDB and secure the installation:
sudo dnf install mariadb mariadb-server sudo systemctl start mariadb sudo systemctl enable mariadb sudo mysql_secure_installation
This installs MariaDB starts it, and secures the installation. Follow the prompts to set a root password and improve security.
Next, create a MariaDB Database and User for WordPress:
sudo mysql -u root -p
Enter your root password, then execute the following SQL commands:
CREATE DATABASE wordpress_db; CREATE USER 'wordpress_user'@'localhost' IDENTIFIED BY 'your_strong_password'; GRANT ALL PRIVILEGES ON wordpress_db.* TO 'wordpress_user'@'localhost'; FLUSH PRIVILEGES; EXIT;
This creates a database named ‘wordpress_db
‘, a user ‘wordpress_user
‘, and grants necessary privileges.
Step 5. Installing WordPress on Fedora 38.
Let’s get the latest WordPress release and set up its configuration file:
cd /tmp wget https://wordpress.org/latest.tar.gz tar -xvzf latest.tar.gz sudo mv wordpress /var/www/html/
Then, create a configuration file and set up the database:
cd /var/www/html/wordpress cp wp-config-sample.php wp-config.php nano wp-config.php
Edit the file with your database details:
define('DB_NAME', 'wordpress_db'); define('DB_USER', 'wordpress_user'); define('DB_PASSWORD', 'your_strong_password');
Step 6. Configure Nginx for WordPress.
To configure Nginx for WordPress, create a server block configuration file:
sudo nano /etc/nginx/conf.d/wordpress.conf
Add the following configuration:
server { listen 80; server_name your_domain.com www.your_domain.com; root /var/www/html/wordpress; index index.php; location / { try_files $uri $uri/ /index.php?$args; } location ~ \.php$ { include fastcgi_params; fastcgi_pass unix:/var/run/php-fpm/php-fpm.sock; fastcgi_param SCRIPT_FILENAME $document_root$fastcgi_script_name; } }
Replace ‘your_domain.com’ with your actual domain or server IP.
WordPress uses rewrite rules for permalinks. To enable them, run:
sudo nano /etc/nginx/conf.d/wordpress.conf
Add the following lines within the server block:
location / { try_files $uri $uri/ /index.php?$args; }
Save the file and reload Nginx for the changes to take effect:
sudo systemctl reload nginx
Step 7. Secure Nginx with Let’s Encrypt.
Securing your website with SSL/TLS encryption is recommended. To install Let’s Encrypt and obtain an SSL certificate, follow these steps:
sudo dnf install certbot python3-certbot-nginx sudo certbot --nginx
Follow the prompts to configure your SSL certificate.
Step 8. Web Interface Installation.
Now, access your server’s IP address or domain in a web browser. You will see the WordPress installation wizard. Follow the on-screen instructions to create an admin account and configure your site.
Congratulations! You have successfully installed WordPress. Thanks for using this tutorial for installing WordPress on your Fedora 38 system. For additional help or useful information, we recommend you check the official WordPress website.