Written by Paul Ogier on September 16, 2021

Installing GAMADV-XTD3 on Ubuntu (Linux)

This lesson is part of the "TAMING GAM - A practical guide to GAM and GAMADV-XTD3" course.

In this lesson, we will be walking you through the set-up of GAMADV-XTD3 on an Ubuntu Linux machine. You can either watch the video below or follow the images and steps detailed below.

If you are trying to install GAM on another operating system, please refer to these articles:

GAMADV-XTD3 on Windows


GAMADV-XTD3 on Google Cloud Shell

Are you however trying to just upgrade your installation of GAM?

Let's get started.

If you would like to try it yourself, you can start here.

Download And Install GAMADV-XTD3

Let's start by opening a terminal on Ubuntu and running this command.

bash <(curl -s -S -L https://git.io/fhZWP)

Once that has run, you will see that it has added the GAM Alias to the profile file.

Create GAMConfig and GAMWork Directories

Before you continue, open a separate terminal window to make a couple of directories using the MKDIR command.

GAMConfig and GAMWork

mkdir GAMConfig in the linux terminal

Check that the Alias has been created

Now we need to check that the alias for GAM is in our BASH Terminal using this command.

nano ~/.bashrc

This will open the nano editor. You can use whatever editor you are comfortable with.

Check the bash for the GAM alias

You will see in the last line there, my alias is defined using my path. This will obviously change based on the user that you are logged into your machine as. Once you have confirmed the GAM alias, you can close the nano editor, using CTRL X.

Create GAMADV-XTD3 Project in Google Workspace

Go back to the first terminal that you started in and answer the question on the screen. "Can you run a full browser on this machine?" And press the Y button and enter.

It should then say "GAM is now installed. Are you ready to set up a Google API project for GAM?" Just press Y again and enter.

Enter an Admin Email Address for Google Workspace.

Now type an admin email address that is present in Google Workspace.

Allow the GAM Project Creation in Google Workspace

Click allow on the screen that pops up in your browser to allow the GAM Project Creation to access the Google Account.

Back in the terminal, you will be asked to click on a URL. You can either right-click and copy it or directly click on it, depending on your Terminal Emulator and paste it in a browser.

Create the OAuth client ID

Create and desktop app and name the OAuth client ID for the GAM Project

In the browser that you have opened with the URL, select "Desktop app" and name the OAuth client ID that you are creating. I have simply called mine GAM Ubuntu or GAM Linux. Then click the create button.

Then copy the Client ID and Client Secret one at a time and paste it into the terminal in the respective places.

Now you need to press Y to "Authorize GAM to perform Google Workspace Management operations as your admin account".

Authorise GAM to perform Google Workspace Management operations

Select GAM Scopes

Then you need to select the scopes that you would like GAM to be responsible for. 

Each scope is represented by a number. You can either select all the scopes by pressing S, unselect all scopes by pressing U, or just continue by pressing C. If you need to select a scope that has a blank next to it, then type in the number that represents that scope. You can also, if it is supported, make it read-only by adding an R after the number.

Select authorised scopes for GAM

Now authorise the script in the browser window that pops up.

The authorisation of GAM is complete and now we need to authorise GAM to manage Google Workspace data and settings.

GAMADV-XTD3 is now authorised. We now also need to authorise GAM to manage Google Workspace user data and settings. To authorise that, just press Y again.

Now you need to type the email address of a regular Google Workspace user.

The authorisation for GAM will fail the first time

This will fail the first time. This is almost a test step. You will be asked to copy a very long URL and paste it into your browser to make this happen.

Select the full URL to authorise GAM

Please select from the top of the red arrow to end of the URL, at the second red arrow. And paste that URL into your browser.

Add a new client ID to Google Workspace

When you paste the URL into your browser you will come to this page. You just need to authorise by pressing the "Authorize" button.

You are now ready to retry the authorisation. Go back to your terminal and press Y. The scopes should all pass now.

You can either close your terminal and open it again, or run this command to get started right away.

alias gam="/home/paul/bin/gamadv-xtd3/gam"

Please make sure that you adapt it for your path.

Testing GAM on Ubuntu Linux

Now run this to test that you are connected to your domain.

gam info domain
GAMADV-XTD3 now runs on Ubuntu

Congratulations, you are ready to run GAMADV-XTD3!

(Optional) Additional things you can run.

There are some additional options that you can run.

Additional Options

gam config customer_id xxxx domain xxxx.com timezone local save verify

What is next?

Well done on completing this quick lesson on how to get GAM set up for your domain on Ubuntu. If you would like to understand the full capabilities of how to use GAM and GAMADV-XTD3 for your Google Workspace, check out this full course of over 9 hours and 50 pages of free resources!

Related Posts