S3cmd命令行管理对象存储

我的使用步骤

cd /usr/    目录

git clone https://github.com/jdcloud-cmw/s3cmd.git   下载文件

ln -s /usr/s3cmd/s3cmd /usr/bin/s3cmd   软连接,命令行快捷命令支持

配置~/.s3cfg  ~表示用户目录   access_key secret_key 填写自己账号的秘钥   host_bucket 修改为 bucket的访问网址 如: bucketname.s3.cn-north-1.jcloudcs.com  其他我未做修改

[default]
access_key = [you access key]
secret_key = [you secret key]
access_token = 
add_encoding_exts = 
add_headers = 
bucket_location = cn
ca_certs_file = 
cache_file = 
check_ssl_certificate = True
check_ssl_hostname = True
cloudfront_host = cloudfront.amazonaws.com
default_mime_type = binary/octet-stream
delay_updates = False
delete_after = False
delete_after_fetch = False
delete_removed = False
dry_run = False
enable_multipart = True
encrypt = False
expiry_date = 
expiry_days = 
expiry_prefix = 
follow_symlinks = False
force = False
get_continue = False
gpg_command = /usr/bin/gpg
gpg_decrypt = %(gpg_command)s -d --verbose --no-use-agent --batch --yes --passphrase-fd %(passphrase_fd)s -o %(output_file)s %(input_file)s
gpg_encrypt = %(gpg_command)s -c --verbose --no-use-agent --batch --yes --passphrase-fd %(passphrase_fd)s -o %(output_file)s %(input_file)s
gpg_passphrase = 
guess_mime_type = True
host_base = s3.cn-north-1.jcloudcs.com
host_bucket = %(bucket)s.s3.cn-north-1.jcloudcs.com
human_readable_sizes = False
invalidate_default_index_on_cf = False
invalidate_default_index_root_on_cf = True
invalidate_on_cf = False
kms_key = 
limit = -1
limitrate = 0
list_md5 = False
log_target_prefix = /home/eric/jcloud/s3.log
long_listing = False
max_delete = -1
mime_type = 
multipart_chunk_size_mb = 15
multipart_max_chunks = 10000
preserve_attrs = True
progress_meter = True
proxy_host = 
proxy_port = 0
put_continue = False
recursive = False
recv_chunk = 65536
reduced_redundancy = False
requester_pays = False
restore_days = 1
restore_priority = Standard
send_chunk = 65536
server_side_encryption = False
signature_v2 = False
simpledb_host = sdb.amazonaws.com
skip_existing = False
socket_timeout = 300
stats = False
stop_on_error = False
storage_class = 
urlencoding_mode = normal
use_http_expect = False
use_https = True
use_mime_magic = True
verbosity = WARNING
website_endpoint = http://%(bucket)s.s3-website-%(location)s.amazonaws.com/
website_error = 
website_index = index.html

s3cmd del --recursive s3://bucketName/
s3cmd ls s3://bucketName/

使用参考: https://docs.jdcloud.com/cn/object-storage-service/s3cmd

github地址:  https://github.com/jdcloud-cmw/s3cmd

s3fs-fuse 支持对象存储挂载到系统 安装使用  https://github.com/s3fs-fuse/s3fs-fuse/wiki/Installation-Notes

安装s3fs-fuse https://tecadmin.net/mount-s3-bucket-centosrhel-ubuntu-using-s3fs/

注意:

s3cmd 需要python2.7及以上支持

安装 python2.7
cd /usr/local
wget https://www.python.org/ftp/python/2.7.15/Python-2.7.15.tgz
tar -xvf Python-2.7.15.tgz
cd Python-2.7.15
./configure --prefix=/usr/local/python2.7
make
make install
ln -s /usr/local/python2.7/bin/python2.7 /usr/bin/python2.7

安装 pip
curl https://bootstrap.pypa.io/get-pip.py -o get-pip.py
python2.7 get-pip.py
ln -s /usr/local/python2.7/bin/pip2.7 /usr/bin/pip2.7

http://www.runoob.com/w3cnote/python-pip-install-usage.html

修给s3cmd 文件 第一行为

#!/usr/bin/env python2.7

安装 python3.7 

cd /usr/local
wget https://www.python.org/ftp/python/3.7.2/Python-3.7.2.tgz
tar -xvf Python-3.7.2.tgz
cd Python-3.7.2
./configure --prefix=/usr/local/python3.7
make
make install

安装python make install ModuleNotFoundError: No module named ‘_ctypes’ 错误需要安装其他依赖
yum upgrade
yum dist-upgrade
yum install build-essential python-dev python-setuptools python-pip python-smbus
yum install build-essential libncursesw5-dev libgdbm-dev libc6-dev
yum install zlib1g-dev libsqlite3-dev tk-dev
yum install libssl-dev openssl
yum install libffi-dev
https://blog.lovexu.cc/archives/337

python3.7 安装完不支持  import ssl 

模块导入错误
https://blog.csdn.net/qq_26870933/article/details/84336109

按照上面的方式修改后 重新 安装不成功  报错误ssl版本低

目前我没处理。 转而使用2.7版本

原文地址:https://www.cnblogs.com/swing07/p/10299908.html