谷歌云CDN存储 gsutil 安装及使用

前言: 谷歌CDN资源文件上传我们一般通过gsutil这个工具,参考文档: https://cloud.google.com/storage/docs/gsutil/commands/config

 

一、安装python2.7

 

二、gsutil安装

[root@techroad ~]# wget http://commondatastorage.googleapis.com/pub/gsutil.tar.gz

[root@techroad ~]# tar zxvf gsutil.tar.gz

##解压之后将gsutil合作加入环境变量

[root@ ~ google-cloud-sdk]# gsutil ls

会提示权限相关需要认证

 

三、配置权限认证

[root@ ~ ~]# gsutil config -e

Backing up existing config file "/root/.boto" to "/root/.boto.bak"...

This command will create a boto config file at /root/.boto containing

your credentials, based on your responses to the following questions.

What is the full path to your private key file? /etc/gcs/dctm_account.json

##合作方提供到的json文件

Please navigate your browser to https://cloud.google.com/console#/project,

then find the project you will use, and copy the Project ID string from the

second column. Older projects do not have Project ID strings. For such projects,

click the project and then copy the Project Number listed under that project.

 

What is your project-id? p19-25309

##项目ID(json文件中有

Boto config file "/root/.boto" created. If you need to use a proxy to

access the Internet please see the instructions in that file.

 

四、测试上传

[root ~ google-cloud-sdk]# gsutil cp ./a gs://thientie/a ##存储分区

Copying file://./a [Content-Type=application/octet-stream]...

/ [1 files][ 0.0 B/ 0.0 B]

Operation completed over 1 objects.

五、上传公开链接参数

gsutil -h Cache-Control:private cp -a public-read

 

评论 1
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

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

抵扣说明:

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

余额充值