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.
1 Server-side Configuration
1 Install nfs-utils
# yum install nfs-utils2 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/mysql4 Start NFS service
# systemctl start nfs.service2 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 -y3 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/html4 Test Apache configuration and start service
# httpd -t
# systemctl start httpd.service5 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 mariadb7 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.
Signed-in readers can open the original source through BestHub's protected redirect.
This article has been distilled and summarized from source material, then republished for learning and reference. If you believe it infringes your rights, please contactand we will review it promptly.
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.
How this landed with the community
Was this worth your time?
0 Comments
Thoughtful readers leave field notes, pushback, and hard-won operational detail here.
