This site is currently under migration. Some content may be incomplete.

I've attended a term-break workshop back in October titled "Ollama for Beginners: Running Open-Source LLMs Locally – By Dr. Anamika Chhabra". By this time, I'd been running Gemma 4 E2B locally, but I wasn't sure whether my laptop could handle local LLMs.

There were at least 200 students connected through Google Meet, from all over India. The workshop began with the installation of Ollama from the terminal, and the instructor asked who was using Linux systems. Roughly two-thirds of the participants were using Linux, and the instructor had been using Linux too.

I already knew that a lot of workstations run Linux, and macOS has a terminal that's quite similar to Linux. Mine was running Windows 11 Home, which came with the purchase of this laptop. It felt like a good time to rethink my setup. Here's what I've put together.

Windows Subsystem for Linux

No dual booting, separate Linux installation, or manually managed traditional virtual machine,

# run this on PowerShell
wsl --install

Now, you get an isolated Linux filesystem (ubuntu), a bash terminal that let's you run BASH command-line tools such as grep, sed, awk or other native Linux commands and a Linux kernel with WSL2.

Moved my workspace to ~/projects inside the Linux filesystem. All my projects now live there, except for a few that are Windows-native. Windows files are accessible directly from Ubuntu through /mnt/c/Users/<UserName>/.

For Code Editor, WSL extension let's you to use WSL as a full-featured development environment directly from VS Code. This is pretty much fun, though.

Bash

WSL2 can run Windows executables directly from Ubuntu. However, these are invoked through Windows interoperability. So, it makes sense to install tools such as Git, Python, Node.js, and their package managers inside WSL.

# Essential utilities
sudo apt install -y curl tree

# Version control
sudo apt install -y git gh

# Python package and project manager
curl -LsSf https://astral.sh/uv/install.sh | sh

# Node.js version manager
curl -o- https://raw.githubusercontent.com/nvm-sh/nvm/v0.40.3/install.sh | bash

# Install Node.js
nvm install 26.13.1

Most of my development work now happens directly inside WSL, so having these tools available from the bash terminal makes things much easier.

Claude Code, Codex and Ollama

Currently using Gemma 4 E4B as my daily driver for local inference. The context length is set to 4K by default, you can change this in Ollama's settings from the system tray. I'm currently experimenting with 64K. And also tool-calling fails at 4k, so you will need to increase it anyways.

Ollama is installed on Windows, WSL2 uses mirrored networking, allowing my Ubuntu environment to communicate with services running on Windows. Ollama was available on localhost:11434.

Yet, Both Claude Code and Codex can't access ollama though the localhost:11434, verified through

curl http://localhost:11434/api/tags

# curl: (7) Failed to connect to localhost port 11434 after 1 ms: Could not connect to server

Couldn't figure out why connection wasn't working through localhost, but connecting through the Windows host IP worked instead.

Claude Code and Codex now work, but the problem isn't over yet. I have to change their base URLs to use the Windows host IP, and these environment variables don't persist when WSL restarts.

# My Private IPv4 address: 172.24.160.1

export ANTHROPIC_BASE_URL="http://172.24.160.1:11434"
export CODEX_OSS_BASE_URL="http://172.24.160.1:11434/v1"

So I put them in a separate file called ollama.sh and added it to my .bashrc using source command. Now I don't have to worry about setting them manually every time.

Put Together

Getting all of this to work smoothly took a bit of trial and error, especially bridging Windows and WSL2.

Instead of leaving those fixes scattered around, I put my setup guides, dotfiles, and scripts like ollama.sh into a single GitHub repository: kishorkarthik/machine-setup. 

I personally like this, 'cause it works like a living changelog for my setup. Whenever I tweak a config, add a new script, or switch how I move files around, I just commit it to the repo instead of trying to remember what I changed months later.