If we previously discussed how to install WordPress on Debian and Ubuntu, now we will discuss how to install WordPress on CentOS 7.
To install WordPress on CentOS 7, we will use the LAMP Stack (Linux, Apache, MariaDB, and of course, PHP). Why not use MySQL instead of MariaDB?
Because by default, MySQL is not in the CentOS repository, so the installation process would take longer. This is different from MariaDB, which can be installed directly using yum.
How to Install WordPress on a CentOS 7 VPS
If your server is new and has not been updated, it is recommended to perform an update first using the command below. However, if your server is already updated, you can proceed to the next step to install WordPress.
sudo yum update -y1. Install the LAMP Stack (Apache, PHP, and MariaDB)
To perform the LAMP installation, you need to have access as a root user. If you are not logged in as root, you can use the command sudo su – to switch to the root user.
To install Apache, you can use this command
yum install httpd -yNext, you need to install MariaDB using this command
yum install mariadb-server -yThis MariaDB installation is not yet secure and is just a default installation. To secure your MySQL installation, you can follow these steps: Secure MySQL Installation.
Next, check whether MariaDB is running or not
sudo systemctl status mariadb● mariadb.service - MariaDB database server Loaded: loaded (/usr/lib/systemd/system/mariadb.service; disabled; vendor preset: disabled) Active: inactive (dead)If the status is still disabled, you can start it with this command
sudo systemctl start mariadbsudo systemctl status mariadbIf the process is running, the result will look like this
Next, for the PHP installation, since CentOS defaults to PHP 5.4, but WordPress requires PHP 7.4 (System Requirements WordPress), we will use the Remi repository to install PHP 7.4
sudo yum install -y http://rpms.remirepo.net/enterprise/remi-release-7.rpmAfter adding the Remi Repository, update yum before installing PHP 7.4
sudo yum update -yOnce updated, we can then install PHP 7.4 along with other extensions
sudo yum --enablerepo=remi-php74 install php php-bz2 php-mysql php-curl php-gd php-intl php-common php-mbstring php-xml -yWhen the installation process is complete, you need to restart the httpd server (Apache)
sudo systemctl restart httpdIf all installation processes are complete, you can visit your server's public IP address in a browser, and you will see a display like this.
2. Create a WordPress Database
Before installing WordPress, we need to create a database that will be used to store WordPress data.
To create a database, you can open MySQL with this command
mysql -u rootNext, create a database, for example, a database named wpgan_db
create database wpgan_db;Since using the root user is not recommended when creating a public WordPress site, we can create a user to access the database wpgan_db. Here, for example, I will create a user named wpgan_user and a password wpgan_password_db.
CREATE USER 'wpgan_user '@'localhost' IDENTIFIED BY 'wpgan_password_db';At this point, we have successfully created a database user, but they do not yet have access rights to the database, so we need to grant them access first
GRANT ALL PRIVILEGES ON wpgan_db.* TO 'wpgan_user'@'localhost';Before closing MySQL, we need to update the access rights with this command
FLUSH PRIVILEGES;If everything is finished, we can exit the MySQL page with this command
quit3. Download and Install WordPress
Before downloading WordPress, we can open the /tmp/ folder first to save the WordPress zip file into that folder
cd /tmpAfter being in the /tmp/ folder, we can download the latest version of WordPress from WordPress.org using wget. If you can install wget, you can install it first
sudo yum install wget -yAfter wget is installed, you can now download WordPress with this command
wget http://WordPress.org/latest.tar.gzNext, extract the downloaded WordPress file so it can be used
sudo tar -xzvf latest.tar.gzAfter extracting, we can move all the WordPress files into our LAMP Stack folder. The main folder is located at /var/www/html. If you want to move them directly using the move method, you can use this command
sudo mv /tmp/wordpress/* /var/www/html/If you want to move the files using the copy method, you can use this command
sudo cp /tmp/wordpress/* /var/www/html/ -rThe final step before configuring WordPress is to update the access rights for every one of your WordPress files and folders
sudo chown -R apache.apache /var/www/html/4. Configure WordPress
To configure WordPress, you can directly visit your server's public IP address in your browser, and at the beginning of the configuration, you can proceed by clicking the button Let’s go to continue the WordPress installation.
Enter the database details you created previously, then click Submit to start creating the WordPress admin user, and the installation process is complete.
Conclusion
Installing WordPress on CentOS does seem easier compared to using Ubuntu or Debian, but it is highly recommended to use a control panel like cPanel, Webuzo, Cyberpanel, and so on, so that you can manage your website more easily.
Because the support period for CentOS 7 will end soon on June 30, 2024, it is recommended to use the Rocky Linux OS, as both are very similar, so you will not experience any difficulties.
COMMENTS
Loading...