ossutil对应的阿里云参考文档链接地址:
https://help.aliyun.com/document_detail/50452.html?spm=a2c4g.11186623.6.1355.2c64245fO1aymE
自己测试使用的机所在region:
华北2(北京)
第一次使用ossutil上传文件的操作:
1.在CentOS上下载 ossutil工具:
[root@www ~]# wget http://gosspublic.alicdn.com/ossutil/1.5.0/ossutil64
[root@www ~]# chmod ossutil64 //赋予命令可执行权限 [root@www ~]# mkdir /home/user/ //创建配置文件所在路径
[root@www ~]# cd /home/user/
[root@www user]# touch .ossutilconfig //在配置文件路径下创建配置文件
对ossutil进行相关的配置
[root@www ~]# ./ossutil64 config
the path when you use other commands):/home/user/.ossutilconfig
For the following settings, carriage return means skip the configuration. Please try "help config" to see the meaning of the settings
Please enter language(CH/EN, default is:EN, the configuration will go into effect after the command successfully executed):CH
Please enter endpoint:oss-cn-beijing.aliyuncs.com
Please enter accessKeyID:LTAIRwR8OR
Please enter accessKeySecret:6hkayHmAUJWR
Please enter stsToken:
查看配置完后配置文件里面写入的相关内容
[root@www ~]# cat /home/user/.ossutilconfig
[Credentials]
language=EN
endpoint=oss-cn-shanghai.aliyuncs.com
accessKeyID=LTABSjR8OR
accessKeySecret=6hkayH2JnrZB0PAUJWR
使用ossutil在命令行创建oss bucket
[root@www ~]# ./ossutil64 mb oss://sdrtest1 -c /home/user/.ossutilconfig //创建bucket /*这里发现如果不指定配置文件会报错,最后发现默认的配置文件读取路径是/root/.ossutilconfig */
将配置文件移动到默认文件夹内:
[root@www ~]# cp -R /home/user/.ossutilconfig /root/.ossutilconfig //将配置文件移动到默认的配置文件读取路径下
上传文件:
[root@www ~]# touch a.txt
[root@www ~]# ./ossutil64 cp a.txt oss://sdrtest1/
Succeed: Total num: , size: . OK num: (upload files).
0.126039(s) elapsed
验证操作: