|
服务器
nfs-服务器 192.168.99.53
apache服务器 192.168.99.62
mariadb服务器 192.168.99.64
nfs服务搭建
1
2
3
| [iyunv@centos7 wordpress]# cat /etc/exports
/data/application/web 192.168.99.0/24(rw)
/mydata 192.168.99.0/24(rw,no_root_squash)
|
1
| [iyunv@centos7 wordpress]# systemctl start nfs.service
|
查看nfs是否安装
nfs服务的主程序包nfs-utils
1
2
3
| [iyunv@centos7 web]# rpm -qa | grep nfs
nfs-utils-1.3.0-0.21.el7.x86_64
libnfsidmap-0.25-12.el7.x86_64
|
创建共享目录
1
2
| mkdir /data/application/web/ -pv
mkdir /mydata
|
查看apache服务用户
1
2
3
4
5
| [iyunv@web2 wordpress]# ps -ef | grep apache
root 25017 1 0 17:02 ? 00:00:00 /usr/local/apache24/bin/httpd -k start
apache 25019 25017 0 17:02 ? 00:00:00 /usr/local/apache24/bin/httpd -k start
apache 25020 25017 0 17:02 ? 00:00:00 /usr/local/apache24/bin/httpd -k start
apache 25021 25017 0 17:02 ? 00:00:00 /usr/local/apache24/bin/httpd -k start
|
1
2
3
4
5
| useradd -u 306 tom //tom用户映射到mariadb服务器上的mysql用户
groupadd -g 48 centos
useradd -u 48 -g 48 centos //centos用户映射到apache服务器上的apache用户
setfacl -m u:tom:rwx /mydata/ //设置tom用户对/mydata目录可读可写
setfacl -m u:centos:rwx /data/application/web/
|
配置nfs服务器
1
2
3
| [iyunv@centos7 mydata]# cat /etc/exports
/data/application/web 192.168.99.0/24(rw)
/mydata 192.168.99.0/24(rw,no_root_squash)
|
将wordpress项目源码放在共享目录
1
2
| [iyunv@centos7 web]# ls /data/application/web/
wordpress wordpress-4.5.3-zh_CN.zip
|
mysql服务器安装
1
2
3
4
| mkdir /data/mydata -pv
groupadd -r -g 306 mysql 创建mysql组
useradd -u 306 -g 306 -s /sbin/nologin mysql 创建mysql用户
|
mysql服务器安装
1
2
3
| [iyunv@centos7 local]# ln -sv mariadb-5.5.46-linux-x86_64 mysql
‘mysql’ -> ‘mariadb-5.5.46-linux-x86_64’
chown -R root.mysql mysql 修改mysql目录的权限
|
1
2
3
4
| 挂载nfs/mydata目录到mysql的/data/mydata目录
mount -t nfs 192.168.99.53:/mydata/ /data/mydata
./scripts/mysql_install_db --user=mysql --datadir=/data/mydata/ 安装db数据
|
mysql配置文件
1
2
| [iyunv@centos7 mysql]# cp support-files/my-large.cnf /etc/my.cnf
cp: overwrite ‘/etc/my.cnf’? y
|
修改配置文件
1
2
3
4
5
| [iyunv@centos7 mysql]# vim /etc/my.cnf
[mysqld] 添加
datadir = /data/mydata
innodb_file_per_table = ON
skip_name_resolve = ON
|
mysql的服务启动文件
1
| cp support-files/mysql.server /etc/rc.d/init.d/mysqld
|
安装mysql客户端
创建wps连接表
1
2
3
4
5
6
| MariaDB [(none)]> create database wps;
Query OK, 1 row affected (0.01 sec)
MariaDB [(none)]> GRANT ALL ON wps.* TO 'wps_user'@'192.168.%.%' IDENTIFIED BY 'wps_pass';
Query OK, 0 rows affected (0.00 sec)
MariaDB [(none)]> FLUSH PRIVILEGES;
Query OK, 0 rows affected (0.00 sec)
|
apache服务器
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
| yum -y install httpd php php-mysql php-xcache
挂载nfs服务器
mount -t nfs 192.168.99.53:/data/application/web /var/www/html/
配置apache虚拟主机
[iyunv@web2 conf.d]# cat vhost1.conf
<VirtualHost *:80>
ServerName www.runner.vip
DocumentRoot /var/www/html/wordpress
DirectoryIndex index.php
<Directory "/var/www/html/wordpress">
Options None
AllowOverride None
Require all granted
</Directory>
</VirtualHost>
|
|
|
|