In this tutorial, we are providing the steps to install WordPress with Apache web server on ALamLinux or Rocky Linux 8 running VPS, Cloud Hosting, or local Server using the command line.
WordPress doesn’t need any introduction whosoever is in blogging or web development would already know about this opens source content management system. Millions of websites are currently running on it with the help of Apache-webserver. And if you have recently purchased some cloud or virtual private hosting server where you are running Alamlinux or Rocky Linux 8 and want to install your WordPress along with LAMP (Linux, Apache, MySQL, PHP) stack then here are the steps to follow.
Note: We recommend using any Web hosting control panel to install and manage WordPress such as Cpanel or any open source, here is the list of best open source hosting control panels.
Steps to install WordPress on Rocky Linux 8 | AlmaLinux 8
The user can follow the given steps for CentOS 8 as well however as it has not been an LTS supported version anymore, hence, you must opt for Alma, Rocky or any other Long term supported Linux.
Update DNF repository cache
Run the system update command that will refresh the system repository cache to build a new one with an updated list of packages available for installation from the system repositories.
sudo dnf update
sudo dnf install wget nano -y
Install Apache HTTPd on Almalinux or rocky
To serve WordPress webpages over a local or internet network using a browser we need a web server. And here we are going to install a popular Apache webserver.
sudo dnf install httpd -y
Start and enable Apache system service
sudo systemctl enable --now httpd
systemctl status httpd
Enable Rewrite module:
sudo nano /etc/httpd/conf/httpd.conf
At the end of the file add this line:
LoadModule rewrite_module modules/mod_rewrite.so
Save it using Ctrl+O, hit the Enter key, and then Ctrl+X to exit.
Install MariaDB and PHP 8.0
The next thing we need is the MySQL or MariaDB database to store data and PHP language on our AlmaLinux or Rocky 8 because WordPress has been written in PHP.
sudo dnf install mariadb
Start and enable its service
sudo systemctl enable --now mariadb
systemctl status mariadb
Secure your Database installation
Go through the guided text-based wizard to secure the MariaDB/MySQL
For PHP 8.0 and its extensions
By default, the PHP 7.2 version is available to install from the App stream repository of Almalinux or Rocky but WordPress needs PHP 7.4 or above hence we will go for the latest version i.e PHP 8.0
For PHP 8.0 we need to enable the REMI repository.
sudo dnf install -y https://.......