s3 mount to linux or use chef
- Category: 電腦相關
- Last Updated: Monday, 01 June 2015 12:04
- Published: Friday, 13 March 2015 10:56
- Written by sam
latest code at https://github.com/s0m1in/0528.git 新增chef solo 安裝s3fs fuse mount to dir
將遠端的AMAZON S3掛載到本機
目前用的系統是UBUNTU,先安裝最基本的套件
apt-get install build-essential libfuse-dev libcurl4-openssl-dev libxml2-dev mime-support automake libtool
再來至
http://sourceforge.net/projects/fuse/files/fuse-2.X/2.9.3/
下載新版本的FUSE回來安裝
以下是大致流程,版號及目錄視您的現況變更
tar xzf XXX.tar.gz cd XXX ./configure --prefix=/usr/local make && make install
再來是下載S3FS套件
https://github.com/s3fs-fuse/s3fs-fuse/releases
tar xzf xxxxx.tar.gz cd XXXX ./autogen.sh ./configure --prefix=/usr/local make && make install
可以使用新版本的,v1.77.tar.gz (舊版會有現有目錄無法顯示)
vi /etc/passwd-s3fs
貼上您的key,依下列格式
AWS_ACCESS_KEY:SECRET_ACCESS_KEY
中間不能有空格
再來就一樣是
mkdir /mnt/aaa chmod -R 777 /mnt/aaa
mount s3 to local -o參數請參考下方說明
sudo s3fs [bucket-name] /mnt/aaa -o
- he -o allow_other option allows all other users on the server read / write access to the mounted directory. Obviously, this can be a huge security hole.
-
The -o use_cache=/tmp option specifies the location where to store locally cached folders and files. This enables local file caching which minimizes downloads.
Note: make certain you have plenty of space dedicated to the cache directory before considering this option. Depending on the size of the files being copied, this directory can fill up very quickly! - The -o default_acl=public-read-write option will set anything you write to the bucket as publicly viewable and writable (by default, it's set to private).
- The -o default_acl=public-read option will set anything you write to the bucket as publicly viewable (by default, it's set to private).
這樣就能方便在您上傳檔案時,自動的將權限加上
避免您產生S3連結時,無法分享出來(但也可以手動修改)
df -H s3fs 282T 0 282T 0% /mnt/aaa
########
除錯
########
在make中如果有出現缺少的套件,導致無法編譯
再下,補足缺少
sudo apt-get install libfuse-dev libcurl4-openssl-dev libxml++2.6-dev libssl-dev
#!/bin/bash apt-get update #apt-get install -y build-essential libfuse-dev libcurl4-openssl-dev libxml2-dev mime-support automake libtool wget http://sourceforge.net/projects/fuse/files/fuse-2.X/2.9.3/fuse-2.9.3.tar.gz tar zxf fuse-2.9.3.tar.gz cd fuse-2.9.3 ./configure --prefix=/usr/local make && make install wget https://github.com/s3fs-fuse/s3fs-fuse/archive/v1.78.tar.gz tar zxf v1.78.tar.gz cd /home/sam.lin/fuse-2.9.3/s3fs-fuse-1.78 ./autogen.sh ./configure --prefix=/usr/local make && make install echo "AKIAI4D7PIRHKM7XU5UB:P1AQzMgdzpBD7kgQP54afFuemrok5wiR7GCZIuja" > /etc/passwd-s3fs chmod 600 /etc/passwd-s3fs rm -rf /home/sam.lin/fuse-2.9.*
細項路徑…記得修改成自己的環境