Step‑by‑Step Guide to Install Ollama and ShellGPT for Local LLM Use
This tutorial walks you through installing Ollama on Windows, configuring and running a local large language model, then setting up ShellGPT on Linux to communicate with Ollama, including configuration files, command examples, and REPL usage, while omitting unrelated promotional content.
Install Ollama (Windows)
Step 1: Download Ollama
Visit https://ollama.com/download to download the Windows installer.
Step 2: Search on Ollama website
Open the Ollama homepage to locate the desired model.
Step 3: Deploy in terminal
Install the model that matches your computer configuration.
ollama run gemma2:2b
Install ShellGPT on Linux
Step 1: Install ShellGPT
ShellGPT uses LiteLLM to communicate with the local Ollama backend. Install it with:
pip install shell-gpt --break-system-packagesStep 2: Edit .sgptrc configuration
Edit ~/.config/shell_gpt/.sgptrc and add options such as:
DEFAULT_MODEL=ollama/gemma2:9b
OPENAI_USE_FUNCTIONS=false
SHOW_FUNCTIONS_OUTPUT=false
API_BASE_URL=http://192.168.79.249:11434
# other settings omitted for brevityInitialize ShellGPT
Provide any string for the initial API key, then run:
sgptShellGPT functional tests
Example of asking “Who are you?”: sgpt "你是谁" ShellGPT replies as an AI assistant for programming and system management.
Example of generating a shell command: sgpt -s "查看当前目录" ShellGPT suggests using pwd and explains the reasoning.
Generate code example:
sgpt -c "写一个shell脚本,要求获取cpu核数线程,内存大小,磁盘大小,网络带宽"List chats, show chat info, start REPL:
sgpt --list-chats
sgpt --show-chat <chat_path>
sgpt --repl tempSigned-in readers can open the original source through BestHub's protected redirect.
This article has been distilled and summarized from source material, then republished for learning and reference. If you believe it infringes your rights, please contactand we will review it promptly.
How this landed with the community
Was this worth your time?
0 Comments
Thoughtful readers leave field notes, pushback, and hard-won operational detail here.
