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

本文涉及的产品
云服务器 ECS,每月免费额度280元 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
目录
相关文章
|
27天前
|
存储 安全 数据安全/隐私保护
oss服务器端加密
阿里云OSS提供服务器端加密,使用AES-256自动加密数据,保证上传至OSS的数据安全。下载时自动解密,透明处理。加密增强静态数据安全性,满足合规需求。支持OSS或KMS管理密钥,实现细粒度权限控制。确保云端对象数据全生命周期安全。
28 7
|
29天前
|
SQL 弹性计算 安全
购买阿里云活动内云服务器之后设置密码、安全组、增加带宽、挂载云盘教程
当我们通过阿里云的活动购买完云服务器之后,并不是立马就能使用了,还需要我们设置云服务器密码,配置安全组等基本操作之后才能使用,有的用户还需要购买并挂载数据盘到云服务器上,很多新手用户由于是初次使用阿里云服务器,因此并不知道这些设置的操作流程,下面给大家介绍下这些设置的具体操作流程。
购买阿里云活动内云服务器之后设置密码、安全组、增加带宽、挂载云盘教程
|
29天前
|
存储 安全 API
oss服务器端加密(Server-Side Encryption Configuration)
阿里云OSS提供服务器端加密(SSE),确保静态数据安全。支持SSE-KMS,使用KMS托管CMK加密。数据上传时自动加密,下载时自动解密。用户可设置Bucket默认加密或在上传时指定加密选项。适用于高度保护数据场景,如敏感个人信息和企业关键信息。兼容多种部署形态,特定特性地域可用。此功能简化了加密处理,增强了云端数据安全性。
31 1
|
2天前
|
安全 Java 网络安全
对象存储oss使用问题之使用oss上服务器后显示服务异常如何解决
《对象存储OSS操作报错合集》精选了用户在使用阿里云对象存储服务(OSS)过程中出现的各种常见及疑难报错情况,包括但不限于权限问题、上传下载异常、Bucket配置错误、网络连接问题、跨域资源共享(CORS)设定错误、数据一致性问题以及API调用失败等场景。为用户降低故障排查时间,确保OSS服务的稳定运行与高效利用。
10 0
|
6天前
|
弹性计算 应用服务中间件 Linux
阿里云ECS服务器上从零开始搭建nginx服务器
阿里云ECS服务器上从零开始搭建nginx服务器
|
28天前
|
存储 弹性计算 安全
阿里云活动内云服务器没有数据盘怎么办?购买后如何购买并挂载云盘?
在我们通过阿里云的活动来购买云服务器的时候,一般默认情况下只有系统盘,是没有数据盘的,但是很多用户处于实际使用需求和安全等方面的需求,通常都需要在购买之后单独再购买一块云盘作为数据盘挂载到云服务器上,本文以图文形式为大家展示阿里云活动内云服务器购买流程以及购买后如何购买并挂载云盘,适合新手用户参考。
阿里云活动内云服务器没有数据盘怎么办?购买后如何购买并挂载云盘?
|
30天前
|
域名解析 弹性计算 数据可视化
如何使用云服务器ECS搭建网站?阿里云云服务器ECS部署网站新手教程
本文介绍了在阿里云ECS上自助建站的流程。建站方式包括自助建站、模板建站和定制建站,适合个人或小企业用户。建站步骤涉及准备服务器、配置安全组规则、部署网站、购买和备案域名以及解析域名。此外,文章还提及了产品计费和常见问题,提供相关服务如架构设计、迁云服务和基础设置服务等。
378 0
|
1月前
|
弹性计算 缓存 数据库
2024年阿里云2核4G服务器一年多少钱?轻量165元,ECS云服务器199元
2024年阿里云2核4G服务器一年多少钱?轻量165元,ECS云服务器199元
|
24天前
|
Ubuntu JavaScript 关系型数据库
在阿里云Ubuntu 20.04服务器中搭建一个 Ghost 博客
在阿里云Ubuntu 20.04服务器上部署Ghost博客的步骤包括创建新用户、安装Nginx、MySQL和Node.js 18.x。首先,通过`adduser`命令创建非root用户,然后安装Nginx和MySQL。接着,设置Node.js环境,下载Nodesource GPG密钥并安装Node.js 18.x。之后,使用`npm`安装Ghost-CLI,创建Ghost安装目录并进行安装。配置过程中需提供博客URL、数据库连接信息等。最后,测试访问前台首页和后台管理页面。确保DNS设置正确,并根据提示完成Ghost博客的配置。
在阿里云Ubuntu 20.04服务器中搭建一个 Ghost 博客
|
27天前
|
存储 弹性计算 数据可视化
要将ECS中的文件直接传输到阿里云网盘与相册(
【2月更文挑战第31天】要将ECS中的文件直接传输到阿里云网盘与相册(
413 4

热门文章

最新文章