在A主机上安装httpd,php,mariadb,nfs-utils,作为nfs client,在B主机上安装nfs-tuils,作为nfs server。A主机IP172.16.54.3,B主机IP 172.16.54.4。
在A主机上安装httpd,php,php-mysql,mariadb,nfs-utils
~]# yum install httpd php php-mysql mariadb-server nfs-utils
2.在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 55 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
CREATEDATABASE testdb
CREATEUSER ‘testuser’@’127.0.0.1’ IDENTIFIED BY ‘testpasswd’;
GRANTALL ON testdb.* TO ‘testuser’@’127.0.0.1’;
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:
在A主机上安装httpd,php,mariadb,nfs-utils,作为nfs client,在B主机上安装nfs-tuils,作为nfs server。A主机IP 172.16.52.1,B主机IP 172.16.54.2.
1.在A主机上安装httpd,php,php-mysql,mariadb,nfs-utils
~]# yum install httpd php php-mysql mariadb-server nfs-utils
2.在B主机上安装nfs-tuils,创建共享目录/data并启动nfs服务:
~]#yum install nfs-utils
~]#mkdir /data
~]#systemctl start nfs-server.service
3.在A主机上查看mysql用户的uid,然后在B主机上创建该用户,然后修改/data目录的属主和属组:
A主机:
~]#查看mysql ID号,注意要在b主机上建立一个和该ID号一样的用户
B主机:
~]#useradd -r -u22 mysql
~]#chown mysql:mysql /data
4.在B主机上导出/data目录给172.16.0.0/16网段
~]#vim /etc/exports
/data172.16.0.0/16(rw)
5.在A主机上创建目录/mydata,修改属主属组为mysql,挂载B主机的/data目录至/mydata
~]#mkdir /mydata
~]#chown mysql.mysql /mydata
~]#mount -t nfs 172.16.54.2:/data /mydata
6.在A主机上编辑mariadb的配置文件/etc/my.cnf,修改数据目录为/mydata,关闭selinux并启动mariadb
~]# vim/etc/my.cnf
datadir=/mydata
innodb_file_per_table= ON
skip_name_resolve= ON
~]#getenforce
setenforce 0
~]#systemctl start mariadb.service
7.编辑/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
~]#httpd -t
~]# systemctl start httpd.service
8.在A主机上启动数据库服务,创建数据库testdb,用户testuser,密码testpasswd,并做授权,:
~]#systemctl start mariadb.server
~]# mysql
CREATEDATABASE testdb;
CREATEUSER ‘testuser’@’127.0.0.1’ IDENTIFIED BY ‘testpasswd’;
GRANTALL ON testdb.* TO ‘testuser’@’127.0.0.1’;
FLUSHPRIVILEGES;
9. 在A主机上下载wordpress并解压至/var/www/html目录,编辑wordpress配置文件如下:
~]# unzipwordpress_4.3.1_zh_CN.zip
~]# mv -rwordpress/* /var/www/html
~]#cd /var/www/html
~]# mvwp-config-sample.php wp-config.php
~]# vimwp-config.php
10. 在windows主机上修改hosts文件并用浏览器测试worepress: