How to Install WordPress on CentOS 8. This article will explain installation guide of WordPress onCentOS 8 with an introduction of what WordPress is and its benefits.
What is WordPress?
WordPress is an open source and one of the most popular content management systems(CMS) written in PHP that uses a MySQL database. It is licensed under GPLv2 so free to install and it allows you to configure static or dynamic websites. It comes with massive ecosystem of WordPress plugins and themes to create a blog of your choice or create an e-commerce website and sell physical products using Word Press. If you are looking to set up flexible blogs and websites then WordPress CMS is a great choice for getting a website up and running quickly.
First step of our tutorial how to Install WordPress on CentOS 8 is to download A LEMP server. It is a set of open source software (Linux, Nginx, MariaDB, PHP) used to host dynamic websites and applications on the internet. A LEMP stack would be preferable as Nginx performs approximately 2.5 faster than Apache server.
WordPress uses MySQL or MariaDB as a database backend. You can install the MariaDB database by just running the following command:
dnf install mariadb-server -y
After installing the MariaDB database, start the MariaDB service and enable it to start at system reboot:
systemctl start mariadb
systemctl enable mariadb
Next, you will need to secure the MariaDB installation and set a MariaDB root password. You can do it by running the following script:
mysql_secure_installation
You will be asked to set a root password, remove anonymous users, disallow root login remotely and remove the test database as shown below:
Enter current password for root (enter for none):
Set root password? [Y/n] Y
New password:
Re-enter new password:
Remove anonymous users? [Y/n] Y
Disallow root login remotely? [Y/n] Y
Remove test database and access to it? [Y/n] Y
Reload privilege tables now? [Y/n] Y
PHP version 8 has significant performance improvements and new features so it is recommended to use PHP 8 for WordPress. By default, PHP 8 is not included in the CentOS 8 default repo. So you will need to install the EPEL and Remi PHP repository to your system.
First, install EPEL and Remi repository package with the following command:
It is always recommended to download the latest version of WordPress from its official website. You can download it inside the Nginx default root directory using the following command:
cd /var/www/html
wget https://wordpress.org/latest.tar.gz
Once the download is completed, extract the downloaded file with the following command:
tar -xvzf latest.tar.gz
Next, rename the extracted directory with yourdomain name.
mv wordpress yourdomain.com
Next, change the ownership of yourdomain.com directory to nginx:
By default, SELinux is enabled on CentOS 8 server. It is always recommended to disable the SELinux. To disable the SELinux, edit the /etc/selinux/config file:
nano /etc/selinux/config
Change the following line:
SELINUX=disabled
Save and close the file then restart your system to apply the changes.
Next, you will also need to allow HTTP and HTTPS service through the firewall. You can allow them by running the following command:
Let’s Encrypt is a non profit certificate authority that provides a free SSL certificate to create a more secure and privacy respecting Web. To download the Let’s Encrypt server SSL and implement it on your website, you will need to install the Certbot client package on your server.
Run the following command to install the Certbot client package for Nginx:
dnf install certbot python3-certbot-nginx -y
Once the Certbot package is installed, run the following command to enable the SSL on your WordPress website.
You can now access the WordPress installation wizard by visiting the URL https://yourdomain.com. You will be redirected to the language selection page:
Select your language and click on the Continue button. You should see the following page:
Click on the Let’s go! button. You will be redirected to the database configuration page:
Provide your database configuration details and click on the Submit button. You should see the following page:
Click on the Run the installation button. You should see the WordPress site configuration page:
Provide your website information and click on the Install WordPress button. Once the installation has been finished, you should see the following page:
Click on the Log In button. You should see the WordPress login page:
Provide your admin credentials and click on the Log In button. You should see the WordPress dashboard page:
In the above guide, we explained how to install WordPress with Nginx and Let’s Encrypt SSL on CentOS 8. You can now start creating your own blog or website using WordPress and host it on the internet.
I am a fan of open source technology and have more than 10 years of experience working with Linux and Open Source technologies. I am one of the Linux technical writers for Cloud Infrastructure Services.
51vote
Article Rating
Subscribe
Login and comment with
I allow to create an account
When you login first time using a Social Login button, we collect your account public profile information shared by Social Login provider, based on your privacy settings. We also get your email address to automatically create an account for you in our website. Once your account is created, you'll be logged-in to this account.
DisagreeAgree
Login and comment with
I allow to create an account
When you login first time using a Social Login button, we collect your account public profile information shared by Social Login provider, based on your privacy settings. We also get your email address to automatically create an account for you in our website. Once your account is created, you'll be logged-in to this account.