Operations 6 min read

Step-by-Step Guide: Deploy WordPress with NFS on CentOS 7

This tutorial walks through configuring an NFS server and client on CentOS 7, installing the LAMP stack, setting up a virtual host, deploying WordPress, configuring the MySQL database, and verifying the site works, providing complete command‑line instructions and code snippets.

Raymond Ops
Raymond Ops
Raymond Ops
Step-by-Step Guide: Deploy WordPress with NFS on CentOS 7

Experiment Content

Host IPs: NFS server 192.168.29.120, NFS client 192.168.29.110.

Requirements

NFS server shares /data/web and /data/mysql.

NFS client mounts these directories and deploys WordPress.

Server‑side Configuration

Install

nfs-utils

:

<code># yum install nfs-utils</code>

Edit

/etc/exports

to share the directories:

<code>/data/web    *(rw,no_root_squash)
/data/mysql  *(rw,no_root_squash)</code>

Create the shared directories:

<code># mkdir -pv /data/web/
# mkdir -pv /data/mysql</code>

Start the NFS service:

<code># systemctl start nfs.service</code>

Client‑side Configuration

Create the mount point:

<code># mkdir /var/www/html</code>

Mount the NFS shares:

<code># mount -t nfs 192.168.29.120:/data/web /var/www/html
# mount -t nfs 192.168.29.120:/data/mysql /var/lib/mysql</code>

Install the LAMP stack:

<code># yum install httpd mariadb-server php php-mysql -y</code>

Create a virtual host for WordPress:

<code>&lt;VirtualHost *:80&gt;
DocumentRoot "/var/www/html"
ServerName www.mywordpress.com
&lt;Directory "/var/www/html"&gt;
AllowOverride None
Require all granted
&lt;/Directory&gt;
&lt;/VirtualHost&gt;</code>

Check Apache syntax and start the service:

<code># httpd -t
# systemctl start httpd.service</code>

Extract WordPress and copy to the document root:

<code># tar -xf wordpress-4.7.4-zh_CN.tar.gz
# cp -a wordpress /var/www/html/</code>

Give write permission to

wp-content

:

<code># chmod o+w /var/www/html/wordpress/wp-content/</code>

Start MariaDB:

<code># systemctl start mariadb</code>

Edit

wp-config.php

with database credentials (DB_NAME, DB_USER, DB_PASSWORD, DB_HOST).

Create the WordPress database and user, then grant privileges:

<code>CREATE DATABASE wordpress;
CREATE USER 'test1'@'localhost' IDENTIFIED BY '123456';
GRANT ALL ON wordpress.* TO 'test1'@'localhost';</code>

Test the site by opening

http://192.168.29.110/wordpress/

in a browser.

WordPress site screenshot
WordPress site screenshot
MySQLServer ConfigurationNFSCentOSWordPressLAMP
Raymond Ops
Written by

Raymond Ops

Linux ops automation, cloud-native, Kubernetes, SRE, DevOps, Python, Golang and related tech discussions.

0 followers
Reader feedback

How this landed with the community

login Sign in to like

Rate this article

Was this worth your time?

Sign in to rate
Discussion

0 Comments

Thoughtful readers leave field notes, pushback, and hard-won operational detail here.