5
1

Delete article

Deleted articles cannot be recovered.

Draft of this article would be also deleted.

Are you sure you want to delete this article?

UbuntuサーバーにSSHでログインしてGemini CLIをインストールする手順

Last updated at Posted at 2025-06-28

はじめに

リモートで動作させている開発環境にGemini CLIをインストールしてみようと思ったけれどなかなか苦労したので手順をまとめます。

ツールのインストール

sudo apt install -y nodejs npm

バージョン確認

node -v
v12.22.9

バージョン18以上が必要みたいなのでNGだから、最新版をインストール

sudo npm install n -g
sudo n lts

一度ログアウトして、

exit

再ログインしてバージョンを確認。

node -v
v22.17.0

npm -v
10.9.2

古いバージョンを削除

sudo apt purge -y nodejs npm
sudo apt autoremove -y

準備完了。

本体インストール

sudo npm install -g @google/gemini-cli

ユーザー認証

デバッグモードでGemini CLIを起動

gemini --debug

認証方法で「Login with Google」を選択して、以下の表示を確認

Code Assist login required.
Attempting to open authentication page in your browser.
Otherwise navigate to:

https://accounts.google.com/o/oauth2/v2/auth?xxxxxxxxxx
  • URLの部分をコピーして、手元のブラウザでアクセス
  • ページが遷移するので、遷移後のURLをコピー
  • 別のターミナルでGemini CLIをインストールしたリモートサーバーにログインして以下のコマンドを実行
curl -v "http://localhost:35123/oauth2callback?xxxxxxxxxx"

認証完了!

これでGemini CLIが使えるようになります!!

5
1
0

Register as a new user and use Qiita more conveniently

  1. You get articles that match your needs
  2. You can efficiently read back useful information
  3. You can use dark theme
What you can do with signing up
5
1

Delete article

Deleted articles cannot be recovered.

Draft of this article would be also deleted.

Are you sure you want to delete this article?