1.準備工作
a.關閉兩臺虛擬機的安全軟件
客戶端:
[root@master ~]# systemctl stop firewalld
[root@master ~]# systemctl disable firewalld
[root@master ~]# systemctl status firewalld
○ firewalld.service - firewalld - dynamic firewall daemonLoaded: 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 daemonLoaded: 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 ServerCopyright (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.