1.准备工作
a.关闭两台虚拟机的安全软件
客户端:
[root@master ~]# systemctl stop firewalld
[root@master ~]# systemctl disable firewalld
[root@master ~]# systemctl status firewalld
○ firewalld.service - firewalld - dynamic firewall daemon
Loaded: loaded (/usr/lib/systemd/system/firewalld.service; disabled; vendor>
Active: inactive (dead)
Docs: man:firewalld(1)
[root@master ~]# getenforce
Disabled
服务端:
[root@node1 ~]# systemctl stop firewalld
[root@node1 ~]# systemctl disable firewalld
[root@node1 ~]# systemctl status firewalld
○ firewalld.service - firewalld - dynamic firewall daemon
Loaded: loaded (/usr/lib/systemd/system/firewalld.service; disabled; vendor>
Active: inactive (dead)
Docs: man:firewalld(1)
[root@node1 ~]# getenforce
Disabled
b.两台虚拟机,一台是客户端(web),一台是服务端(nfs),修改两台主机名称为web,nfs
客户端(web):
[root@master ~]# hostnamectl set-hostname web
[root@master ~]# bash
[root@web ~]#
nfs端(nfs):
[root@node1 ~]# hostnamectl set-hostname nfs
[root@node1 ~]# bash
[root@nfs ~]#
2.服务端(nfs)配置
a.安装mariadb,mariadb-server,nfs-utils相关软件
[root@nfs /]# yum install mariadb mariadb-server nfs-utils -y
b.上传软件
使用xftp将nextcloud-25.0.1.zip软件压缩包上传到Linux的根目录,并解压缩
解压缩:
[root@nfs ~]cd /
[root@nfs /]# unzip /nextcloud-25.0.1.zip
c.设置nextcloud安装命令权限
[root@nfs /]# chmod -R 777 /nextcloud
d.设置数据库
#启动mariadb
[root@nfs /]# systemctl start mariadb
#进入mysql以root的身份运行
[root@nfs /]# mysql -uroot -p
Enter password:
Welcome to the MariaDB monitor. Commands end with ; or \g.
Your MariaDB connection id is 3
Server version: 10.5.29-MariaDB MariaDB Server
Copyright (c) 2000, 2018, Oracle, MariaDB Corporation Ab and others.
Type 'help;' or '\h' for help. Type '\c' to clear the current input statement.
#创建数据库
MariaDB [(none)]> create database nextcloud;
Query OK, 1 row affected (0.001 sec)
#创建用户及密码,%是允许远程连接设备
MariaDB [(none)]> create user 'nextcloud'@'%' identified by '123456';
Query OK, 0 rows affected (0.001 sec)
#设置权限
MariaDB [(none)]> grant all on nextcloud.* to 'nextcloud'@'%';
Query OK, 0 rows affected (0.001 sec)
#退出数据库
MariaDB [(none)]> exit
Bye
e.重启数据库
[root@nfs /]# systemctl restart mariadb
f.编写nfs主配置文件/etc/exports
#编辑配置文件,写入共享的文件和ip地址,权限
[root@nfs ~]#vim /etc/exports
/nextcloud 192.168.75.154/24(rw,all_squash,sync)
g.先重启rpc服务,在重启nfs服务
[root@nfs /]# systemctl enable --now rpcbind
[root@nfs /]# systemctl enable --now nfs-server
3.客户端(web)配置
a.安装nginx,php,autofs,nfs-utils相关软件
[root@web ~]# yum install nginx autofs nfs-utils -y
b.查询服务端(nfs)远程共享的目录
[root@web ~]# showmount -e 192.168.75.155
Export list for 192.168.75.155:
/nextcloud 192.168.75.154/24
c.编辑autofs自动挂载服务配置文件/etc/auto.master
#编辑配置文件,定位第7行在下面写入代码
[root@web ~]# vim /etc/auto.master
/misc /etc/auto.misc
/lei /etc/auto.jun
d.编辑上面的目录/etc/auto.jun
#编写子目录写入代码
[root@web ~]# vim /etc/auto.jun
jun 192.168.75.155:/nextcloud
e.启动autofs服务
[root@web ~]# systemctl restart nginx
f.查看服务端共享的文件
[root@web jun]# ls
3rdparty console.php dist occ public.php status.php
apps COPYING index.html ocm-provider remote.php themes
AUTHORS core index.php ocs resources updater
config cron.php lib ocs-provider robots.txt version.