魏蓝

以梦为马

导航

NFS服务 LAP+MySQL+NFS

一、环境准备

10.0.0.16 mariadb
10.0.0.14 nfs
10.0.0.22 web

二、配置

1.配置数据库10.0.0.16

yum install -y mariadb-server
mysql
MariaDB [(none)]> create database wordpress;
MariaDB [(none)]> create user wordpress@'10.0.0.%' identified by '123456';
MariaDB [(none)]> grant all on wordpress.* to wordpress@'10.0.0.%';

2.配置nfs10.0.0.14

mkdir /data/wordpress
chmod 777 /data/wordpress/
wget https://cn.wordpress.org/latest-zh_CN.tar.gz
tar xf latest-zh_CN.tar.gz
mv wordpress/* /data/wordpress/
vim /etc/exports
/data/wordpress 10.0.0.0/24(rw)
yum install nfs-utils -y
systemctl enable --now nfs-server

3.配置web10.0.0.22

yum install php-fpm php-mysqlnd php-json
yum install httpd
systemctl enable --now httpd php-fpm
yum install nfs-utils
vim /etc/fstab
10.0.0.14:/data/wordpress /var/www/html nfs _netdev 0 0
showmount -e 10.0.0.14
mount -a
ls /var/www/html
systemctl enable --now nfs-server

 

 三、优化

1.web10.0.0.22

umount /var/www/html
rm -rf /var/www/html/*

2.nfs10.0.0.14

scp /data/wordpress/wp-config.php 10.0.0.18:/var/www/html/

3.web10.0.0.22

vim /etc/fstab
10.0.0.14:/data/wordpress/wp-content/uploads /var/www/html/wp-content/upload nfs _netdev 0 0
mkdir /var/www/html/wp-content/uploads -p
cp -av wordpress/* /var/www/html
chown -R apache.apache /var/www/html
usermod -u 88 www
groupmod -g 88 www
chown -R www.www /data/wordpress/wp-content/
vim /etc/exports
/data/wordpress 10.0.0.0/24(rw,all_squash,anonuid=88,anongid=88)
exportfs -r
exportfs -v

 

 

 

 

posted on 2022-05-06 16:10  魏蓝  阅读(59)  评论(0编辑  收藏  举报