在A主機上安裝httpd,php,mariadb,nfs-utils,作為nfs client,在B主機上安裝nfs-tuils,作為nfs server。A主機IP172.16.252.201,B主機IP 172.16.254.164。
在A主機上安裝httpd,php,php-mysql,mariadb,nfs-utils
~]# yum install httpd php php-mysql mariadb-server nfs-utils2.在B主機上安裝nfs-tuils,創建共享目錄/data/application/web並啟動nfs服務:
~]#yum install nfs-utils
~]#mkdir -pv /data/application/web
~]#systemctl start nfs-server.service
3.在A主機上查看apache用戶的uid,然後在B主機上創建相同用戶
A主機:
~]#id apache
B主機:
~]#useradd -r -u 48 apache
4.編輯B主機上的/etc/exports文件,導出/data/application/web目錄
~]#chown -R apache:apache /data/application/web
~]#vim /etc/exports
/data/application/web 172.16.0.0/16(rw)
~]#exportfs -ar
5.編輯A主機上/etc/httpd/conf/httpd.conf,修改默認主頁為index.php,域名為www1.magedu.com,啟動httpd服務
~]#vim /etc/httpd/conf/httpd.conf
ServerNamewww1.magedu.com:80
DirectoryIndexindex.php index.html
~]#systemctl start httpd.service
6.在A主機上啟動數據庫服務,創建數據庫testdb,用戶testuser,密碼testpasswd,並做授權,:
~]#systemctl start mariadb.server
~]# mysql
MariaDB[(none)]>CREATEDATABASE testdb;MariaDB[(none)]>CREATEUSER ‘testuser’@’127.0.0.1’ IDENTIFIED BY ‘testpasswd’;MariaDB[(none)]>GRANTALL ON testdb.* TO ‘testuser’@’127.0.0.1’;MariaDB[(none)]>FLUSHPRIVILEGES;7.在B主機上下載wordpress並解壓至/data/application/web目錄,編輯wordpress配置文件如下:
~]# unzipwordpress_4.3.1_zh_CN.zip
~]# mv -rwordpress/* /data/application/web
~]#cd /data/application/web
~]# mvwp-config-sample.php wp-config.php
~]# vim wp-config.php
8.在windows主機上修改hosts文件並用浏覽器測試worepress: