标签:nfs lamp
在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-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 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:
通过nfs挂载共享目录的方式搭建lamp平台并安装wordpress(一)
标签:nfs lamp
原文地址:http://tiankongzhiling.blog.51cto.com/11639803/1829076