Linux設定

goofysでオブジェクトストレージをマウント

goofy9でオブジェクトストレージをマウントする方法

環境としては

– AlmaLinux 8
– DeigitalOceanのspaceをObject Storageとして使用

でのインストール手順を書かせて頂きます。

オブジェクトストレージを契約

DigitalOceanのスペースを契約して、左メニューの「API」からスペース用のキーとsecretキーを取得。メモして保存しておくこと。

インストール・設定手順

mkdir -p /usr/local/bin;
cd /usr/local/bin;
wget https://github.com/kahing/goofys/releases/latest/download/goofys;
chmod 755 /usr/local/bin/goofys;
mkdir ~/.aws;
vi ~/.aws/credentials
[default]
aws_access_key_id = ...
aws_secret_access_key = MY-SECRET-KEY

スペース名1stclassで/mnt/1stclassにマウントしたければ

SPNAME=1stclass;
MNTPOINT=/mnt/$SPNAME;
ENDPOINT=https://sgp1.digitaloceanspaces.com;

mkdir -p /mnt/$SPNAME;
goofys --use-content-type -o allow_other --file-mode=0777 --dir-mode=0777 --region sgp1 --endpoint=$ENDPOINT $SPNAME $MNTPOINT;

きちんとマウントできたら一旦アンマウント;

umount /mnt/1stclass

vi /etc/fstab

goofys#1stclass   /mnt/1stclass        fuse     _netdev,allow_other,--file-mode=0666,--dir-mode=0777,--endpoint=https://1stclass.sgp1.digitaloceanspaces.com    0       0
systemctl daemon-reload;
mount -a;

これでマウントできればOK