[教程]VPS应用之阿里云ECS+阿里云OSS对象存储做256T超大网盘
5月8日更新• 256T网盘 • ECS • OSS • 阿里云•教程•阅读:2,984次












本次教程,使用阿里云新加坡ECS+OSS进行搭建
阿里云的OSS对象存储
阿里云OSS 的费用由 存储费用+流量费用+接口调用费用 构成 ,而流量费是大头,但是同地区使用内网方式链接的话,是不存在流量费的。文末有阿里云官方价格截图刚好手里的新加坡ECS有点闲置,于是用它来做个超大网盘了,到底有多大呢,256T,哈哈,够用了吧。
需要阿里云国际账号及pp绑定的,看下面这个链接。
广告结束
开始教程

首先创建和你ECS同地区的OSS对象存储,新建Bucket

在oss对象存储中,找到你刚新建的Bucket,可以看到有内外网访问区别(如果oss和ECS在同一地区的话,使用内网链接,是不收流量费用的,一会儿我们使用内网链接方式)
当然,如果使用别的VPS,比如搬瓦工VPS,也是可以的,只是只能用外网访问的网址,那样会产生OSS流量费

点击Acces Key创建key


新建的accesskey,打码的地方,就是你的key了,要用到的(复制下面备用)
使用ssh工具登陆你的ECS
官方OSSFS工具只给了Ubuntu和centos的,我的系统是debian9,经过试用,也可以
#安装依赖,我是debian,sudo没加
sudo apt-get install automake autotools-dev g++ git libcurl4-gnutls-dev \
libfuse-dev libssl-dev libxml2-dev make pkg-config
#源码编译安装ossfs
git clone https://github.com/aliyun/ossfs.git
cd ossfs
./autogen.sh
./configure
make
sudo make install #我是debian,sudo没加
到这里,已经安装好了
接下来是配置刚之前创建的Bucket
#我是debian,sudo没加
sudo echo Bucket名称:accesskeyid:AccessKeySecre > /etc/passwd-ossfs #改成你自己的名称:id:secre
sudo chmod 640 /etc/passwd-ossfs
挂载
mkdir /www/oss #新建一个目录
ossfs Bucket名称 /www/oss -ourl=https://oss-ap-southeast-1-internal.aliyuncs.com -o allow_other #改成你自己的信息
#-ourl后面的这个网址就是之前说过的同地区可用的内网地址,我是ECS和OSS都在新加坡,所有是这个网址
#-o allow_other 第一次这个权限没给,挂载的盘是700权限,nextcloud没法用
或者开机自动挂载
echo 'ossfs#bucketName /www/oss fuse _netdev,url=https://oss-ap-southeast-1-internal.aliyuncs.com,allow_other 0 0' >> /etc/fstab #改成你自己的信息
卸载
fusermount -u /www/oss #改成你自己的信息
-bash: fusermount: command not found #出错提示
#缺命令
agt install fuse
#再次卸载,成功!
最后,看下挂载情况

SSH中看的情况

宝塔面板上看的情况

因我nextcloud网盘之前已经装好,不想麻烦了,直接用外部存储-本地的办法挂载了/www/oss

相关费用解释:


流量费用,因为走了阿里云ECS,所有说:不存在的

GOOD LUCKS!
END