教你如何简单将OSS bucket挂载成为阿里云ECS服务器本地盘

本文涉及的产品
对象存储 OSS,标准 - 本地冗余存储 20GB 3个月
对象存储 OSS,内容安全 1000 次 1年
对象存储 OSS,恶意文件检测 1000次 1年
简介:
首先你的 服务 必须是CentOS 6.5 或者 Ubuntu 14.04  系统,否则不能安装和挂载!!  
 
 
登入你的服务器先 依赖软件安装  
 
 
 
CentOS 6.5   
yum install libcurl libcurl-devel openssl-devel fuse fuse-libs fuse-devel libxml2-devel git gcc g++ make   
 
 
Ubuntu 14.04   
apt-get update   
apt-get install libcurl4-openssl-dev libssl-dev pkg-config libxml2 libxml2-dev libfuse-dev git gcc g++ make    
以下我用 CentOS 6.5  做示范!  
输入: yum install libcurl libcurl-devel openssl-devel fuse fuse-libs fuse-devel libxml2-devel git gcc g++ make   
遇到确认请输入Y  
 
 
 
 
出现下图说明安装 依赖软件成功  
 
 
 
 
 
 
接下来下载安装 cloudfs:  
输入:git clone https://git.oschina.net/weiweibaba2007/cloudfs.git   
 
 
 
 
 
 
进入:cloudfs_src目录  
输入:cd cloudfs/cloudfs_src/   
 
 
 
 
 
 
输入:make pack  
 
 
 
 
这样就安装完毕了  
 
 
接下来挂载OSS  bucke  
CentOS 6.5 或 Ubuntu 14.04 安装 挂载  
 
 
 
cloudfs 在 CentOS 6.5 和 Ubuntu 14.04发行版上已经有一键式的 动安装脚本,安装相对简单。  
cd pack/   
./CloudFS_Install.sh INSTALL_DIR=安装目录 MOUNT_POINT=挂载目录 按照命令行提示,即可完成安装。 (会有两个提示确定输入y回车就可以了)  
如下图:  
 
 
./CloudFS_Install.sh INSTALL_DIR=/usr/local/cloudfs_download MOUNT_POINT=/home/ftp/x/xj030/wwwroot  
命令说明: MOUNT_POINT=/home/ftp/x/xj030/wwwroot(/home/ftp/x/xj030/wwwroot这个是你 网站 的目录,比如附件目录什么的)  
 
 
 
 
 
 
 
