Unlock Full‑Stack AI Coding on Ubuntu with Ollama and CC Switch

This step‑by‑step guide shows how to replace cloud‑based AI coding tools with a private, zero‑cost workflow on Ubuntu by installing Ollama, configuring systemd, adding DeepSeek or Qwen2.5 models, installing Claude, Codex and Gemini CLIs, and routing them through CC Switch.

Ubuntu
Ubuntu
Ubuntu
Unlock Full‑Stack AI Coding on Ubuntu with Ollama and CC Switch

Many AI coding assistants such as Claude, Codex, and Gemini rely on cloud APIs, which introduce latency and privacy concerns. The article demonstrates how to replace these services with a fully local, free AI programming environment on Ubuntu using Ollama and CC Switch.

Step 1 – Install Ollama and prepare models

Install Ollama with the official script: curl -fsSL https://ollama.com/install.sh | sh Configure Ollama to listen on all interfaces by editing its systemd service and adding the environment variables:

[Service]
Environment="OLLAMA_HOST=0.0.0.0:11434"
Environment="OLLAMA_ORIGINS=*"

Reload and restart the service:

sudo systemctl daemon-reload
sudo systemctl restart ollama

Download and run a coding‑oriented model, e.g., Qwen2.5‑Coder 32B (requires ≥24 GB VRAM) or DeepSeek‑R1:

# Qwen2.5‑Coder 32B
ollama run qwen2.5-coder:32b
# or DeepSeek‑R1
ollama run deepseek-r1:14b

Step 2 – Install AI CLI clients

Install the command‑line interfaces that normally talk to remote APIs:

npm install -g @anthropic-ai/claude-code
npm install -g @openai/codex
npm install -g gemini-chat-cli

These commands would normally prompt for an API key; the next step will intercept the traffic.

Step 3 – Install and configure CC Switch

CC Switch (Claude Code Switch) is an open‑source proxy router. Install it via npm (or download the Linux binary): npm install -g @songhe/cc-switch Create a new provider configuration that points to the local Ollama service:

# Add a new profile named local-ollama
ccs new local-ollama

During the interactive setup, select:

Provider Type: OpenAI Compatible Base URL: http://localhost:11434/v1 API Key: ollama (placeholder)

Model: e.g., qwen2.5-coder:32b Activate the profile and start the proxy:

ccs switch local-ollama
ccs proxy start

CC Switch now forwards Claude, Codex, or Gemini requests to the local Ollama backend.

Final test – Run Claude locally

Execute the Claude CLI; it connects to the local Ollama instance without requiring an Anthropic account: claude Enter a prompt such as >> help me write a Snake game in Python. The Ollama engine performs the inference and the Claude CLI prints the generated code within seconds.

Advanced tips

Mix‑and‑match profiles: switch quickly between a local DeepSeek profile and a cloud‑based Claude‑3.5 profile for sensitive vs. heavy‑weight tasks.

Hot model switching: modify the model field in the CC Switch configuration to change the backend model on the fly.

By combining Ubuntu, Ollama, and CC Switch, developers obtain the interactive experience of commercial AI assistants while keeping all data on‑premise and eliminating costly API subscriptions.

Original Source

Signed-in readers can open the original source through BestHub's protected redirect.

Sign in to view source
Republication Notice

This article has been distilled and summarized from source material, then republished for learning and reference. If you believe it infringes your rights, please contactadmin@besthub.devand we will review it promptly.

AI CodingDeepSeekOllamaLocal LLMUbuntuQwen2.5Claude CodeCC Switch
Ubuntu
Written by

Ubuntu

Focused on Ubuntu/Linux tech sharing, offering the latest news, practical tools, beginner tutorials, and problem solutions. Connecting open-source enthusiasts to build a Linux learning community. Join our QQ group or channel for discussion!

0 followers
Reader feedback

How this landed with the community

Sign in to like

Rate this article

Was this worth your time?

Sign in to rate
Discussion

0 Comments

Thoughtful readers leave field notes, pushback, and hard-won operational detail here.