I'm installing Google Cloud SDK to use it ask my source code repository (for now) for Android apps using the install.sh script included in the root of the SDK however, I am having a few issues.

First, I'd like to ask if the SDK need not to be under root protected path, let me explain my logic... When installing without elevated privileges, an exemption is raised.
-Command: $ ./install.sh
-Output:

Traceback (most recent call last):
  File "/opt/google-cloud-sdk/bin/bootstrapping/install.py", line 218, in <module>
    main()
  File "/opt/google-cloud-sdk/bin/bootstrapping/install.py", line 193, in main
    Prompts(pargs.usage_reporting)
  File "/opt/google-cloud-sdk/bin/bootstrapping/install.py", line 116, in Prompts
    scope=properties.Scope.INSTALLATION)
  File "/opt/google-cloud-sdk/lib/googlecloudsdk/core/properties.py", line 1830, in PersistProperty
    config.EnsureSDKWriteAccess()
  File "/opt/google-cloud-sdk/lib/googlecloudsdk/core/config.py", line 192, in EnsureSDKWriteAccess
    raise exceptions.RequiresAdminRightsError(sdk_root)
googlecloudsdk.core.exceptions.RequiresAdminRightsError: You cannot perform this action because you do not have permission to modify the Google Cloud SDK installation directory [/opt/google-cloud-sdk].

As it can be seen in the last line, it is clear that this exception was raised because of permissions issue with writing to my chosen installed directory, in this case [/opt/google-cloud-sdk].

Now if I run ./install.sh with elevated privileges I get this warning:
-Command: $ sudo ./install.sh
-Output:

WARNING: You appear to be running this script as root. This may cause 
the installation to be inaccessible to users other than the root user.

I chose to ignore this message and continued with the very bumpy installation eventually giving up and coming here.

Before attempting to recreate all the issues encountered, I'd like to, first start on the right path, then if/as issues come up, I'll provide the details.

I'd recommend installing the binary packages produced by the gcloud team:

https://cloud.google.com/sdk/downloads#apt-get

I hesitate to copy the instructions into here as they change from time to time, but they are roughly:

  1. Add repository for sdk
  2. Add package signing key with apt-key
  3. install appropriate package like sudo apt install google-cloud-sdk
  • Thanks for the link to the Ubuntu/Debian instructions, I must have missed it and chose the "Linux" section instead. – Alex Apr 12 at 5:42

Your Answer

By clicking "Post Your Answer", you acknowledge that you have read our updated terms of service, privacy policy and cookie policy, and that your continued use of the website is subject to these policies.

Not the answer you're looking for? Browse other questions tagged or ask your own question.