安装Nextcloud
首先在宝塔设置网页,建立网盘的目录
然后到官网下载安装包,直接解压到网盘的根目录下
最后再在DNS把子域名加入就好了:
访问 pan.bonky.top
就可以进行对网盘的设置。记得要改数据库为mysql
挂载OneDrive
获取Token
正式配置前,需要通过可以使用浏览器的电脑进行授权
网上的教程大多是通过 Windows 系统来获取授权,但是本人使用 macOS,所以这一步是我通过搜索引擎单独进行操作的。
通过访问Rclone downloads,下载适合自己电脑的版本并解压,或者通过 Termial 下载安装。
通过 Termial 下载
cd && curl -O https://downloads.rclone.org/rclone-current-osx-amd64.zip
解压
unzip -a rclone-current-osx-amd64.zip && cd rclone-*-osx-amd64
移动位置(这一步需要输入macOS密码)
sudo mkdir -p /usr/local/bin
sudo mv rclone /usr/local/bin/
运行 rclone 开始配置
cd /usr/local/bin
rclone authorize "onedrive"
获取Token
把整个大括号以及里面的内容复制下来
准备
转载于:https://vipiu.net/archives/2019/08/02/2172.html
先安装一下基本组件
yum -y install wget unzip screen fuse fuse-devel
使用官方的一键安装命令即可,输入下面的命令:
curl https://rclone.org/install.sh | sudo bash
配置
接着就输入以下命令进行 rclone 设置
rclone config
输入命令后
2019/08/02 10:55:49 NOTICE: Config file "/root/.config/rclone/rclone.conf" not found - using defaults
No remotes found - make a new one
n) New remote
s) Set configuration password
q) Quit config
n/s/q> n
这里我们选择 n,创建一个新的。
然后输入名字,回车
name> onedrive
这个名字随意就行,自己记住就好了
选择需要挂载的网盘
Type of storage to configure.
Enter a string value. Press Enter for the default ("").
Choose a number from below, or type in your own value
1 / A stackable unification remote, which can appear to merge the contents of several remotes
\ "union"
2 / Alias for an existing remote
\ "alias"
3 / Amazon Drive
\ "amazon cloud drive"
4 / Amazon S3 Compliant Storage Provider (AWS, Alibaba, Ceph, Digital Ocean, Dreamhost, IBM COS, Minio, etc)
\ "s3"
5 / Backblaze B2
\ "b2"
6 / Box
\ "box"
7 / Cache a remote
\ "cache"
8 / Dropbox
\ "dropbox"
9 / Encrypt/Decrypt a remote
\ "crypt"
10 / FTP Connection
\ "ftp"
11 / Google Cloud Storage (this is not Google Drive)
\ "google cloud storage"
12 / Google Drive
\ "drive"
13 / Hubic
\ "hubic"
14 / JottaCloud
\ "jottacloud"
15 / Koofr
\ "koofr"
16 / Local Disk
\ "local"
17 / Mega
\ "mega"
18 / Microsoft Azure Blob Storage
\ "azureblob"
19 / Microsoft OneDrive
\ "onedrive"
20 / OpenDrive
\ "opendrive"
21 / Openstack Swift (Rackspace Cloud Files, Memset Memstore, OVH)
\ "swift"
22 / Pcloud
\ "pcloud"
23 / QingCloud Object Storage
\ "qingstor"
24 / SSH/SFTP Connection
\ "sftp"
25 / Webdav
\ "webdav"
26 / Yandex Disk
\ "yandex"
27 / http Connection
\ "http"
Storage> 19
我们今天主要是挂在 onedrive,所以这里选择 19,根据实际来选择,rclone 版本不一样选择也不一样。
下面就是 client_id >
和 client_secret>
,这两项直接回车,不管
Microsoft App Client Id
Leave blank normally.
Enter a string value. Press Enter for the default ("").
client_id>
Microsoft App Client Secret
Leave blank normally.
Enter a string value. Press Enter for the default ("").
client_secret>
是否配置高级设置,这里我们直接 No,选择 n
Edit advanced config? (y/n)
y) Yes
n) No
y/n> n
是否使用自动设置,同样直接 NO,选择 n
Use auto config?
* Say Y if not sure
* Say N if you are working on a remote or headless machine
y) Yes
n) No
y/n> n
这一步就需要用到我们刚才在 win 获取到的 access_token
For this to work, you will need rclone available on a machine that has a web browser available.
Execute the following on your machine:
rclone authorize "onedrive"
Then paste the result below:
result>
按照图片格式把获取到的 access_token 粘贴进去
这里选择 1,onedrive 个人版或是商业版
Choose a number from below, or type in an existing value
1 / OneDrive Personal or Business
\ "onedrive"
2 / Root Sharepoint site
\ "sharepoint"
3 / Type in driveID
\ "driveid"
4 / Type in SiteID
\ "siteid"
5 / Search a Sharepoint site
\ "search"
Your choice> 1
然后会提示找到一个驱动器
Found 1 drives, please select the one you want to use:
0: OneDrive (business) id=b!tjyPr9WccUytxb9q4bgCz1Z8pnMGbxJCmV651K4oHDgyUnggpbbeTYTa
Chose drive to use:> 0
输入前面的序号就行
下面直接 yes,大概的意思是找到这个驱动器,不知道对不对
Found drive 'root' of type 'business', URL: https://dddd290-my.sharepoint.com/personal/info_vipiu_net/Documents
Is that okay?
y) Yes
n) No
y/n> y
然后确认
y) Yes this is OK
e) Edit this remote
d) Delete this remote
y/e/d> y
然后退出配置
e) Edit existing remote
n) New remote
d) Delete remote
r) Rename remote
c) Copy remote
s) Set configuration password
q) Quit config
e/n/d/r/c/s/q>
以上就配置好了,剩下的就是挂载了
挂载
首先创建一个本地文件夹,我创建的是 / home/onedrive ,路径可以你自己定, 也就是下面的 LocalFolder
mkdir /home/onedrive
挂载为磁盘的命令如下
rclone mount DriveName:Folder LocalFolder --copy-links --no-gzip-encoding --no-check-certificate --allow-other --allow-non-empty --umask 000
如果你和我一样设置的挂载命令是:
rclone mount onedrive: /home/onedrive --allow-other --allow-non-empty --vfs-cache-mode writes
在运行挂载命令后,SSH 窗口会出现中断,光标丢失,此时关掉窗口即可。如需另外再挂载网盘,只需要重新连接。
不出问题的情况下,输入
df -h
就可以看到 Onedrive 成功挂载。
NextCloud使用阿里云OSS
使用以下命令安装 your_ossfs_package
wget http://gosspublic.alicdn.com/ossfs/ossfs_1.80.5_centos7.0_x86_64.rpm
sudo yum localinstall your_ossfs_package
挂载OSS
文件
- 设置好ossfs的配置文件
echo my-bucket:AccessKeyId:AccessKeySecret > /etc/passwd-ossfs
chmod 640 /etc/passwd-ossfs
- 在
/www/wwwroot/pan.bonky.top/data
目录下创建我们的外部储存文件的目录data
mkdir /www/wwwroot/pan.bonky.top/data/data
- 挂载文件
ossfs bonky data -ourl=oss地域域名 -o allow_other -o nonempty
如果要卸载的话 可以使用fusermount -u
命令卸载目录。
启用外部存储
在 NextCloud
启用外部存储。然后先安装 smbclient
从源码安装
git clone git://github.com/eduardok/libsmbclient-php.git
cd libsmbclient-php ; phpize
增加libsmbclient.h支持
configure
前需要安装libsmbclient-dev
yum install libsmbclient-dev
开始构建
./configure --with-php-config=[php-config 所在的目录]
make && make install
修改php.ini
/usr/local/php/etc/php.ini
查找:extension_dir 再下面一行添加上
extension="smbclient.so 的目录"
保存,执行/etc/init.d/php-fpm restart
重启。
最后,我们在外部存储界面这么设置