出现下图就说明安装完成了  
 
 
 
 
 
 
接下来修改配置文件  
进入:cd  /usr/local/cloudfs_download/conf  
修改目录下的cloudfs.con文件  
 
 
  1. #This is the configuration for the OSS related
  2. [OSS Configuration]
  3. # OSS data center url configuration, uncomment the one your bucket resides on.
  4. # If you run cloudfs on aliyun ECS, then use the internal URL. Otherwise, use the public URL.
  5. # ECS
  6. #HOST=oss-cn-qingdao-internal.aliyuncs.com
  7. #HOST=oss-cn-beijing-internal.aliyuncs.com
  8. #HOST=oss-cn-shenzhen-internal.aliyuncs.com
  9. #HOST=oss-cn-hangzhou-internal.aliyuncs.com
  10. #HOST=oss-cn-hongkong-internal.aliyuncs.com
  11. # NOT ECS, but user's server
  12. #HOST=oss-cn-qingdao.aliyuncs.com
  13. #HOST=oss-cn-beijing.aliyuncs.com
  14. #HOST=oss-cn-shenzhen.aliyuncs.com
  15. #HOST=oss-cn-hangzhou.aliyuncs.com
  16. #HOST=oss-cn-hongkong.aliyuncs.com
  17. # OSS Access Id and Access Key configuration, uncommet it and change the value
  18. # to your own id/key.
  19. #ID=your_access_id
  20. #KEY=your_access_key
  21. # OSS bucket configuraion, uncommet it and change the value to you own bucket name
  22. #BUCKET=your_bucket_name
  23. #this is the configuration for the FS related
  24. [FS Configuration]
  25. # The minimal sync interval from oss to cloudfs
  26. # This configuration is only needed when your system will directly
  27. # add/delete oss object from oss web control console or other system.
  28. # 0 means never sync object from oss to cloudfs after booting.
  29. # For most cases, the default value 0 is OK. If you are not sure, just make the default value 0 here.
  30. ONLINE_SYNC_CYCLE=3
  31. # The file data cache block size when upload/download object from oss to cloudfs.
  32. # For most cases, the default value is OK.
  33. BLOCK_SIZE=1048576
  34. # The file data cache limit size when upload/download object from oss to cloudfs.
  35. # For most cases, the default value is OK.
  36. MAX_CACHE_LIMITS=10485760
  37. # LOG output level
  38. # The debug.log file is under the cloudfs running directory.
  39. # When LOG_LEVEL is 1, only error log will output to debug.log file;
  40. # When LOG_LEVEL is 0, both debug and error log will output to debug.log file;
  41. LOG_LEVEL=1
  42. # Postfix for soft link
  43. # OSS does not support unix style softlink file, so cloudfs uses a special postfix for softlink to identify
  44. # it is a soft link file.
  45. # Default value is "s1l2k3", you could change it as you wish.
  46. # But do keep in mind that this postfix should not conflict with any postfix in real world
  47. SYMLINK_POSTFIX=s1l2k3
  48. # The parameter is used to control whether the system need to synchronize data from Aliyun OSS
  49. # when you access a file or dircetory.
  50. # When IMMEDIATE_SYNC=0, indicate no need to synchronize data;
  51. # When IMMEDIATE_SYNC=1, indicate need to synchronize data;
  52. # Default value is 0;
  53. IMMEDIATE_SYNC=1
  54. # mode
  55. ACCESS_MODE=0666
  56. # set the max number of upload threads,
  57. # default value is 1
  58. MAX_UPLOAD_THREADS=1
 
根据你的 OSS 地区去掉前面的#如:  
 
 
  1. # ECS
  2. #HOST=oss-cn-qingdao-internal.aliyuncs.com
  3. #HOST=oss-cn-beijing-internal.aliyuncs.com
  4. #HOST=oss-cn-shenzhen-internal.aliyuncs.com
  5. HOST=oss-cn-hangzhou-internal.aliyuncs.com
  6. #HOST=oss-cn-hongkong-internal.aliyuncs.com
  7. # NOT ECS, but user's server
  8. #HOST=oss-cn-qingdao.aliyuncs.com
  9. #HOST=oss-cn-beijing.aliyuncs.com
  10. #HOST=oss-cn-shenzhen.aliyuncs.com
  11. HOST=oss-cn-hangzhou.aliyuncs.com
  12. #HOST=oss-cn-hongkong.aliyuncs.com
  13. # OSS Access Id and Access Key configuration, uncommet it and change the value
 
