!
也想出现在这里? 联系我们
广告位
当前位置:首页>教程分享>网站教程>CentOS 7 挂载腾讯云COS对象存储教程

CentOS 7 挂载腾讯云COS对象存储教程

前言

本文将详解使用腾讯云cosfs工具将COS对象存储的存储桶挂载到CentOS 7服务器的教程.其他平台及常见问题请参考官方说明:

腾讯云COSFS 工具 COSFS 工具类常见问题

安装COSFS工具

获取源码

git clone https://github.com/tencentyun/cosfs /usr/cosfs

安装依赖软件

sudo yum install automake gcc-c++ git libcurl-devel libxml2-devel fuse-devel make openssl-devel fuse

编译和安装 COSFS

cd /usr/cosfs
./autogen.sh
./configure
make
sudo make install
cosfs --version  #查看 cosfs 版本号

获取挂载信息

登录腾讯云-控制台-对象存储-存储桶获取相关信息

  • BucketName-APPID : test-1250000000 即存储桶名称
  • SecretId : XXXXXX
  • SecretKey : XXXXXX
  • 区域地址 : https://cos.ap-guangzhou.myqcloud.com 存储桶所在的区域域名.

配置密钥文件

官方样本

echo <BucketName-APPID>:<SecretId>:<SecretKey> > /etc/passwd-cosfs
chmod 640 /etc/passwd-cosfs

示例

echo test-1250000000:AKIDHTVVaVR6e3:PdkhT9e2rZCfy6 > /etc/passwd-cosfs
chmod 640 /etc/passwd-cosfs

挂载COS

官方样本

cosfs <BucketName-APPID> <MountPoint> -ourl=<CosDomainName> -odbglevel=info

相关参数

-o nonempty # 挂载到本地的目录不为空时.
-oallow_other # 允许其他用户访问,允许Web直连下载.

示例 创建你想挂载的路径

mkdir -p /mnt/cosfs

挂载

cosfs test-1250000000 /mnt/cosfs -ourl=https://cos.ap-guangzhou.myqcloud.com -odbglevel=info -onoxattr -oallow_other

如需挂载子目录

cosfs test-1250000000:/my-dir /mnt/cosfs -ourl=https://cos.ap-guangzhou.myqcloud.com -odbglevel=info -onoxattr -oallow_other

卸载COS

umount -l /mnt/cosfs

结语

正好搭建一个环境用到挂载对象存储,就顺手记录下配置流程.

给TA打赏
共{{data.count}}人
人已打赏
网站教程

华为、华三、锐捷、思科、迈普交换机802.1X策略配置

2021-3-8 10:21:20

网站教程

随机地址姓名工具 随机谷歌Gmail邮箱工具 随机密码生成器工具 虚拟信用卡料生成工具

2021-4-7 11:51:02

声明 本站上的部份代码及教程来源于互联网,仅供网友学习交流,若您喜欢本文可附上原文链接随意转载。无意侵害您的权益,请发送邮件至 [email protected] 或点击右侧 私信:吉吉国王 反馈,我们将尽快处理。
0 条回复 A文章作者 M管理员
    暂无讨论,说说你的看法吧
个人中心
购物车
优惠劵
今日签到
有新私信 私信列表
搜索
OneEase