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.
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/mysqlStart the NFS service:
# systemctl start nfs.serviceClient‑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/mysqlInstall the LAMP stack:
# yum install httpd mariadb-server php php-mysql -yCreate 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.serviceExtract 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.
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.
Raymond Ops
Linux ops automation, cloud-native, Kubernetes, SRE, DevOps, Python, Golang and related tech discussions.
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.
