# 安装ossfs

Debian系统中需要编译安装,官方项目地址https://github.com/aliyun/ossfs

首先安装需要的依赖

sudo apt-get install automake autotools-dev g++ git libcurl4-gnutls-dev libfuse-dev libssl-dev libxml2-dev make pkg-config

下载源码并编译安装

git clone https://github.com/aliyun/ossfs.git
cd ossfs
./autogen.sh
./configure
make
sudo make install

# 配置帐号信息

如果OSS的bucket权限设置为私有,则需要授权,参考官方文档创建并下载保存一个AccessKey

帐号配置文件的默认路径为/etc/passwd-ossfs,权限为640,通过以下操作将AccessKey写入配置文件中

echo $bucket_name:$access_key_id:$access_key_secret > /etc/passwd-ossfs
chmod 640 /etc/passwd-ossfs

# 挂载

以深圳地域OSS的bucket,通过内网连接将csgo/maps目录挂载在当前目录下的maps目录为例

ossfs bucket:/csgo/maps maps -ourl=oss-cn-shenzhen-internal.aliyuncs.com
 -opasswd_file=/etc/passwd-ossfs -oallow_other

在root用户下需要添加-oallow_other才能让其他用户拥有访问权限