我先安装了PHP App Engine SDK。然后,我使用以下方法安装了Google Cloud SDK:
sudo curl https://sdk.cloud.google.com | bash
但安装时显示错误。
然后,我从zip文件安装了Google Cloud SDK,但在安装的最后阶段显示错误:
/home/nikhil/google-cloud-sdk/install.sh
Welcome to the Google Cloud SDK!
Traceback (most recent call last):
File "/home/nikhil/google-cloud-sdk/bin/bootstrapping/install.py", line 20, in <module>
from googlecloudsdk.gcloud import gcloud
File "/home/nikhil/google-cloud-sdk/bin/bootstrapping/../../lib/googlecloudsdk/gcloud/gcloud.py", line 190, in <module>
_cli = CreateCLI()
File "/home/nikhil/google-cloud-sdk/bin/bootstrapping/../../lib/googlecloudsdk/gcloud/gcloud.py", line 188, in CreateCLI
return loader.Generate()
File "/home/nikhil/google-cloud-sdk/bin/bootstrapping/../../lib/googlecloudsdk/calliope/cli.py", line 304, in Generate
cli = self.__MakeCLI(top_group)
File "/home/nikhil/google-cloud-sdk/bin/bootstrapping/../../lib/googlecloudsdk/calliope/cli.py", line 467, in __MakeCLI
log.AddFileLogging(self.__logs_dir)
File "/home/nikhil/google-cloud-sdk/bin/bootstrapping/../../lib/googlecloudsdk/core/log.py", line 547, in AddFileLogging
_log_manager.AddLogsDir(logs_dir=logs_dir)
File "/home/nikhil/google-cloud-sdk/bin/bootstrapping/../../lib/googlecloudsdk/core/log.py", line 331, in AddLogsDir
log_file = self._SetupLogsDir(logs_dir)
File "/home/nikhil/google-cloud-sdk/bin/bootstrapping/../../lib/googlecloudsdk/core/log.py", line 408, in _SetupLogsDir
os.makedirs(day_dir_path)
File "/usr/lib/python2.7/os.py", line 157, in makedirs
mkdir(name, mode)
OSError: [Errno 13] Permission denied: '/home/nikhil/.config/gcloud/logs/2015.07.03'
如何完成安装?
然后,我在终端上尝试gcloud info
,但它显示以下错误:
nikhil@nikhil-Aspire-S3-391:~$ gcloud info
Traceback (most recent call last):
File "/home/nikhil/google-cloud-sdk/./lib/googlecloudsdk/gcloud/gcloud.py", line 190, in <module>
_cli = CreateCLI()
File "/home/nikhil/google-cloud-sdk/./lib/googlecloudsdk/gcloud/gcloud.py", line 188, in CreateCLI
return loader.Generate()
File "/home/nikhil/google-cloud-sdk/./lib/googlecloudsdk/calliope/cli.py", line 304, in Generate
cli = self.__MakeCLI(top_group)
File "/home/nikhil/google-cloud-sdk/./lib/googlecloudsdk/calliope/cli.py", line 467, in __MakeCLI
log.AddFileLogging(self.__logs_dir)
File "/home/nikhil/google-cloud-sdk/./lib/googlecloudsdk/core/log.py", line 547, in AddFileLogging
_log_manager.AddLogsDir(logs_dir=logs_dir)
File "/home/nikhil/google-cloud-sdk/./lib/googlecloudsdk/core/log.py", line 331, in AddLogsDir
log_file = self._SetupLogsDir(logs_dir)
File "/home/nikhil/google-cloud-sdk/./lib/googlecloudsdk/core/log.py", line 408, in _SetupLogsDir
os.makedirs(day_dir_path)
File "/usr/lib/python2.7/os.py", line 157, in makedirs
mkdir(name, mode)
OSError: [Errno 13] Permission denied: '/home/nikhil/.config/gcloud/logs/2015.07.04'
答案 0 :(得分:30)
在创建目录/home/nikhil/.config/gcloud/logs/2015.07.04
时,这看起来像是文件权限错误。你能检查所有父目录的存在和文件权限吗?
ls -ld /home/nikhil/
ls -ld /home/nikhil/.config
ls -ld /home/nikhil/.config/gcloud
ls -ld /home/nikhil/.config/gcloud/logs
ls -ld /home/nikhil/.config/gcloud/logs/2015.07.04
然后将输出上传到此问题。
我的预感是您以root用户(通常不推荐)运行Cloud SDK命令,该用户创建了/home/nikhil/.config/gcloud
目录,其中root
为所有者。如果是这种情况,请执行以下命令:
sudo chown -R nikhil /home/nikhil/.config/gcloud
可能会解决问题。
顺便说一下,命令sudo curl https://sdk.cloud.google.com | bash
不会做你想做的事;它以root身份执行curl
,但实际安装不会以root用户身份执行。可以在没有root权限的情况下安装Cloud SDK,因此我建议只使用curl https://sdk.cloud.google.com | bash
。