After completing the steps in CUDA in WSL, you’re ready to install Ollama and run large language models directly in your WSL distro.
Installing Ollama in WSL
Ollama provides a simple installation script. Open your WSL terminal and run:
1
curl https://ollama.ai/install.sh | sh
This will download and install Ollama, setting up everything you need to get started.
Running Your First Model
To verify your installation, try running a lightweight model. Qwen3 is a great choice for quick testing:
1
ollama run qwen3:0.6b
Ollama will automatically download the model and start an interactive session. You can now chat with Qwen3 directly from your terminal.
Verifying GPU Usage in Ollama
To confirm that Ollama is utilizing your GPU (after a successful CUDA installation), run the following command in your WSL terminal:
1
ollama ps
This will display the status of running models and indicate whether the GPU is being used. If not, double-check your CUDA setup and ensure your WSL distro has access to the GPU.
Tips
Make sure your WSL distro has access to your GPU for best performance (see the CUDA setup post).
Running CUDA on native Linux is possible, but NVIDIA driver support can be inconsistent across distributions. Using CUDA in Windows Subsystem for Linux (WSL) offers a reliable alternative, providing direct driver support and a smoother experience for AI development.
Prerequisites
Windows 10/11 with WSL enabled
An NVIDIA GPU with driver support for CUDA
1. Install or Import a WSL Distro
If you don’t have WSL installed, run the following command in PowerShell as administrator:
1
wsl --install
If you want to use a fresh Ubuntu WSL image, download it from Ubuntu WSL Images and import it to a new folder:
Now, you can use CUDA commands without manually updating your PATH each session.
4. Verify Installation
Check if the CUDA compiler is installed:
1
nvcc --version
To verify your CUDA and driver versions:
1
nvidia-smi
Conclusion
With these steps, you should have a working CUDA environment in WSL, ready for AI and GPU-accelerated development. If you encounter issues, refer to the NVIDIA CUDA on WSL documentation for troubleshooting tips.
It has been a long while since the last time I update my blog. I guarantee that I don’t just waste my time on watching videos and playing video games lol.
Why another post on this topic?
There is a bunch of guides on the web about setting up Linux on Chromebook, Installing Steam and using PS4 Controller on Linux, but no single article covers these topics together. And it turns out a little tricky to get all the thing done right. Also, some of these journals are outdated so far. And this one should provide you enough information to configure all these stuff without a headache. I’ve done all these on Asus CBE-431, it should also work on other models.
Install Linux with Crouton
It is also possible to make a dual-boot Linux-ChromeOS on your device, but Crouton really provides a safe and efficient enough system to get things done. You can switch between two OS swiftly and the loss of performance is negligible.
To do this, you should first get into Developer Mode. This will wipe out all the local data on your device. Be sure to backup all the files you need before any further actions. And then follow these steps:
Turn off your laptop, using the combination of Esc, Refresh and Power buttons to reboot your Chromebook into Recovery Mode.
After seeing the Recovery Mode screen with the yellow exclamation, press Ctrl+D. And then press Enter to confirm entering Developer Mode. Wait a little while (about 10 minutes) until it return to the screen with the yellow exclamation. Leave it alone until it reboots into Chrome OS.
Some old models have a physical switch that you’ll have to flip in order to turn on Developer Mode. Check your instruction if you are not sure.
After login to the system, download the crouton script from here or click this to download the latest version.
Open a shell (Ctrl+Alt+T, type shell and hit enter), and run the following command:
1 2 3 4
sudo sh ~/Downloads/crouton -r trusty -t xfce # or add other targets if you like # sudo sh ~/Downloads/crouton -r trusty -t xfce,keyboard,audio,cli-extra
You can also change xfce to other desktops you want, for example unity which has a better look but requires more performance. And you can also add other targets such as keyboard,audio,cli-extra after xfce if you need.
Ubuntu 14.04 Trusty is used, because the default 12.04 Precise could cause some trouble while installing steam.
In the end of the installation, you will be asked the user and password for your linux system, choose anything you want. Remember the password, it will be used a lot later on.
Install Steam on Ubuntu
First login to ubuntu by entering enter-chroot in the shell and startxfce4 to start the xfce desktop (use other command for other desktops). Notice you can switch between Ubuntu and ChromeOS with Crtl+Alt+Shift+Left/Right(at the top of the keyboard) in any time.
And then, download the latest version of Steam for Linux from the Steam website. Start the terminal in linux, and install Ubuntu Software Center with the following command:
1 2
# You need to enter your password using sudo sudo apt-get install softeware-center
After that, find and click the Steam .deb package and install steam following the instructions. You should be able to login and launch Steam after this.
In-Home Streaming
Brismuth has a very good post on this topic. I just followed his steps. The ports used by Steam In-Home Streaming is by default blocked by ChromeOS. To unblock them, using the iptables command is the simplest way. First, install this command with sudo apt-get install iptables in the shell.
And then create a new alias command to unblock all the ports needed:
Restart the terminal, you will be able to unblock the network with steamStream command. And make sure your host device and your chromebook are on the same network. You should be able to stream from your PC to your chromebook right now.
Setup Sony Dualshock 4 Wireless Controller
I really like the PS4 controllers, you can now use them on almost every devices - your PS4, PC, Mac and Linux. To use them in Linux on Chromebook, I think the best way is to use the ds4drv package.
To install this package, we must first install all the dependencies:
And then install ds4drv by sudo pip install ds4drv.
After this, you can pair your controllers. First, turn on the bluetooth on your chromebook in chromeOS, and then switch back to Linux, entering sudo ds4drv in the terminal. Pair the controller by press the share button and PS button together, the light in front of the controller should start blinking, and turn bright blue after successfully paired.
You can also check how to pair multiple controllers and set the light on the controller on ds4drv website.
I’m having trouble with using the the PS4 controller in Big Picture Mode this way. I will update if I managed fix it.
Enjoy!
Every time you want to use this setup, you should
open up Ubuntu in the shell and start desktop
Unblock the ports with steamStream in the Linux terminal
Launch Steam on both chromebook and host machine
Make sure your bluetooth on the chromebook is enabled and pair the controller after sudo ds4drv commmand
It is unbelievable that some friends with their own VPS don’t know about SSH tunneling. This is a far more easy way to set up a proxy.
1
ssh -D port username@server
This command will open up a ssh tunneling service and listen to the local port. So you can just set proxy adress in your browser to localhost:port and everything is done!
If someone tries to use brew with sudo, a warning will show up:
1 2 3 4
Error: Cowardly refusing to `sudo brew [option]` You can use brew with sudo, but only if the brew executable is owned by root. However, this is both not recommended and completely unsupported so do so at your own risk.
Well, you may continue to run it after use sudo -i, but you will laterly have many problems. While brew is running under root, it will change the ownership of folders like /usr/local/include to root. And later if you want to run commands like brew link, you will fail:
1 2
Error: Could not symlink include/gdbm.h /usr/local/include is not writable.
To recover this, you must change the ownership back:
From time to time, I need to host some static files to do some local jobs. One possible solution is to set up the config file of the server engine (eg. apache, nginx). However, you need to restart the engine or reload the config file, and you may encounter really annoying some errors. Recently, I found node.js server function is quite useful in doing such things. You can easily set up servers on different ports and easily change the path. Here is the simple code:
//server.js var http = require('http'); var parse = require('url').parse; var join = require('path').join; var fs = require('fs');
var root = __dirname + '/public';
var server = http.createServer(function(req, res){ var url = parse(req.url); var path = join(root, url.pathname); var stream = fs.createReadStream(path); stream.on('error', function(err){ res.statusCode = 500; res.end('Internal Server Error'); }); stream.on('data', function(chunk){ res.write(chunk); }); stream.on('end', function(){ res.end(); }); });
server.listen(3000);
Just put your files in the \public folder and run node server.js. All things are done! You can check them out on localhost:3000. A more elegant way is to utilize the pipe() mechanism:
//server.js var http = require('http'); var parse = require('url').parse; var join = require('path').join; var fs = require('fs');
var root = __dirname + '/public';
var server = http.createServer(function(req, res){ var url = parse(req.url); var path = join(root, url.pathname); var stream = fs.createReadStream(path); stream.pipe(res); stream.on('error', function(err){ res.statusCode = 500; res.end('Internal Server Error'); }); });
Anki is a great flashcard tool for memorizing new words, and here how to convert the flashcard desk in anki to wordlists in pdf, epub and html. This procedure is done on Mac OSX 10.10, and probably work similarly on other Unix system.
Recently I’ve been working on GRE vocabulary, and Anki is a well-known multi-platform app for this. There are many great sets of cards and sometimes you just want to use them else where such as creating some wordlist. And this time, I need some wordlists from GRE3000, a popular book in China. I bought the printed version, but it is in alphabetical order. Luckily someone has made an Anki desk for it!
The vocabulary desks .apkg files are just .zip packages, you can just unzip it with command line:
1
unzip the_desk_name.apkg
There are several files there, what we need is the .anki2 file which is basically a sqlite database. Change the extension to sqlite and you can do anything with it! I just open it up with the Firefox extension - SQLite Manager.
Run the following SQL query to get the data we need, and then save it as csv(with or without header).
1
SELECT sfld, flds FROM notes
Then we need to set up the gitbook engine. Firstly, nodejs and npm is needed, following the guide on the website. And then install gitbook-cli and initialize a project.
1 2 3 4 5 6
npm install gitbook-cli -g cd your_workspace mkdir book cd book gitbook init cp list.csv .
And then, I wrote a ruby script to generate the markdown files needed to create the book.
for i in1..(words.length/list_size).ceil file = File.new('./src/List'+i.to_s+'.md', 'w') file.puts "#List#{i}" summary.puts "* [List#{i}](src/List#{i}.md) " #you might need to change this part to fit different desks for i in1..list_size file.puts "\n\n---\n\n"unless i == 1 content = words.shift() if content.nil? break end file.puts content[1] end file.close end
summary.close
Save this script and execute it at the folder. And don’t forget to write something in the README.md. Now you can use gitbook serve to see the web version of the book.
To make a file version, we need to download and install Calibre and use the ebook-convert tool inside. For Mac OSX, we need to add the tool to the $PATH.