标签:lamp nfs
在A主机上安装httpd,php,mariadb,nfs-utils,作为nfs client,在B主机上安装nfs-tuils,作为nfs server。A主机IP 172.16.252.115,B主机IP 172.16.251.119.
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主机:
~]#id mysql
B主机:
~]#useradd -r -u 27 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.251.119:/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
~]#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
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;
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:
通过nfs挂载共享目录的方式搭建lamp平台并安装wordpress(二)
标签:lamp nfs
原文地址:http://tiankongzhiling.blog.51cto.com/11639803/1829077