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

本文涉及的产品
云服务器 ECS,每月免费额度200元 3个月
对象存储 OSS,20GB 3个月
云服务器ECS,u1 2核4GB 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  
211_35615732_ffc4bd45392f659.png?29 
 
 
 
出现下图说明安装 依赖软件成功  
 
 
211_35615732_fd0d16ad6ef8ade.png?9 
 
 
 
接下来下载安装 cloudfs:  
输入:git clone https://git.oschina.net/weiweibaba2007/cloudfs.git   
 
 
211_35615732_4eae2d2d1209c2f.png?21 
 
 
 
进入:cloudfs_src目录  
输入:cd cloudfs/cloudfs_src/   
 
 
211_35615732_a40d9ea1ff02b2a.png?12 
 
 
 
输入:make pack  
211_35615732_63a1b222a9d1b05.png?18 
 
 
 
这样就安装完毕了  
 
 
接下来挂载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回车就可以了)  
如下图:  
211_35615732_9d8ded0a4cafdab.png?14  
 
./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这个是你 网站 的目录,比如附件目录什么的)  
211_35615732_4a74a522a65709c.png?8  
 
 
 
 
 
 
出现下图就说明安装完成了  
 
 
211_35615732_31d7576ccd59241.png?8 
 
 
 
接下来修改配置文件  
进入: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  
 
 
 
 
注意事项启动挂载的目录必须是空目录  
 
 
启动:  
211_35615732_a5940b0173ada44.png?26  
 
 
 
这样说明已经将OSS挂载到 ECS 了。。。。。。。  
 
 
如果有 问题 可以回复,或者联系我!  
相关实践学习
一小时快速掌握 SQL 语法
本实验带您学习SQL的基础语法,快速入门SQL。
7天玩转云服务器
云服务器ECS(Elastic Compute Service)是一种弹性可伸缩的计算服务,可降低 IT 成本,提升运维效率。本课程手把手带你了解ECS、掌握基本操作、动手实操快照管理、镜像管理等。了解产品详情: https://www.aliyun.com/product/ecs
目录
相关文章
|
21天前
|
弹性计算
阿里云ECS使用体验
在申请高校学生免费体验阿里云ECS云服务器后的一些使用体验和感受。
|
1天前
|
弹性计算 运维 安全
阿里云ecs使用体验
整了台服务器部署项目上线
|
1天前
|
存储 小程序 数据库
阿里云学生云服务器申请,阿里云送每个大学生一台云服务器
2024年,阿里云为学生提供免费7个月的学生服务器,包括2核2G配置、1M带宽和独立IP。学生需通过学信网认证,完成任务可额外获得6个月免费时长。申请流程包括注册阿里云账号、实名认证和学生认证。此外,学生可免费领取300元无门槛优惠券,在阿里云高校计划中使用。学生服务器可用于建站、部署等多种场景。详细信息和申请入口见官方链接。
13 0
|
3天前
|
弹性计算
阿里云ECS的使用心得
本文主要讲述了我是如何了解到ECS,使用ECS的一些经验,以及自己的感悟心得
|
10天前
|
安全 Java 网络安全
对象存储oss使用问题之使用oss上服务器后显示服务异常如何解决
《对象存储OSS操作报错合集》精选了用户在使用阿里云对象存储服务(OSS)过程中出现的各种常见及疑难报错情况,包括但不限于权限问题、上传下载异常、Bucket配置错误、网络连接问题、跨域资源共享(CORS)设定错误、数据一致性问题以及API调用失败等场景。为用户降低故障排查时间,确保OSS服务的稳定运行与高效利用。
15 0
|
14天前
|
弹性计算 应用服务中间件 Linux
阿里云ECS服务器上从零开始搭建nginx服务器
阿里云ECS服务器上从零开始搭建nginx服务器
|
16天前
|
弹性计算 安全
电子好书发您分享《阿里云第八代企业级ECS实例,为企业提供更安全的云上防护》
阿里云第八代ECS实例,搭载第五代英特尔至强处理器与飞天+CIPU架构,提升企业云服务安全与算力。[阅读详情](https://developer.aliyun.com/ebook/8303/116162?spm=a2c6h.26392459.ebook-detail.5.76bf7e5al1Zn4U) ![image](https://ucc.alicdn.com/pic/developer-ecology/cok6a6su42rzm_f422f7cb775444bbbfc3e61ad86800c2.png)
35 14
|
19天前
|
弹性计算 前端开发 Java
使用阿里云 mqtt serverless 版本超低成本快速实现 webscoket 长链接服务器
使用阿里云 MQTT Serverless 可轻松实现弹性伸缩的 WebSocket 服务,每日成本低至几元。适用于小程序消息推送的 MQTT P2P 模式。前端需注意安全,避免 AK 泄露,采用一机一密方案。后端通过调用 `RegisterDeviceCredential` API 发送消息。示例代码包括 JavaScript 前端连接和 Java 后端发送。
177 0
|
24天前
|
弹性计算 关系型数据库 MySQL
阿里云数据库服务器价格表,数据库创建、连接和使用教程
阿里云数据库使用流程包括购买和管理。选择所需数据库类型如MySQL,完成实名认证后购买,配置CPU、内存和存储。确保数据库地域与ECS相同以允许内网连接。创建数据库和账号,设置权限。通过DMS登录数据库,使用账号密码连接。同一VPC内的ECS需添加至白名单以进行内网通信。参考官方文档进行详细操作。
125 3
|
1月前
|
Java API 开发工具
如何用阿里云 oss 下载文件
阿里云对象存储服务(OSS)提供了多种方式下载文件,以下讲解下各种方式的下载方法
925 1