ThinkChat🤖让你学习和工作更高效,注册即送10W Token,即刻开启你的AI之旅 广告
## OwnCloud 使用对象存储 对象存储由于实现了动态伸缩,独立于服务器单独便可以使用,为广大云计算用户所喜爱。OwnCloud是可以采用对象存储用来存放文件资源。不同的云厂商的对象存储计算不一样,故OwnCloud集成对象存储的方案略有差异。 OwnCloud的文档数据默认是存放到:/data/wwwroot/owncloud/data 下,下面的方案都以此路径为例。 ******************** ### 使用华为云 OSS 参考由华为云官方提供的教程:https://bbs.huaweicloud.com/forum/thread-1001-1-1.html ### 使用腾讯云 OSS 参考由腾讯云官方提供的教程:https://cloud.tencent.com/document/product/436/6883 ### 使用阿里云 OSS 参考由阿里云官方提供的教程:https://help.aliyun.com/document_detail/32196.html ********************** ### OwnCloud 挂载 OSS 实例(以 CentOS7 挂载阿里云 OSS 为例进行说明) 此方案通过在OwnCloud下新增一个目录(对应数据盘),然后修改默认存储路径实现目标。具体操作如下: 1. 提前购买好OSS,并新增一个bucket; 2. 登录服务器,停止Apache服务 ``` systemctl stop httpd ``` 3. 通过SFTP工具,在 */data/wwwroot/owncloud* 目录下新建一个文件夹,名称建议为:*bigdata* 此bigdata文件夹就是迁移之后的默认文档存放位置 4. 将OSS新增的bucket挂载到:*/data/wwwroot/owncloud/bigdata* (参考云厂商的数据盘挂载方案) > OSS的挂载非常繁琐,需要耐心研读 [官方文档](https://help.aliyun.com/document_detail/32196.html) 5. 将 *owncloud/data* 下的数据全部剪切或拷贝到 *owncloud/bigdata* > 数据较大的话,剪切或拷贝可能会失败。参考《Linux下如何剪切或拷贝海量数据?》 6. 修改 Owncloud 配置文件中的数据存储目录位置 7. 启动 Apache 服务 ``` systemctl start httpd ``` 8. 设置OSS开机自动挂载(适用于 CentOS7 及以上的系统) * 在/etc/init.d/目录下建立文件ossfs,把以下内容拷贝到这个新文件中。并将其中的your\_xxx内容改成您自己的信息。 ``` #! /bin/bash # # ossfs Automount Aliyun OSS Bucket in the specified direcotry. # # chkconfig: 2345 90 10 # description: Activates/Deactivates ossfs configured to start at boot time. ossfs your_bucket your_mountpoint -ourl=your_url -oallow_other ``` * 执行命令: ```chmod a+x /etc/init.d/ossfs``` ```chkconfig ossfs on``` * 重启服务器测试oss是否开机挂载,使用以下命令查看是否挂载成功,若成功则会显示类似如图所示的结果 ```df -lh``` ![](http://libs.websoft9.com/Websoft9/DocsPicture/zh/nextcloud/ossfs-websoft9.png) ​