How To Install Gemini CLI on AlmaLinux 10

If you manage Linux servers or write code on the terminal every day, you already know how much time gets lost switching between your shell and a browser-based AI tool. Gemini CLI is Google’s open-source AI agent built specifically for the command line, and it closes that gap entirely. This guide shows you exactly how to install Gemini CLI on AlmaLinux 10 from scratch, covering every step from updating your system to running your first AI-powered prompt. By the end, you will have a fully working, authenticated Gemini CLI setup running on AlmaLinux 10 with no guesswork left on the table.
What Is Gemini CLI and Why Does It Matter?
Gemini CLI is a command-line interface that lets you interact with Google’s Gemini 2.5 Pro AI model directly from your terminal. It is fully open-source and available on GitHub under google-gemini/gemini-cli.
What separates it from other AI tools is what it can actually do inside your shell. Gemini CLI reads your local files and directories, writes and edits code, executes shell commands, and browses the web for context, all from a single terminal session.
The free tier gives you 60 requests per minute and 1,000 requests per day when you authenticate with a personal Google account. That is enough for serious day-to-day development work without spending a cent.
Gemini CLI runs on macOS, Windows, and Linux. This article focuses exclusively on the Gemini CLI on AlmaLinux 10 setup, covering both interactive sessions and headless server authentication.
Why AlmaLinux 10 Is the Right Platform for This
AlmaLinux 10, codenamed “Purple Lion,” is a free, production-ready Linux distribution that is binary-compatible with Red Hat Enterprise Linux 10. It is built for long-term stability, enterprise workloads, and modern developer toolchains.
AlmaLinux 10 ships with updated programming language runtimes, post-quantum cryptography support, and the CRB (Code Ready Builder) repository enabled by default. Those improvements make it a natural fit for modern AI development tools like Gemini CLI.
The runtime environment in AlmaLinux 10 fully supports Node.js 20 and above, which is the minimum version Gemini CLI requires to run. If you are running workloads on AlmaLinux 10 in production, adding Gemini CLI to your toolkit gives you an AI assistant that understands your codebase context without leaving the terminal.
Prerequisites
Before you begin, confirm you have the following in place:
- AlmaLinux 10 installed (bare metal, virtual machine, or cloud VPS)
- A user account with sudo privileges
- An active internet connection (npm downloads and Gemini API calls require network access)
- A Google account (a free Gmail account works) or a Gemini API key from Google AI Studio for headless servers
- Basic familiarity with terminal commands and navigating the Linux shell
- SSH access configured if working on a remote server
- Optional but useful: Git installed, for using Gemini CLI inside version-controlled projects
- Minimum 4 GB RAM (16 GB recommended for large codebases)
Step 1: Update Your AlmaLinux 10 System
Running a full system update before installing any new software is a habit every sysadmin should keep. It flushes out stale package metadata, applies pending security patches, and prevents dependency conflicts before they start.
AlmaLinux 10 uses the DNF package manager, inherited from RHEL 10. Run this command:
sudo dnf update -y
The -y flag automatically confirms all prompts so you do not need to sit and watch the terminal. DNF will refresh all repository metadata and apply any available updates.
If the update includes a new kernel, reboot the system before proceeding:
sudo reboot
After reboot, verify you are on AlmaLinux 10:
cat /etc/almalinux-release
Expected output:
AlmaLinux release 10.0 (Purple Lion)
Your system is now updated and ready for the next steps.
Step 2: Install Node.js 20+ on AlmaLinux 10
Node.js is the runtime that powers Gemini CLI. The tool requires Node.js version 20.0.0 or higher and will refuse to launch on anything older. AlmaLinux 10’s default AppStream module may offer an older Node.js stream, so adding the NodeSource repository directly is the most reliable method.
Install curl
curl is required to download the NodeSource setup script. Install it first:
sudo dnf install -y curl
Add the NodeSource Node.js 20.x Repository
curl -fsSL https://rpm.nodesource.com/setup_20.x | sudo bash -
This script registers the NodeSource RPM repository in /etc/yum.repos.d/ so that DNF can pull the correct Node.js version. The flags -fsSL tell curl to follow redirects silently and fail cleanly on errors.
Install Node.js
sudo dnf install -y nodejs
Verify Node.js and npm
node -v
npm -v
Expected output:
v20.19.4
10.8.2
If you manage multiple projects that need different Node.js versions, use NVM (Node Version Manager) instead. It installs Node.js in your home directory and avoids permission issues with npm globals.
Install NVM:
curl -o- https://raw.githubusercontent.com/nvm-sh/nvm/v0.39.7/install.sh | bash
Reload your shell:
source ~/.bashrc
Install and activate Node.js 20:
nvm install 20
nvm use 20
Verify:
node -v
Either method works. NVM is preferred on shared development systems where you need version flexibility.
Step 3: Install Gemini CLI Globally with npm
With Node.js in place, installing Gemini CLI takes a single command. The -g flag installs it globally, making the gemini command available from any directory on your system.
npm install -g @google/gemini-cli
npm fetches the @google/gemini-cli package from the npm registry and downloads all required dependencies. The process typically takes one to three minutes depending on your connection speed and server resources.
You will see output similar to:
added 312 packages in 2m
/usr/local/bin/gemini -> /usr/local/lib/node_modules/@google/gemini-cli/...
If you want to test Gemini CLI before committing to a global install, use npx instead:
npx @google/gemini-cli
This runs Gemini CLI without installing it permanently. It is a good way to preview the tool before adding it to your system.
Important: Avoid running sudo npm install -g unless you are using the system Node.js installation and fully understand the permission implications. If you installed Node.js via NVM, sudo is not needed and should not be used.
Step 4: Verify the Gemini CLI Installation
After installation, confirm that the gemini binary is accessible in your shell.
gemini --version
Expected output:
0.23.0
Check the full help menu to confirm all flags and subcommands loaded correctly:
gemini --help
This prints the complete list of options, including -p for non-interactive prompts, -s for sandbox mode, -y for YOLO mode, and --list-sessions for session management.
Fix: gemini: command not found
If the shell cannot find the gemini command, the npm global binary directory is not in your PATH. Find the correct path:
npm bin -g
This returns the directory where npm installs global binaries, such as /usr/local/bin or ~/.npm-global/bin. Add it to your PATH:
export PATH="$PATH:/path/from/output/above"
Make the fix permanent:
echo 'export PATH="$PATH:/usr/local/bin"' >> ~/.bashrc
source ~/.bashrc
Step 5: Authenticate Gemini CLI with Your Google Account
Option A: Google OAuth Login (Recommended for Workstations)
This is the fastest authentication method for developers working on a desktop or a server with browser access. It grants access to Gemini 2.5 Pro with a 1 million token context window, 60 requests per minute, and 1,000 requests per day at no cost.
Launch Gemini CLI:
gemini
On first run, the CLI displays a welcome screen and an authentication selection menu. Choose Login with Google from the menu.
Gemini CLI prints a URL in the terminal. Open that URL in any browser, even on a different device. Sign in with your Google account and grant the requested permissions. After authorization, the browser displays a confirmation message. Switch back to your terminal and Gemini CLI confirms authentication is complete.
Your authentication token is stored locally in ~/.gemini/. You will not need to log in again in future sessions.
Option B: API Key Authentication (Recommended for Headless Servers)
If you are managing a remote AlmaLinux 10 server over SSH with no browser available, API key authentication is the right choice. This method also works well for automated scripts and CI/CD pipelines.
Step 1: Visit Google AI Studio at aistudio.google.com, sign in, and click Create API Key. Copy the key.
Step 2: Set the environment variable for the current session:
export GEMINI_API_KEY="your_api_key_here"
Step 3: Make it persistent across future terminal sessions:
echo 'export GEMINI_API_KEY="your_api_key_here"' >> ~/.bashrc
source ~/.bashrc
Step 4: Launch Gemini CLI and select Use Gemini API key from the authentication menu:
gemini
Security reminder: Treat your API key exactly like a password. Never commit it to a public Git repository or paste it into a shared terminal session.
Step 6: Launch Gemini CLI and Run Your First Prompt
Configure Gemini CLI on AlmaLinux 10: First Session
Start an interactive session:
gemini
The Gemini CLI banner loads in your terminal, confirming a successful launch. Type your first prompt to test it:
What files are in this directory?
Gemini CLI reads your current working directory and describes the files it finds. This confirms that the tool is connected to your filesystem and the AI model is responding correctly.
Key slash commands to know right away:
/help— lists all available commands and their descriptions/settings— opens the configuration panel/theme— switches between UI color themes/clear— wipes the current conversation context without exiting/mcp— manages Model Context Protocol (MCP) server connections/exit— exits the session gracefully
Run a one-shot non-interactive prompt from the terminal without entering interactive mode:
gemini "summarize the README.md file in this project"
This is useful for scripting and automation where you need a single AI response without opening an interactive session.
Useful CLI Flags Reference
| Flag | What It Does |
|---|---|
gemini -v |
Show installed version |
gemini -p "prompt" |
Run a single prompt and exit |
gemini -i "prompt" |
Run a prompt then stay interactive |
gemini -m model_name |
Specify an alternate model |
gemini -y |
Auto-approve all tool actions (YOLO mode) |
gemini --debug |
Enable verbose debug logging |
gemini --sandbox |
Run in sandbox mode for added security isolation |
gemini --list-sessions |
View all saved previous sessions |
How to Update and Uninstall Gemini CLI
Updating Gemini CLI
Since Gemini CLI is a global npm package, updating it takes one command:
npm install -g @google/gemini-cli@latest
Check the installed version before and after to confirm the update worked:
gemini -v
To check if a newer version is available without updating yet:
npm outdated -g @google/gemini-cli
Keep Gemini CLI updated regularly. Google ships new model integrations, bug fixes, and security patches frequently.
Uninstalling Gemini CLI
Remove the global npm package:
npm uninstall -g @google/gemini-cli
Verify the removal:
gemini --version
This should return command not found. To also clean up stored authentication tokens and configuration files:
rm -rf ~/.gemini
If you added the GEMINI_API_KEY export line to ~/.bashrc, open the file and remove it:
nano ~/.bashrc
Deleting Gemini CLI does not remove Node.js or npm from your system.
Troubleshooting Common Issues
1. npm: command not found After Installing Node.js
Cause: The terminal session has not reloaded the updated PATH after Node.js installation.
Fix: Close and reopen the terminal, or reload your shell config:
source ~/.bashrc
If the error persists, reinstall Node.js:
sudo dnf install -y nodejs
2. gemini: command not found After Successful npm Install
Cause: npm’s global binary directory is not in the system PATH.
Fix:
npm bin -g
export PATH="$PATH:/output/from/above"
echo 'export PATH="$PATH:/usr/local/bin"' >> ~/.bashrc
source ~/.bashrc
3. EACCES: permission denied on npm install -g
Cause: npm’s global folder is owned by root, blocking writes from your regular user account.
Fix: Switch to NVM. NVM installs Node.js inside your home directory and removes the need for sudo on global npm installs entirely. Revisit Step 2 and install Node.js via NVM instead.
4. Browser Authentication URL Not Working on a Headless Server
Cause: There is no browser available on an SSH-only server.
Fix: Use API key authentication instead, as described in Step 5, Option B. Generate a key from Google AI Studio, set it as an environment variable, and select Use Gemini API key when Gemini CLI prompts you.
5. Error: Node.js version X is not supported
Cause: The installed Node.js version is below 20.0.0.
Fix: Remove the existing Node.js installation and reinstall using the NodeSource 20.x repository script from Step 2:
curl -fsSL https://rpm.nodesource.com/setup_20.x | sudo bash -
sudo dnf install -y nodejs
node -v
Confirm the output shows v20.x.x or higher before running the Gemini CLI install command again.
Congratulations! You have successfully installed Gemini CLI. Thanks for using this tutorial for installing the latest version of Gemini CLI on AlmaLinux OS 10 system. For additional help or useful information, we recommend you check the official Google Gemini website.