填写Access Key并去掉#  
  1. # to your own id/key.
  2. ID=your_access_id(你的Access Key ID)
  3. KEY=your_access_key(你的Access Key Secret)
  4. [backcolor=#ffffff][color=#008ef1]# OSS bucket configuraion, uncommet it and change the value to you own bucket name[/color][/backcolor]
  5. BUCKET=your_bucket_name(你的OSS_bucket名称 )
 
启动CloudFS,执行命令:  
 
 
service cloudfs start  
 
 
停止CloudFS,执行命令:  
 
 
service cloudfs stop  
 
 
查看cloudfs运行状态,执行命令:  
 
 
service cloudfs status  
 
 
 
 
注意事项启动挂载的目录必须是空目录  
 
 
启动:  
 
 
 
 
这样说明已经将OSS挂载到 ECS 了。。。。。。。  
 
 
如果有 问题 可以回复,或者联系我!  
相关实践学习
通义万相文本绘图与人像美化
本解决方案展示了如何利用自研的通义万相AIGC技术在Web服务中实现先进的图像生成。
7天玩转云服务器
云服务器ECS(Elastic Compute Service)是一种弹性可伸缩的计算服务,可降低 IT 成本,提升运维效率。本课程手把手带你了解ECS、掌握基本操作、动手实操快照管理、镜像管理等。了解产品详情: https://www.aliyun.com/product/ecs
目录
相关文章
|
7天前
|
弹性计算 搜索推荐 异构计算
阿里云服务器多少钱一年?亲自整理ECS、轻量和GPU服务器租赁价格表
2025年阿里云服务器优惠汇总:轻量应用服务器2核2G 38元/年起,ECS 2核2G 99元/年,2核4G 199元/年,4核16G 89元/月,8核32G 160元/月,香港轻量25元/月起,新老用户同享,续费同价。
193 3
|
9天前
|
存储 人工智能 Cloud Native
阿里云渠道商:OSS与传统存储系统的差异在哪里?
本文对比传统存储与云原生对象存储OSS的架构差异,涵盖性能、成本、扩展性等方面。OSS凭借高持久性、弹性扩容及与云服务深度集成,成为大数据与AI时代的优选方案。
|
8天前
|
运维 安全 Ubuntu
阿里云渠道商:服务器操作系统怎么选?
阿里云提供丰富操作系统镜像,涵盖Windows与主流Linux发行版。选型需综合技术兼容性、运维成本、安全稳定等因素。推荐Alibaba Cloud Linux、Ubuntu等用于Web与容器场景,Windows Server支撑.NET应用。建议优先选用LTS版本并进行测试验证,通过标准化镜像管理提升部署效率与一致性。
|
9天前
|
存储 监控 安全
阿里云渠道商:云服务器价格有什么变动?
阿里云带宽与存储费用呈基础资源降价、增值服务差异化趋势。企业应结合业务特点,通过阶梯计价、智能分层、弹性带宽等策略优化成本,借助云监控与预算预警机制,实现高效、可控的云资源管理。
|
11天前
|
弹性计算 运维 安全
区别及选择指南:阿里云轻量应用服务器与ECS云服务器有什么区别?
阿里云轻量应用服务器适合个人开发者、学生搭建博客、测试环境,易用且性价比高;ECS功能更强大,适合企业级应用如大数据、高流量网站。根据需求选择:轻量入门首选,ECS专业之选。
|
9天前
|
弹性计算 运维 安全
阿里云轻量应用服务器38元1年和云服务器99元1年怎么选?二者性能区别及选择参考
在阿里云当下的活动中,38元/年的轻量应用服务器与99元/年的云服务器ECS成为众多新用户的关注焦点。但是有部分用户并不是很清楚二者之间的区别,因此就不知道应该如何选择。接下来,笔者将为您详细剖析ECS云服务器与轻量应用服务器的差异,以供您参考和选择。
129 4
阿里云轻量应用服务器38元1年和云服务器99元1年怎么选?二者性能区别及选择参考
|
7天前
|
存储 缓存 安全
阿里云轻量应用服务器实例:通用型、多公网IP型、CPU优化、国际及容量型区别对比
阿里云轻量服务器分通用型、CPU优化型、多公网IP型、国际型和容量型。通用型适合网站与应用;CPU优化型提供稳定高性能计算;多公网IP型支持2-3个IP,适用于账号管理;国际型覆盖海外地域,助力出海业务;容量型提供大存储,适配网盘与实训场景。
71 1
|
9天前
|
存储 弹性计算 监控
阿里云渠道商:如何挑选阿里云服务器配置?
本文详解通用型、计算型、内存型等实例适用场景,结合性能评估与成本优化策略,助力用户按需选择。以日均1万访问企业网站为例,2核4G+3M带宽月费约200元,性价比高。合理配置更省钱。
|
10天前
|
弹性计算 搜索推荐 异构计算
租用阿里云服务器一年要多少钱?ECS、轻量和GPU服务器租赁价格,手动整理
2025年10月阿里云服务器优惠持续,轻量应用服务器200M带宽38元起/年,ECS 2核2G 99元/年、2核4G 199元/年,4核16G 89元/月,8核32G 160元/月,香港轻量25元/月起,新老同享,续费不涨价。
251 2

热门文章

最新文章

下一篇
开通oss服务