HomeAbout UsContact
Mount Google Cloud Storage On Compute Engine Or Linux
Cloud
Mount Google Cloud Storage On Compute Engine Or Linux
DaemonSlayer
DaemonSlayer
November 15, 2021
2 min

Table Of Contents

01
PREREQUISITES
02
INSTALL GCSFUSE ON UBUNTU 18.04 LTS
03
INSTALL GCSFUSE ON CENTOS 7
04
ADD CREDENTIALS
05
MOUNT GCS BUCKET
06
USEFUL LINKS

In this tutorial will show you how to mount Google Cloud Storage (GCS) Bucket on Compute Engine or Linux.

We use Google Cloud Storage FUSE tool or gcsfuse, gcsfuse has been tested successfully with the following operating systems:

  • Linux (minimum kernel version 3.10)
  • OS X (minimum version 10.10.2)
  • It may or may not work correctly with other operating systems and older versions.

If you are running on Google Compute Engine, it is recommended that you use one of the following images with which it has been tested (preferring the latest version when possible):

  • ubuntu-2004-lts, ubuntu-1804-lts, ubuntu-1604-lts, and ubuntu-1404-lts
  • debian-8, debian-7
  • centos-8, centos-7
  • rhel-7
  • sles-12

PREREQUISITES


For this tutorial i use the following setup:

  • Compute Engine Instance with Ubuntu 18.04 LTS
  • Hetzner VPS with CentOS 7

INSTALL GCSFUSE ON UBUNTU 18.04 LTS


Add gcsfuse repository with the following command

export GCSFUSE_REPO=gcsfuse-`lsb_release -c -s`
echo "deb http://packages.cloud.google.com/apt $GCSFUSE_REPO main" | sudo tee /etc/apt/sources.list.d/gcsfuse.list
curl https://packages.cloud.google.com/apt/doc/apt-key.gpg | sudo apt-key add -

Update and install gcsfuse

sudo apt-get update
sudo apt-get install gcsfuse

Verify that gcsfuse is installed successfully

gcsfuse -v

INSTALL GCSFUSE ON CENTOS 7


Add gcsfuse repository with the following command

sudo tee /etc/yum.repos.d/gcsfuse.repo > /dev/null <<EOF
[gcsfuse]
name=gcsfuse (packages.cloud.google.com)
baseurl=https://packages.cloud.google.com/yum/repos/gcsfuse-el7-x86_64
enabled=1
gpgcheck=1
repo_gpgcheck=0
gpgkey=https://packages.cloud.google.com/yum/doc/yum-key.gpg
       https://packages.cloud.google.com/yum/doc/rpm-package-key.gpg
EOF

Install gcsfuse

sudo yum install gcsfuse

Verify that gcsfuse is installed successfully

gcsfuse -v

ADD CREDENTIALS


We will the simple setting credentials using google account associated with the Google Cloud Storage, For default, Google Cloud SDK (gcloud) is already installed on Compute Engine Instance. Optionally If not, install gcloud using this tutorial https://cloud.google.com/sdk/docs/install and make sure to set the project

Run the following command to set credentials for gcsfuse

gcloud auth application-default login

If there is prompt asking Do you want to continue (Y/n)? type y and hit enter

MOUNT GCS BUCKET


First create directory for the mount location, for example we can create directory on user home folder /home/[user]/gcsbucket

cd ~
pwd
mkdir gcsbucket

Mount gcs bucket using the following command

gcsfuse [bucket-name] /home/[user]/gcsbucket

change [bucket-name] with your bucket name and [user] with your username

[Optional] If you want to only mount specific folder in the bucket you can use this command

gcsfuse --only-dir [folder-name] [/folder-name] [bucket-name] /home/[user]/gcsbucket

change [folder-name] with folder name in your bucket, [bucket-name] with your bucket name and [user] with your username.

Bucket mounting success, now you can check by cd to /home/gcsbucket.

Also try creating directory or creating and copying files, after that verify the folder or files created by going to Google Cloud Storage (GCS) Bucket in Google Cloud Console.

File and Folder created are automatically showing up on Google Cloud Storage (GCS) Bucket in Google Cloud Console



Tags

DaemonSlayer

DaemonSlayer

IT Enthusiast

Writing a blog about IT and how to use it to your advantage.

Expertise

PHP
Javascript
Cloud Architect

Social Media

githubwebsite

Related Posts

How To Install Nginx-Vod-Module From Kaltura On Ubuntu 20.04 LTS
November 15, 2021
2 min
© 2022, All Rights Reserved.

Quick Links

Advertise with usAbout UsContact Us

Social Media