本文由腾讯云+社区自动同步,原文地址 https://stackoverflow.club/use-cosfs-in-centos/
腾讯云每个月提供50G的存储空间,10G的下行流量,免费的上行流量。最好的地方在于提供了基于fuse的文件系统,可以将对象存储映射为本地文件,非常适合于存储有限的场合,比如vps,可以通过挂载一个对象存储来增加空间。
sudo yum install automake gcc-c++ git libcurl-devel libxml2-devel fuse-devel make openssl-devel
git clone https://github.com/tencentyun/cosfs-v4.2.1 /usr/cosfs
cd /usr/cosfs
./autogen.sh
./configure
make
sudo make install
echo <bucketname>:<SecretId>:<SecretKey> > /etc/passwd-cosfs
chmod 640 /etc/passwd-cosfs
注意,执行echo时会提醒权限不够,一般都会使用sudo,但这样会导致文件的主人为root,
在执行后续的挂载时如果没有用sudo,会导致 could not determine how to establish security credentials 错误,
解决方案是使用sudo chown your_name /etc/passwd-cosfs
把文件的所有者变为当前用户
cosfs your-APPID:your-bucketname your mount-point -ourl=cos-domain-name -odbglevel=info
fusermount -u /mnt
或者
umount -l /mnt
Reference:
扫码关注腾讯云开发者
领取腾讯云代金券
Copyright © 2013 - 2025 Tencent Cloud. All Rights Reserved. 腾讯云 版权所有
深圳市腾讯计算机系统有限公司 ICP备案/许可证号:粤B2-20090059 深公网安备号 44030502008569
腾讯云计算(北京)有限责任公司 京ICP证150476号 | 京ICP备11018762号 | 京公网安备号11010802020287
Copyright © 2013 - 2025 Tencent Cloud.
All Rights Reserved. 腾讯云 版权所有