Operations 5 min read

Step-by-Step Guide to 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 its database, and verifying the site works, providing all necessary commands and configuration details.

MaGe Linux Operations
MaGe Linux Operations
MaGe Linux Operations
Step-by-Step Guide to Deploy WordPress with NFS on CentOS 7

1 Server-side Configuration

1 Install nfs-utils

# yum install nfs-utils

2 Edit export file

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

3 Create shared directories

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

4 Start NFS service

# systemctl start nfs.service

2 Client Configuration

1 Mount shared directories

(1) Create mount point # mkdir /var/www/html/ (2) Mount /data/web to /var/www/html and /data/mysql to /var/lib/mysql

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

2 Install LAMP stack

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

3 Create virtual host for WordPress

# vim /etc/httpd/conf.d/vhost.conf
<VirtualHost *:80>
DocumentRoot "/var/www/html"
ServerName www.mywordpress.com
<Directory "/var/www/html">
AllowOverride None
Require all granted
</Directory>
</VirtualHost>
# mkdir /var/www/html

4 Test Apache configuration and start service

# httpd -t
# systemctl start httpd.service

5 Deploy WordPress

Extract the WordPress tarball and copy files to DocumentRoot.

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

Set write permission for wp-content.

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

6 Start MariaDB

# systemctl start mariadb

7 Configure WordPress database connection

# vim /var/www/html/wordpress/wp-config.php
define('DB_NAME','wordpress');
define('DB_USER','test1');
define('DB_PASSWORD','123456');
define('DB_HOST','localhost');

8 Create database and user in MariaDB

create database wordpress;
create user 'test1'@'localhost' identified by '123456';
grant all on wordpress.* to 'test1'@'localhost';

9 Test the site

Open http://192.168.29.110/wordpress/ in a browser. The blog should be displayed.

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.

DeploymentWordPressLAMP
MaGe Linux Operations
Written by

MaGe Linux Operations

Founded in 2009, MaGe Education is a top Chinese high‑end IT training brand. Its graduates earn 12K+ RMB salaries, and the school has trained tens of thousands of students. It offers high‑pay courses in Linux cloud operations, Python full‑stack, automation, data analysis, AI, and Go high‑concurrency architecture. Thanks to quality courses and a solid reputation, it has talent partnerships with numerous internet firms.

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.