cosfs
一、名词解释
- COS,即云对象存储(Cloud Object Storage),把它想象成一个云端的硬盘即可。
- COSFS,比COS多的
FS
很明显就是指文件系统(File System),此文件系统可以使用轻松的使用腾讯云提供的云端硬盘。
二、安装
2.1 安装包安装
2.1.1 Ubuntu
- 下载
#Ubuntu14.04
sudo wget https://github.com/tencentyun/cosfs/releases/download/v1.0.21/cosfs_1.0.21-ubuntu14.04_amd64.deb
Ubuntu16.04
sudo wget https://github.com/tencentyun/cosfs/releases/download/v1.0.21/cosfs_1.0.21-ubuntu16.04_amd64.deb
Ubuntu18.04
sudo wget https://github.com/tencentyun/cosfs/releases/download/v1.0.21/cosfs_1.0.21-ubuntu18.04_amd64.deb
Ubuntu20.04
sudo wget https://github.com/tencentyun/cosfs/releases/download/v1.0.21/cosfs_1.0.21-ubuntu20.04_amd64.deb
- 安装
sudo dpkg -i cosfs_1.0.21-ubuntu**.deb
### 2.1.2 CentOS
- 安装依赖
sudo yum install libxml2-devel libcurl-devel fuse-devel openssl-devel fuse -y
- 下载安装包
CentOS6.5
sudo wget https://github.com/tencentyun/cosfs/releases/download/v1.0.21/cosfs-1.0.21-centos6.5.x86_64.rpm
CentOS7.0
sudo wget https://github.com/tencentyun/cosfs/releases/download/v1.0.21/cosfs-1.0.21-centos7.0.x86_64.rpm
- 安装
sudo rpm -ivh cosfs-1.0.21-centos**.x86_64.rpm
## 2.2 编译安装
### 2.2.1 Ubuntu
- 安装依赖软件
sudo apt-get install automake autotools-dev g++ git libcurl4-gnutls-dev libfuse-dev libssl-dev libxml2-dev make pkg-config fuse
- 获取源码
sudo git clone https://github.com/tencentyun/cosfs /usr/cosfs
- 编译及安装
cd /usr/cosfs
sudo ./autogen.sh
sudo ./configure
sudo make
sudo make install
cosfs --version #查看 cosfs 版本号
### 2.2.2 CentOS
- 安装依赖软件
sudo yum install automake gcc-c++ git libcurl-devel libxml2-devel fuse-devel make openssl-devel fuse
- 获取源码
sudo git clone https://github.com/tencentyun/cosfs /usr/cosfs
- 编译及安装
cd /usr/cosfs
sudo ./autogen.sh
sudo ./configure
sudo make
sudo make install
cosfs --version #查看 cosfs 版本号
# 三、使用
## 3.1 配置密钥文件
echo <BucketName-APPID>:<SecretId>:<SecretKey> > /etc/passwd-cosfs
chmod 640 /etc/passwd-cosfs
## 3.2 运行工具
mkdir /mnt/cosfs
cosfs <BucketName-APPID> <MountPoint> -ourl=http://cos.<Region>.myqcloud.com -odbglevel=info -oallow_other
## 3.3 卸载存储桶
方式1: fusermount 命令专用于卸载 FUSE 文件系统
fusermount -u /mnt
方式2: 当有程序引用文件系统中文件时,进行卸载不会报错,并在没程序引用时完成卸载
umount -l /mnt
方式3: 当有程序引用文件系统中的文件时,进行卸载会报错
umount /mnt,
# 四、参考及关联阅读
1. COSFS官网文档 https://cloud.tencent.com/document/product/436/6883
# 五、思考及可能
1. 写个脚本,一键/一行命令安装软件,可以做到吗?