Linux Installation

This guide covers how to set up Google Gemini on Linux distributions for DevOps automation and cloud infrastructure management.

Prerequisites

  • Python 3.9 or higher

  • pip (Python package manager)

  • A Google Cloud account with Gemini API access

  • Google Cloud CLI (optional, but recommended)

Installation Steps

1. Set Up Python Environment

It's recommended to use a virtual environment:

# Create a virtual environment
python -m venv gemini-env

# Activate the environment
source gemini-env/bin/activate

# Upgrade pip
pip install --upgrade pip

2. Install Google Gemini SDK

Install the official Python SDK:

For AI Studio integration:

3. Configure Authentication

There are two main methods for authentication:

Option A: API Key (Simplest)

  1. Visit Google AI Studio and create an API key

  2. Store the key securely in your environment:

To make this permanent, add to your .bashrc or .zshrc:

Option B: Service Account (For Production)

  1. Create a service account in Google Cloud Console

  2. Grant appropriate permissions (Vertex AI User or similar)

  3. Download the service account key JSON file

  4. Set the environment variable:

4. Verify Installation

Create a simple test script test_gemini.py:

Run the script:

Installing Additional Components

NotebookML

For NotebookML integration:

Gemini for CLI

For a command-line interface to Gemini:

Troubleshooting

Common Issues

  1. API Key Not Found: Ensure your environment variable is correctly set

  2. Library Conflicts: If you encounter dependency conflicts:

  3. Quota Exceeded: Check your quota usage in Google Cloud Console

  4. SSL Certificate Issues: Update certificates:

System Integration

For DevOps workflows, you can install the Gemini CLI:

This tool allows you to use Gemini directly in shell scripts and automation workflows.

Last updated