For this, one needs a Google account and to have setup a Storage Bucket
https://cloud.google.com/storage/docs/creating-buckets
Info below (in a nutshell) came from this resource:
https://www.assistanz.com/mount-google-cloud-storage-bucket-linux/
Well done and easy to follow.
now have gbucket on a Rackspace server and use the same Google bucket on
a Google Compute Engine instance as well.
Didn’t set in fstab as that might stall a reboot of server IF bucket can not be mounted.
Instead have a ‘mountgbucket’ script in /root that mounts.
Here’s the quickie …
wget https://dl.google.com/dl/cloudsdk/channels/rapid/downloads/google-cloud-sdk-156.0.0-linux-x86_64.tar.gz
tar zxvf google-cloud-sdk-156.0.0-linux-x86_64.tar.gz
./google-cloud-sdk/install.sh
source /root/.bashrc
gcloud auth login
gcloud components update
———————————————
* if you have already attempted setting up a bucket, one might
have to remove the following after doing the gcloud components update command.
rm /usr/lib64/google-cloud-sdk/bin/gcloud
rm /usr/lib64/google-cloud-sdk/bin/git-credential-gcloud.sh
rm /usr/lib64/google-cloud-sdk/bin/bq
rm /usr/lib64/google-cloud-sdk/bin/docker-credential-gcloud
rm /usr/lib64/google-cloud-sdk/bin/gsutil
gcloud components update
——————————————–
gcloud auth list
gcloud auth application-default login
gcloud auth application-default print-access-token
cd /etc/yum.repos.d
nano gcsfuse.repo
Contents of gcsfuse.repo
[gcsfuse]
name=gcsfuse (packages.cloud.google.com)
baseurl=https://packages.cloud.google.com/yum/repos/gcsfuse-el7-x86_64
enabled=1
gpgcheck=0
repo_gpgcheck=0
yum install gcsfuse
mkdir /mnt/gbucket
gcsfuse [yourbucketname] /mnt/gbucket
fusermount -u /mnt/gbucket
cd /root/
nano mountbucket
Csontents of mountbucket
export GOOGLE_APPLICATION_CREDENTIALS=/root/.config/gcloud/application_default_credentials.json;
mount -t gcsfuse -o rw,allow_other,nonempty [yourbucketname] /mnt/gbucket
Save the file
Make it executable:
chmod u+x mountbucket
Now the big test … mount it
./mountbucket/
It will display info and success.
See it there:
df -h
One should see a line:
yourbucketname 1.0P 0 1.0P 0% /mnt/gbucket