Go to console.cloud.google.com and sign in and start Google Cloud Shell
For Debian and Ubuntu-based Linux distributions, perform the following steps:
Add the Cloud Foundry Foundation public key and package repository to your system:
$ wget -q -O - https://packages.cloudfoundry.org/debian/cli.cloudfoundry.org.key | sudo apt-key add -
$ echo "deb https://packages.cloudfoundry.org/debian stable main" | sudo tee /etc/apt/sources.list.d/cloudfoundry-cli.list
Update your local package index:
$ sudo apt-get update
Install the cf CLI:
$ sudo apt-get install cf-cli
For Enterprise Linux and Fedora systems (RHEL6/CentOS6 and up), perform the following steps:
Configure the Cloud Foundry Foundation package repository:
$ sudo wget -O /etc/yum.repos.d/cloudfoundry-cli.repo https://packages.cloudfoundry.org/fedora/cloudfoundry-cli.repo
Install the cf CLI, which also downloads and adds the public key to your system:
$ sudo yum install cf-cli