aflamaroc
aflamaroc

Reputation: 49

How do I permanently install an apt package in Google Cloud Shell?

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.

Upvotes: 2

Views: 2926

Answers (1)

Donnald Cucharo
Donnald Cucharo

Reputation: 4126

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.

Upvotes: 3

Related Questions