How to Install WordPress with LAMP on CentOS Stream 10

WordPress is a widely used PHP-based CMS (Content Management System). It is suitable for small businesses, personal blogs, and websites. In this guide, we will go through the installation of WordPress on CentOS Stream 10.

Pre-requisites:

  • A system with CentOS Stream 10 installed and running.
  • root access to the system.
  • LAMP Stack installed and running, for this, you can refer to one of our guides on installing the LAMP Stack (Apache, MariaDB, and PHP) .

Install Required Dependencies

dnf groupinstall "Development tools" -y
dnf install wget -y

Output

[root@vps ~]# dnf groupinstall "Development tools" -y
dnf install wget -y
Last metadata expiration check: 0:25:56 ago on Sat 22 Feb 2025 02:48:23 PM UTC.
Dependencies resolved.
================================================================================
 Package                             Arch   Version             Repo       Size
================================================================================
Installing group/module packages:
 asciidoc                            noarch 10.2.0-12.el10      appstream 429 k
 autoconf                            noarch 2.71-12.el10        appstream 736 k
 automake                            noarch 1.16.5-20.el10      appstream 702 k
 bison                               x86_64 3.8.2-9.el10        appstream 1.0 M
 byacc                               x86_64 2.0.20230521-7.el10 appstream 116 k
 diffstat                            x86_64 1.66-3.el10         appstream  46 k
 flex                                x86_64 2.6.4-19.el10       appstream 298 k

Download WordPress

Navigate to the /var/www directory:

cd /var/www

Download the latest WordPress archive:

wget https://wordpress.org/latest.tar.gz

Output

[root@vps ~]# cd /var/www
[root@vps www]# wget https://wordpress.org/latest.tar.gz
--2025-02-22 15:17:55--  https://wordpress.org/latest.tar.gz
Resolving wordpress.org (wordpress.org)... 198.143.164.252
Connecting to wordpress.org (wordpress.org)|198.143.164.252|:443... connected.
HTTP request sent, awaiting response... 200 OK
Length: 26780969 (26M) [application/octet-stream]
Saving to: ‘latest.tar.gz’

latest.tar.gz       100%[===================>]  25.54M  34.0MB/s    in 0.8s

2025-02-22 15:17:57 (34.0 MB/s) - ‘latest.tar.gz’ saved [26780969/26780969]

Verify the downloaded file:

ls

Output

[root@vps www]# ls
cgi-bin  html  latest.tar.gz

Extract the WordPress archive:

tar xvzf latest.tar.gz

After extraction, remove the archive file:

rm -v latest.tar.gz

Setting up File Permissions & Ownership

Change the owner and group of the wordpress/ directory:

chown -Rf apache:apache ./wordpress/

Set appropriate permissions:

chmod -Rf 775 ./wordpress/

If SELinux is enabled, apply the correct security context:

semanage fcontext -a -t httpd_sys_rw_content_t "/var/www/wordpress(/.*)?"
restorecon -Rv /var/www/wordpress

Configuring Apache Virtual Host

Create a new Apache configuration file:

vi /etc/httpd/conf.d/wordpress.conf

Insert the following configuration:

<VirtualHost *:80>
    ServerAdmin root@localhost
    DocumentRoot /var/www/wordpress
    <Directory "/var/www/wordpress">
        Options Indexes FollowSymLinks
        AllowOverride all
        Require all granted
    </Directory>
    ErrorLog /var/log/httpd/wordpress_error.log
    CustomLog /var/log/httpd/wordpress_access.log common
</VirtualHost>

Save and exit (Esc -> :wq! -> Enter).

Restart Apache:

systemctl restart httpd
systemctl status httpd

Output

[root@vps www]# systemctl restart httpd
systemctl status httpd
● httpd.service - The Apache HTTP Server
     Loaded: loaded (/usr/lib/systemd/system/httpd.service; enabled; preset: di>
    Drop-In: /etc/systemd/system/httpd.service.d
             └─php-fpm.conf
     Active: active (running) since Sat 2025-02-22 15:22:25 UTC; 56ms ago
 Invocation: 2bf3d32cdd2a4354ad921ff3b676e377
       Docs: man:httpd.service(8)
   Main PID: 45704 (httpd)
     Status: "Started, listening on: port 80"
      Tasks: 177 (limit: 23188)
     Memory: 13.8M (peak: 14.3M)
        CPU: 162ms
     CGroup: /system.slice/httpd.service
             ├─45704 /usr/sbin/httpd -DFOREGROUND
             ├─45706 /usr/sbin/httpd -DFOREGROUND
             ├─45707 /usr/sbin/httpd -DFOREGROUND
             ├─45709 /usr/sbin/httpd -DFOREGROUND
             └─45710 /usr/sbin/httpd -DFOREGROUND

Feb 22 15:22:25 vps.server.com systemd[1]: Starting httpd.service - The Apache >
Feb 22 15:22:25 vps.server.com (httpd)[45704]: httpd.service: Referenced but un>
Feb 22 15:22:25 vps.server.com httpd[45704]: Server configured, listening on: p>
Feb 22 15:22:25 vps.server.com systemd[1]: Started httpd.service - The Apache H>

Configuring Database

Create a database, user, and set privileges for WordPress:

mysql -u root

Inside the MySQL prompt, run:

CREATE DATABASE wordpress;
GRANT ALL ON wordpress.* TO 'wordpress'@'localhost' IDENTIFIED BY 'secret';
FLUSH PRIVILEGES;
quit;

Access WordPress

Open your browser and navigate to:

http://IP_address

Replace IP_address with your actual server IP. Follow the on-screen instructions to complete the WordPress setup.

Congratulations! You have successfully installed WordPress with LAMP on CentOS Stream 10.


CrownCloud - Get a SSD powered KVM VPS at $4.5/month!
Use the code WELCOME for 10% off!

1 GB RAM / 25 GB SSD / 1 CPU Core / 1 TB Bandwidth per month

Available Locations: LAX | MIA | ATL | FRA | AMS