I tried to install a package with apt-get
cloud shell once but the next day it was gone. I saw another stackoverflow here. But it was out of date (I think). Please help.
Asked
Active
Viewed 1,695 times
1

Donnald Cucharo
- 3,866
- 1
- 10
- 17

aflamaroc
- 37
- 6
-
See: https://cloud.google.com/shell/docs/configuring-cloud-shell#environment_customization_script – DazWilkin Mar 04 '21 at 19:25
1 Answers
2
As you can see from the link @DazWilkin has provided, the only directory where Cloud Shell persists your file is at $HOME
directory. Anything installed with apt
will not persist when the instance provisioned in Cloud Shell shuts down.
There's a solution for this problem. The script $HOME/.customize_environment
runs everytime you boot up Cloud Shell. It is already running as root and there you can run apt
to install the packages you want.
Example, as per doc:
#!/bin/sh
apt-get update
apt-get -y install erlang
Update: There seems to be an issue where .customize_environment
is not working. It's been confirmed by a Google Engineer and it's currently being fixed.

Donnald Cucharo
- 3,866
- 1
- 10
- 17
-
-
-
I can only see workarounds. It really depends to you if it's all worth it, but for me it isn't. https://askubuntu.com/questions/193695/installing-packages-into-local-directory – Donnald Cucharo Mar 08 '21 at 03:02
-