linux系统安装s3fs,在Linux安装s3cmd

66b52468c121889b900d4956032f1009.png

8种机械键盘轴体对比

本人程序员,要买一个写代码的键盘,请问红轴和茶轴怎么选?

s3cmd是用于创建和管理数据到Amazon S3存储命令行的实用进程。本文将帮助你如何在CentOS上安装s3cmd

s3cmd 是用于创建S3桶,上传,检索和管理数据到Amazon S3存储命令行实用进程。 本文将帮助你如何在CentOS,RHEL,OpenSUSE系统,Ubuntu,Debian和LinuxMint系统上安装s3cmd,并通过简单的步骤命令行管理S3桶。 要在阅读文章Windows服务器安装s3cmd 在Windows中安装s3cmd。 我们还可以使用S3FS与FUSE在我们的系统本地驱动器安装S3存储桶。要配置阅读下一篇文章在Linux上安装S3存储 。 女将-S3-中心标志

安装s3cmd包

s3cmd是默认的RPM库针对CentOS,RHEL和Ubuntu系统上可用,您可以简单的在系统上执行以下命令进行安装。

在CentOS / RHEL:# yum install s3cmd

在Ubuntu / Debian:$ sudo apt-get install s3cmd

在SUSE Linux Enterprise Server 11:# zypper addrepo http://s3tools.org/repo/SLE_11/s3tools.repo

# zypper install s3cmd

使用Source安装最新s3cmd

如果使用上述软件包管理器s3cmd,你没有得到最新的版本,可以使用源代码,在系统上安装最新的s3cmd版本。访问此网址或者使用下面的命令来下载最新版本的s3cmd。$ wget http://ufpr.dl.sourceforge.net/project/s3tools/s3cmd/1.6.1/s3cmd-1.6.1.tar.gz

$ tar xzf s3cmd-1.6.1.tar.gz

现在,使用下面的命令与源文档进行安装。$ cd s3cmd-1.6.1

$ sudo python setup.py install

配置s3cmd环境

为了配置s3cmd我们将要求有您S3 Amazon帐户访问key和钥匙。获取安全密钥AWS securityCredentials 。将提示登录到您的Amazon帐户。 获取密钥文档后,请使用以下命令来配置s3cmd。# s3cmd --configureEnter 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: xxxxxxxxxxxxxxxxxxxxxx

Secret Key: xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx

Encryption password is used to protect your files from reading

by unauthorized persons while in transfer to S3

Encryption password: xxxxxxxxxx

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]: Yes

New settings:

Access Key: xxxxxxxxxxxxxxxxxxxxxx

Secret Key: xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx

Encryption password: xxxxxxxxxx

Path to GPG program: /usr/bin/gpg

Use HTTPS protocol: True

HTTP Proxy server name:

HTTP Proxy server port: 0

Test access with supplied credentials? [Y/n] Y

Please wait, attempting to list all buckets...

Success. Your access key and secret key worked fine :-)

Now verifying that encryption works...

Success. Encryption and decryption worked fine :-)

Save settings? [y/N] y

Configuration saved to '/root/.s3cfg'

s3cmd命令行的使用

一旦配置成功完成。现在找到下面的命令细节,如何使用命令管理S3桶。

1.列出全部S3桶

使用以下命令行出在您的AWS账户中的所有S3桶。# s3cmd ls

2.创建新桶

要在下面的命令Amazon S3上使用的新桶。这将创建S3帐户名为howtoing桶。# s3cmd mb s3://howtoing

Bucket 's3://howtoing/' created上传文档到S3桶

以下命令将使用s3cmd命令上传文档file.txt的到S3桶。# s3cmd put file.txt s3://howtoing/

file.txt -> s3://howtoing/file.txt [1 of 1]

190216 of 190216 100% in 0s 1668.35 kB/s done

4.上传文档夹到s3桶

如果我们需要上传整个目录使用-r递归上传,像下面这样。# s3cmd put -r backup s3://howtoing/

backup/file1.txt -> s3://howtoing/backup/file1.txt [1 of 2]

9984 of 9984 100% in 0s 18.78 kB/s done

backup/file2.txt -> s3://howtoing/backup/file2.txt [2 of 2]

0 of 0 0% in 0s 0.00 B/s done

请确保您上传目录的结尾没有斜杠 / (如:backup/),否则将只上传备份目录中的内容。# s3cmd put -r backup/ s3://howtoing/

backup/file1.txt -> s3://howtoing/file1.txt [1 of 2]

9984 of 9984 100% in 0s 21.78 kB/s done

backup/file2.txt -> s3://howtoing/file2.txt [2 of 2]

0 of 0 0% in 0s 0.00 B/s done

5.列出S3存储数据

使用 ls 与 s3cmd 切换目录S3桶的对象。# s3cmd ls s3://howtoing/

DIR s3://howtoing/backup/

2013-09-03 10:58 190216 s3://howtoing/file.txt

6.从s3下载文档

有些时候,如果我们需要从S3下载文档,使用下面的命令来下载。# s3cmd get s3://howtoing/file.txt

s3://howtoing/file.txt -> ./file.txt [1 of 1]

4 of 4 100% in 0s 10.84 B/s done

7.删除S3桶的数据

要删除的文档夹都是从S3桶使用下面的命令。Removing file from s3 bucket

# s3cmd del s3://howtoing/file.txt

File s3://howtoing/file.txt deleted

Removing directory from s3 bucket

# s3cmd del s3://howtoing/backup

File s3://howtoing/backup deleted

8.卸下S3桶

如果我们不需要S3存储,我们可以用下面的命令直接删除它。取出桶之前,请确保它是空的。# s3cmd rb s3://howtoing

ERROR: S3 error: 409 (BucketNotEmpty): The bucket you tried to delete is not empty

上面的命令失败,因为S3桶不为空 要删除s3 桶先删除里面所有对象,然后再次使用命令。# s3cmd rb s3://howtoing

Bucket 's3://howtoing/' removed

  • 0
    点赞
  • 1
    收藏
    觉得还不错? 一键收藏
  • 0
    评论

“相关推荐”对你有帮助么?

  • 非常没帮助
  • 没帮助
  • 一般
  • 有帮助
  • 非常有帮助
提交
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值