How do I permanently install an apt package in Google Cloud Shell? - google-cloud-platform

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.

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.

Related

How to install FFMPEG into GCP

How to install FFMPEG in Google Cloud Shell. is that possible?
screenshot of error
sorry for my bad language
You can install FFmpeg on Cloud Shell using the following commands. However, your Cloud Shell machine is ephemeral and no system-wide change will persist beyond session end.
sudo add-apt-repository ppa:mc3man/trusty-media
sudo apt-get update
sudo apt-get install ffmpeg
Customize Cloud Shell

ModuleNotFoundError: No module named 'fuse'

I have set up a GPU Jupyter Notebook VM using the AI platform on Google Cloud. The server runs Debian stretch.
I want to mount a bucket I've created called example onto a folder called /home/jupyter/transfer. I've been following the instructions outlined here but when I run gsfuse example /home/jupyter/transfer I get the error:
ModuleNotFoundError: No module named 'fuse'
I've installed fuse with:
sudo apt-get install fuse
which is successful but the gsfuse code still doesn't run. I then installed the pip package with:
pip install fuse-python
And it still wouldn't work.
Any ideas?
After a lot of trial and error I managed to figure this out. The problem was the python package and where I was installing it.
If you do:
sudo apt-get install fuse
pip install -U fusepy --user
gsfuse example /home/jupyter/transfer --background
It'll work (where --background) runs the mount in the backgroud.

How to add user made scripts to EC2 ubuntu?

I have created an EC2 instance on AWS and I want to transfer some scripts into the site-packages of python3. I can't seem to find a way to do this. Some functions from these files are used by the scripts I am looking to run.
I tried SFTP but it wont allow me to get into the folder just tried to download it.
I am on Ubuntu.
Thanks
Best option to install any service or program in python on a linux server is to create a regular user and then create a virtualenv on a private directory. There, you can freely install any script or package and give the proper rights to specific services/directories of your server.
Install also basic packages in order to run python environment:
sudo apt-get install -y build-essential python-dev python-setuptools zlib1g-dev python-pip

Missing AWS Dependency

i had a case where i need to configure an AWS structure similar to the architecture that is described in this article, is but this article is old, when i followed the steps i couldn't pass the step at which i run the script "vip_monitor.sh".
so be specific, at the step 5 by running the script i got the following error
Can't open /etc/profile.d/aws-apitools-common.sh
that shell script doesn't exist in the whole machine, how to solve this issue?
Thanks in advance
You will have to set api tools manually.
Ubuntu makes their own AMI's for Amazon, and they don't build the apitools into the images.
You can use official ubuntu documentation to fix these:
Install ec2 api tools
sudo apt-add-repository ppa:awstools-dev/awstools
sudo apt-get update
sudo apt-get install ec2-api-tools
actually i installed the ec2-api-tools J.Parashar instructed, and when i ran the script vip_monitor.sh it gave me the same error so i just took the missing script aws-apitools-common.sh file from an Amazon Linux instance and paste it at the path /etc/profile.d/ and then changed the mode to the script to executable chmod +x aws-apitools-common.sh and ran the script 'vip_monitor.sh'.
if you had the error :Unexpected operator run the script with bash ./vip_monitor.sh

How to restore gsutil command?

I have updated Google Cloud SDK to the latest version 135.0.0 from
After the update , I got the following message.
WARNING: There are older versions of Google Cloud Platform tools on
your system PATH. Please remove the following to avoid accidentally
invoking these old tools:
/usr/bin/git-credential-gcloud.sh
/usr/bin/bq
/usr/bin/gcloud
/usr/bin/gsutil
So I have deleted all the above folders.
After that gsutil stopped working.
Please help me how can I resolve the issue.
The issue that it was installed via
sudo apt-get update && sudo apt-get install google-cloud-sdk
see
https://cloud.google.com/sdk/docs/#deb
and you should have used the same mechanism to upgrade.
gcloud is also kind of a package manager, and is able to upgrade itself and its depended packages. Unfortunately if you use gcloud itself to upgrade it installs it in different location. It likely does not work because new location needs to be added to your path.
You can try to reinstall googcle-cloud-sdk package via apt-get.