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: # yum install nfs-utils Edit /etc/exports to share the directories:

/data/web    *(rw,no_root_squash)
/data/mysql  *(rw,no_root_squash)

Create the shared directories:

# mkdir -pv /data/web/
# mkdir -pv /data/mysql

Start the NFS service:

# systemctl start nfs.service

Client‑side Configuration

Create the mount point: # mkdir /var/www/html Mount the NFS shares:

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

Install the LAMP stack:

# yum install httpd mariadb-server php php-mysql -y

Create a virtual host for WordPress:

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

Check Apache syntax and start the service:

# httpd -t
# systemctl start httpd.service

Extract WordPress and copy to the document root:

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

Give write permission to wp-content: # chmod o+w /var/www/html/wordpress/wp-content/ Start MariaDB: # systemctl start mariadb Edit wp-config.php with database credentials (DB_NAME, DB_USER, DB_PASSWORD, DB_HOST).

Create the WordPress database and user, then grant privileges:

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

Test the site by opening http://192.168.29.110/wordpress/ in a browser.

WordPress site screenshot
WordPress site screenshot
Original Source

Signed-in readers can open the original source through BestHub's protected redirect.

Sign in to view source
Republication Notice

This article has been distilled and summarized from source material, then republished for learning and reference. If you believe it infringes your rights, please contactadmin@besthub.devand we will review it promptly.

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

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.