Unlock Productivity: Create a Full‑Featured AI Coding Workflow on Ubuntu with CC Switch and Ollama

This step‑by‑step guide shows how to install Ollama on Ubuntu, download DeepSeek‑Coder‑V2 or Qwen2.5‑Coder models, set up Claude Code, Codex, and Gemini CLI clients, configure the open‑source CC Switch proxy to route their requests to the local Ollama engine, and run a test prompt that generates Python code without any external API keys.

Ubuntu
Ubuntu
Ubuntu
Unlock Productivity: Create a Full‑Featured AI Coding Workflow on Ubuntu with CC Switch and Ollama

Step 1 – Foundation: Install Ollama and Prepare Models

Ollama serves as the local AI inference engine. Install it with the official one‑liner: curl -fsSL https://ollama.com/install.sh | sh Configure the systemd service so Ollama listens on all interfaces: sudo systemctl edit ollama.service In the editor add:

[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 programming‑oriented model. The guide recommends DeepSeek‑Coder‑V2 or Qwen2.5‑Coder (e.g., the 32B variant requiring ≥24 GB VRAM):

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

Step 2 – Tools: Install AI CLI Clients

Install the command‑line front‑ends that normally talk to cloud APIs. Ensure Node.js v18+ and npm are present.

Claude Code (Anthropic)

npm install -g @anthropic-ai/claude-code

Codex CLI (OpenAI compatible)

npm install -g @openai/codex

Gemini CLI (Google)

npm install -g gemini-chat-cli

Running these commands would normally prompt for an API key; the next step intercepts that traffic.

Step 3 – Hub: Install and Configure CC Switch

CC Switch (Claude Code Switch) is an open‑source proxy router that can rewrite requests from the above CLIs to any OpenAI‑compatible backend, such as Ollama.

Install CC Switch

npm install -g @songhe/cc-switch
# or download the Linux binary from GitHub Releases
# wget https://github.com/farion1231/cc-switch/releases/download/v3.10.0/CC-Switch-v3.10.0-linux-amd64.tar.gz

Add an Ollama configuration

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

During the interactive setup, provide:

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

Model: the name of the model you started, e.g.,

qwen2.5-coder:32b

Start the proxy

# Switch to the new profile
ccs switch local-ollama
# Launch proxy mode (required by some clients)
ccs proxy start

CC Switch now runs a background forwarding service and sets environment variables such as https_proxy, HTTP_PROXY, and CLAUDE_BASE_URL so the CLI tools connect to the local Ollama instance.

Final Test – Verify the Workflow

Run the Claude Code CLI: claude The prompt is processed locally; no login to Anthropic is needed. Example prompt: >> 帮我用 Python 写一个贪吃蛇游戏 Ollama performs the inference, and Claude Code returns the generated Python code within seconds.

Advanced Tips

Mixed profiles: Use ccs switch to toggle between a local DeepSeek profile and a cloud‑based Claude‑3.5 profile, keeping sensitive data local while delegating heavy reasoning to the cloud.

Hot model swapping: Change the model field in CC Switch configuration to instantly switch Claude CLI to DeepSeek or Llama backends.

Conclusion

By combining Ubuntu, Ollama, and CC Switch, you can enjoy the polished interfaces of major AI services while retaining full control over data 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 CodingOllamaLocal LLMUbuntuClaude 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.