安装参考地址:https://help.aliyun.com/document_detail/120075.html
CP常用命令:https://help.aliyun.com/document_detail/120057.html

  1. 下载工具:
    wget http://gosspublic.alicdn.com/ossutil/1.6.9/ossutil64                           
    
  2. 修改文件执行权限:
    chmod 755 ossutil64
    
  3. 使用交互式配置生成配置文件:
    ./ossutil64 config
    请输入配置文件名,文件名可以带路径(默认为:/home/user/.ossutilconfig,回车将使用默认路径。如果用户设置为其它路径,在使用命令时需要将--config-file选项设置为该路径): 
    未输入配置文件路径,将使用默认配置文件:/home/user/.ossutilconfig。 
    对于下述配置,回车将跳过相关配置项的设置,配置项的具体含义,请使用"help config"命令查看。 
    请输入endpoint:http://oss-cn-shenzhen.aliyuncs.com 
    请输入accessKeyID:yourAccessKeyID 
    请输入accessKeySecret:yourAccessKeySecret
    请输入stsToken:
    
[Credentials]
language=EN
endpoint=oss-cn-hangzhou-internal.aliyuncs.com
accessKeyID=
accessKeySecret=
  1. 测试一下,是否可以正常的连接,如果正常的话,可以看到你阿里云账户的几个仓库和名称
 ./ossutil64 ls

实操部分

[root@iZcyriae88knxxZ ~]# ./ossutil64 config
The command creates a configuration file and stores credentials.

Please enter the config file name,the file name can include path(default /root/.ossutilconfig, carriage return will use the default file. If you specified this option to other file, you should specify --config-file option to the file when you use other commands):
No config file entered, will use the default config file /root/.ossutilconfig

请输入配置文件名,文件名可以包含路径(default/root/.ossutilconfig,回车将使用默认文件)。如果将此选项指定给其他文件,则应在使用其他命令时为该文件指定--config file选项)
未输入配置文件,将使用默认配置文件/root/.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):EN
Please enter endpoint:oss-cn-hangzhou-internal.aliyuncs.com
Please enter accessKeyID:1111111111111111111111111111
Please enter accessKeySecret:222222222222222222222222
Please enter stsToken:
[root@iZcyriae88knxxZ ~]#
[root@iZcyriae88knxxZ ~]# ./ossutil64 ls
CreationTime Region StorageClass BucketName
2019-05-29 16:08:51 +0800 CST oss-cn-hangzhou Standard oss://aliyun-cloudduo-cn
2018-12-15 14:08:19 +0800 CST oss-ap-northeast-1 Standard oss://ap-cloudduo-cn
2018-07-24 11:50:57 +0800 CST oss-cn-hangzhou Standard oss://cloudduo
[root@iZcyriae88knxxZ ~]#
[root@iZcyriae88knxxZ ~]# ./ossutil64 cp /www/wwwroot/mysqlback/2019_12_05_020001.tar.gz oss://cloudduo/ossutil64/
Succeed: Total num: 1, size: 585,519. OK num: 1(upload 1 files).
0.061854(s) elapsed

拷贝 /www/wwwroot/mysqlback 里面的所有文件,递归的方式上传到oss://cloudduo/ossutil64/mysqlback 目录中

[root@iZcyriae88knxxZ ~]# ./ossutil64 cp -r /www/wwwroot/mysqlback oss://cloudduo/ossutil64/mysqlback