当前位置:网站首页>使用ECS和OSS搭建个人网盘
使用ECS和OSS搭建个人网盘
2022-07-26 18:49:00 【量子波动猫】
一、创建ECS服务器:

二、安装Cloudreve
1.下载cloudreve安装包。
wget https://labfileapp.oss-cn-hangzhou.aliyuncs.com/cloudreve_3.3.1_linux_amd64.tar.gz

2.下载完毕后,解压cloudreve安装包。
tar -zxvf cloudreve_3.3.1_linux_amd64.tar.gz
3.给cloudreve授予权限。
chmod +x ./cloudreve
4.运行cloudreve。
./cloudreve

5.打开浏览器,访问http://47.101.179.36:5212,依次输入管理员账号和密码,单击登录。

三、安装ossfs
ossfs能让您在Linux系统中,将对象存储OSS的存储空间(Bucket)挂载到本地文件系统中,能够像操作本地文件一样操作OSS的对象(Object),实现数据的共享。
1.下载ossfs安装包。
wget https://gosspublic.alicdn.com/ossfs/ossfs_1.80.6_centos8.0_x86_64.rpm
2.更换yum源
[[email protected] ~]# rm -f /etc/yum.repos.d/* #1.先删除系统内过期的.repo文件
[[email protected] ~]# wget -O /etc/yum.repos.d/CentOS-Base.repo https://mirrors.aliyun.com/repo/Centos-vault-8.5.2111.repo #2.载新的 CentOS-Base.repo 到 /etc/yum.repos.d/
[[email protected] ~]# yum clean all && yum makecache #3.运行 yum makecache 生成缓存
3.下载完毕后,执行如下命令,安装ossfs。
yum install -y ./ossfs_1.80.6_centos8.0_x86_64.rpm

4.配置账号访问信息,将Bucket名称以及具有此Bucket访问权限的AccessKey ID和AccessKey Secret信息存放在/etc/passwd-ossfs文件中。您需要将BucketName、yourAccessKeyId和yourAccessKeySecret替换成Bucket名称、AccessKey ID和AccessKey Secret。
#echo BucketName:yourAccessKeyId:yourAccessKeySecret > /etc/passwd-ossfs
[[email protected] ~]# echo zax-cloud:LTAI5t6jDKNMT3YhyGVSb95h:d0N7KwV1LC5BHvZsbDgmkWrHo87WbR > /etc/passwd-ossfs
参数说明:
- BucketName:阿里云OSS控制台中创建的bucket名称。
- yourAccessKeyId:具有此Bucket访问权限的AccessKey ID。
- yourAccessKeySecret:具有此Bucket访问权限的AccessKey Secret。
5.给passwd-ossfs文件授予权限。
chmod 640 /etc/passwd-ossfs
四、挂载OSS
1.创建一个名为oss文件夹。
mkdir oss
2.将Bucket挂载到指定目录oss,需要将BucketName、mountfolder和Endpoint替换成bucket名称、创建的oss文件夹和OSS的ECS 的经典网络访问(内网)的Endpoint。
#ossfs BucketName oss -o url=Endpoint
[[email protected] ~]# ossfs zaxs oss -o url=oss-cn-shanghai-internal.aliyuncs.com
3.查看是否挂载成功
df -h

4.在/etc/init.d/目录下建立文件ossfs,设置开机自动启动脚本进行OSS挂载。
vim /etc/init.d/ossfs
5.进入Vim编辑器后,按下i键进入编辑模式,添加以下内容,添加完成后按下Esc键退出编辑模式,最后输入:wq后按下Enter键,保存并退出Vim编辑器。
#! /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 zaxs oss -o url=oss-cn-shanghai-internal.aliyuncs.com -oallow_other
6.为新建立的ossfs脚本赋予可执行权限。
chmod a+x /etc/init.d/ossfs
7.把ossfs启动脚本作为其他服务,开机自动启动。
chkconfig ossfs on
五、配置个人网盘
运行cloudreve。
./cloudreve
打开浏览器,访问http://<ECS公网地址>:5212,依次输入管理员账号和密码,单击登录。
在cloudreve主界面右上角,单击管理面板。
在确定站点URL设置对话框中,单击更改。
在左侧导航栏中,单击存储策略。
在存储策略页面,单击添加存储策略。
在选择存储方式对话框中,选择本机存储。
在添加本机存储策略的上传路径页面中,将存储目录修改为oss/Object路径/{uid}/{path},单击下一步。

在添加本机存储策略的直链设置页面中,单击下一步。

在添加本机存储策略的上传限制页面中,单击下一步。

在添加本机存储策略的完成页面中,输入存储策略名OSS,单击完成。

在左侧导航栏中,单击用户组。
在用户组页面中,单击管理员操作中的编辑图标。
在编辑管理员页面的存储策略中,选择oss,然后单击保存。
在用户组的右上角,单击返回主页。
在个人网盘页面,拖拽任意文件到网页中,待文件上传完毕,关闭上传队列。

浏览器打开oss控制台,在左侧导航栏中,通过Bucket列表,点击对应的Bucket名称,然后单击文件管理。
然后就可以看到在个人网盘上传的文件。

边栏推荐
- How to uninstall win11 edge? The method tutorial of completely uninstalling win11 edge browser
- 2022/07/26 学习笔记 (day16) 链表和栈
- 企业内部信息碎片化该怎么办?不妨试试这样做
- 服务发现原理分析与源码解读
- 【PHP】常用的header头部定义
- Where can I find the files downloaded from iPad
- CONDA transfer project virtual environment essential skills +pip speed download too slow solution
- 金仓数据库 KingbaseES SQL 语言参考手册 (13. SQL语句:ALTER SYNONYM 到 COMMENT)
- 安全团队:近期Windows版Coremail邮件客户端存在RCE漏洞,可能导致钱包私钥泄露
- Redis introduction
猜你喜欢

Leetcode daily practice - 189. Rotation array
![[PHP] save session data to redis](/img/29/70a9f330b9f912ccbd57e865372439.png)
[PHP] save session data to redis

服务器内存故障预测居然可以这样做

Win11 U盘驱动异常怎么调整为正常?

论文精读:YOLOV2——YOLO9000:Better, Faster, Stronger

How to adjust the abnormal win11 USB drive to normal?

Where can I find the files downloaded from iPad

After working for 13 years, I have a little software testing experience and feelings

Redis介绍

手机app测试用例怎么写?手机app测试点有哪些?
随机推荐
中天钢铁在 GPS、 AIS 调度中使用 TDengine
win11 edge怎么卸载?win11 edge浏览器彻底卸载的方法教程
Familiarize you with the "phone book" of cloud network: DNS
企业数字化转型成大趋势,选对在线协作工具很重要
基于华为云 IOT 设计智能称重系统 (STM32)【一】
Pychart loads CONDA to create a pytorch virtual environment and reports an error. It is normal on the CONDA command line
[PHP] save session data to redis
J1: why is redis so fast + basic structure
【PHP】MySQL原生PHP操作-天龙八步
Spatiotemporal prediction 5-gat
【OBS】Dropped Frames And General Connection Issues
Pycharm加载conda创建pytorch虚拟环境报错,在conda命令行正常
客户案例|生学教育依托观测云打造可观测智慧教育新生态
Cuda11.2 corresponding pytorch installation
What is federated graph machine learning? A summary of the latest "federal map machine learning: concepts, techniques, and Applications" at the University of Virginia
LeetCode每日一练 —— 88. 合并两个有序数组
论文精读:YOLOV2——YOLO9000:Better, Faster, Stronger
YOLO V2详解
IJCAI2022开会了! Brescia等《证据推理和学习》教程,阐述其最新进展,附96页Slides
【shell】转载:批量替换 find awk sed xargs