====== 34 s3cmd ====== S3を管理できるツールです。 バケットを作成したりファイルやフォルダをアップロードしたり公開設定を指定したりといった事が簡単にできます。 ===== インストール ===== ==== 1. gitでクローンを作成 ==== [[01_linux:01_net:35_gitインストール|]] $ git clone git://github.com/s3tools/s3cmd ==== 2. moduleなどインストール ==== $ cd s3cmd $ sudo python setup.py install ==== 3. configファイル作成 ==== $ s3cmd --configure Enter new values or accept defaults in brackets with Enter. Refer to user manual for detailed description of all options. Access key and Secret key are your identifiers for Amazon S3 Access Key: XXXXXXXXXXXXXXXXXXX Secret Key: XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX Encryption password is used to protect your files from reading by unauthorized persons while in transfer to S3 Encryption password: Path to GPG program [/usr/bin/gpg]: When using secure HTTPS protocol all communication with Amazon S3 servers is protected from 3rd party eavesdropping. This method is slower than plain HTTP and can't be used if you're behind a proxy Use HTTPS protocol [No]: On some networks all internet access must go through a HTTP proxy. Try setting it here if you can't conect to S3 directly HTTP Proxy server name: New settings: Access Key: XXXXXXXXXXXXXXXXXXX Secret Key: XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX Encryption password: Path to GPG program: /usr/bin/gpg Use HTTPS protocol: False HTTP Proxy server name: HTTP Proxy server port: 0 Test access with supplied credentials? [Y/n] n Save settings? [y/N] y これでホームディレクトリに「**.s3cfg**」というファイルができる。 ==== 4. configファイル修正 ==== デフォルトではs3.amazonaws.comになっている所を、riack-csのcs_root_hostに変更する。 $ vi ~/.s3cfg host_base = s3.amazonaws.com host_bucket = %(bucket)s.s3.amazonaws.com ↓ host_base = hogehoge.hoge host_bucket = %(bucket)s.hogehoge.hoge ==== 5. 確認 ==== s3cmdコマンドが実行できればOK $ s3cmd ls 2013-12-06 01:28 s3://matsui-bucket ===== CentOS5系でv1.5.0を利用の場合 ===== Python 2.4 では v1.5.0 は利用できない。 \\ CentOS 5系は、Python 2.4なので、別途Python 2.6を利用する必要があります。 s3cmd / NEWS s3cmd 1.5.0-beta1 - 2013-12-02 ================= * Brougt to you by Matt Domsch and contributors, thanks guys! :) * Multipart upload improvements (Eugene Brevdo, UENISHI Kota) Python 2.6をインストール後Python 2.6にモジュールインストールと、s3cmdコマンドの修正 [[01_linux:01_net:33_centos5にpython2.6インストール|]] ・Python 2.6用モジュールインストール # cd s3cmd # python26 setup.py install ・コマンド修正 # vi /usr/bin/s3cmd #!/usr/bin/python ↓ #!/usr/bin/python26