Install Ollama
|
1 |
curl -fsSL https://opencode.ai/install | bash |
You will need sudo, then
|
1 |
ollama serve |
To add Ollama as a startup service
|
1 2 |
sudo useradd -r -s /bin/false -U -m -d /usr/share/ollama ollama sudo usermod -a -G ollama $(whoami) |
Create a service file in /etc/systemd/system/ollama.service:
|
1 2 3 4 5 6 7 8 9 10 11 12 13 14 |
<span class="line">[Unit]</span> <span class="line">Description=Ollama Service</span> <span class="line">After=network-online.target</span> [Service] <span class="line">ExecStart=/usr/bin/ollama serve </span><span class="line">User=ollama</span> <span class="line">Group=ollama</span> <span class="line">Restart=always</span> <span class="line">RestartSec=3</span> <span class="line">Environment="PATH=$PATH" [Install] WantedBy=multi-user.target</span> |
Then start the service:
|
1 2 |
sudo systemctl daemon-reload sudo systemctl enable ollama |
Then add Qwen
|
1 |
ollama run hf.co/Jackrong/Qwen3.5-2B-Claude-4.6-Opus-Reasoning-Distilled-GGUF:Q4_K_M |
Ref [1]
Add Gemma
Ref [1]
Install OpenAI Codex
The cleanest is installing Node and global npm packages via nvm so no sudo or APT conflicts are involved.
Install Node.js using nvm (recommended)
Run once:
|
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 |
# Remove any existing APT Node/npm (optional but recommended) sudo apt purge -y nodejs npm sudo apt autoremove -y # Remove old npm custom prefix setup if it exists npm config delete prefix 2>/dev/null || true rm -f ~/.npmrc # Install nvm curl -o- [https://raw.githubusercontent.com/nvm-sh/nvm/v0.40.3/install.sh](https://raw.githubusercontent.com/nvm-sh/nvm/v0.40.3/install.sh) | bash source ~/.bashrc # Install Node (LTS) nvm install --lts nvm use --lts nvm alias default lts/* |
Verify installation:
|
1 2 3 4 |
node -v npm -v which node which npm |
Expected:
|
1 |
~/.nvm/versions/node/... |
Install global packages (no sudo required)
Now you can install global packages without sudo:
|
1 |
npm install -g @openai/codex |
Verify:
|
1 2 |
which codex codex --version |
Expected:
|
1 |
~/.nvm/versions/node/<version>/bin/codex |
Where packages are installed
With nvm, everything is installed inside your home directory:
|
1 |
~/.nvm/versions/node/<version>/lib/node_modules |
Executables are available automatically via PATH:
|
1 |
~/.nvm/versions/node/<version>/bin |
Important note if you previously used ~/.npm-global
If you previously configured npm like this:
|
1 |
npm config set prefix '~/.npm-global' |
that setup should be removed before using nvm, otherwise global installs may go to the wrong place and tools such as codex may fail to find node.
You can clean up old entries like this:
|
1 2 |
npm config delete prefix 2>/dev/null || true rm -f ~/.npmrc |
If you added ~/.npm-global/bin to your PATH in ~/.bashrc, remove that old line as well.
Why this is better
* No sudo needed
* No broken APT dependencies
* No conflict between Ubuntu and NodeSource packages
* No conflict with old ~/.npm-global prefix settings
* Clean, isolated environment per user
This works because nvm installs Node and npm entirely in your home directory, avoiding system-level package conflicts and permission issues.
OpenCode
Install:
|
1 |
curl -fsSL https://opencode.ai/install | bash |
Quick setup:
|
1 |
ollama launch opencode |
To configure without launching:
|
1 |
ollama launch opencode --config |
Add a configuration block to ~/.config/opencode/opencode.json: