Pages

Friday, January 24, 2025

Windows Subsytem for Oracle Linux

Install latest NVIDIA Driver for GPU Support. 
Do not install any Linux display driver in WSL.

In Command Prompt as Administrator
C:\> cd \Windows\System32\lxss\lib
C:\> del libcuda.so libcuda.so.1
C:\> mklink libcuda.so libcuda.so.1.1
C:\> mklink libcuda.so.1 libcuda.so.1.1

PS C:\Users\nbitra> nvidia-smi

Ensure you have the latest WSL kernel.
PS C:\Users\user1> wsl --update

PS C:\Users\user1> wsl --version

Display a list of available distributions
PS C:\Users\user1> wsl --list --online
The following is a list of valid distributions that can be installed.
Install using 'wsl.exe --install <Distro>'.

NAME                            FRIENDLY NAME
Ubuntu                          Ubuntu
Debian                          Debian GNU/Linux
kali-linux                      Kali Linux Rolling
Ubuntu-18.04                    Ubuntu 18.04 LTS
Ubuntu-20.04                    Ubuntu 20.04 LTS
Ubuntu-22.04                    Ubuntu 22.04 LTS
Ubuntu-24.04                    Ubuntu 24.04 LTS
OracleLinux_7_9                 Oracle Linux 7.9
OracleLinux_8_7                 Oracle Linux 8.7
OracleLinux_9_1                 Oracle Linux 9.1
openSUSE-Leap-15.6              openSUSE Leap 15.6
SUSE-Linux-Enterprise-15-SP5    SUSE Linux Enterprise 15 SP5
SUSE-Linux-Enterprise-15-SP6    SUSE Linux Enterprise 15 SP6
openSUSE-Tumbleweed             openSUSE Tumbleweed

Increase swap space. Remove .txt extension.
C:\Users\user1> type .wslconfig
[wsl2]
memory=4GB
swap=16GB

Install a Windows Subsystem for Linux distribution.
PS C:\Users\user1> wsl --install -d OracleLinux_9_1
Installing: Oracle Linux 9.1
Oracle Linux 9.1 has been installed.
Launching Oracle Linux 9.1...
Installing, this may take a few minutes...
Please create a default UNIX user account. The username does not need to match your Windows username.
For more information visit: https://aka.ms/wslusers
Enter new UNIX username: user1
Changing password for user user1.
New password:
Retype new password:
passwd: all authentication tokens updated successfully.
Installation successful!

Update the packages and kernel

$ cat /etc/os-release
NAME="Oracle Linux Server"
VERSION="9.1"

Update packages
$ sudo dnf update -y

To disable Security-Enhanced Linux (SELinux) 
Change the line SELINUX=enforcing to SELINUX=disabled in /etc/selinux/config
$ sestatus
SELinux status:                 disabled

Enable systemd in /etc/wsl.conf
[boot]
systemd=true

$ free -m
               total        used        free      shared  buff/cache   available
Mem:            3920         456        3500           2         156        3464
Swap:          16384           0       16384

Show the status of Windows Subsystem for Linux
PS C:\> wsl --status
Default Distribution: OracleLinux_9_1
Default Version: 2

PS C:\> wsl -l -v
  NAME               STATE           VERSION
* OracleLinux_9_1    Running         2

Set the distribution as the default
PS C:\> wsl -s OracleLinux_9_1

Terminate the distribution
PS C:\Users\nbitra> wsl -t <distro>

Terminate the distribution and VM
PS C:\> wsl --shutdown -d OracleLinux_9_1
wsl --system -d OracleLinux_9_1wsl -l -v
  NAME               STATE           VERSION
* OracleLinux_9_1    Stopped         2

Launch the distribution
PS C:\> OracleLinux91

PS C:\Users\nbitra> wsl -l -v
  NAME               STATE           VERSION
* OracleLinux_9_1    Running         2

Get WSL Linux host IP to login via SSH
PS C:\> wsl -- ip addr s eth0 | findstr -i inet
Connect Linux host via SSH 
PS C:\> ssh Linux_User@Linux_IP

Uninstall the distribution and delete the root filesystem
PS C:\> wsl --unregister <distro>
Unregistering...

PS C:\> wsl -l -v
Windows Subsystem for Linux has no installed distributions.
Distributions can be installed by visiting the Microsoft Store:
https://aka.ms/wslstore

Sunday, January 12, 2025

Open WebUI

SQLite
---------
Install SQLite
$ wget https://www.sqlite.org/src/tarball/sqlite.tar.gz
$ tar zxvf sqlite.tar.gz
$ cd sqlite
$ ./configure --prefix=/usr/local
$ make
$ sudo make install
$ /usr/local/bin/sqlite3 --version

Chroma
----------
Install Chroma
$ python -m pip install chromadb
In .local/lib/python3.12/site-packages/chromadb/__init__.py, modify line 74
if IN_COLAB  or not is_client:
This will fix RuntimeError : Chroma requires sqlite3 >= 3.35.0 during open-webui start.

Unzip ffmpeg into .local/bin
$ wget https://github.com/ffbinaries/ffbinaries-prebuilt/releases/download/v6.1/ffmpeg-6.1-linux-64.zip
$ unzip ffmpeg-6.1-linux-64.zip -d .local/bin

Ollama
-----------
Download and Install Ollama
$ curl -fsSL https://ollama.com/install.sh | sh
The Ollama API is now available at http://127.0.0.1:11434

$ sudo systemctl status ollama
$ sudo systemctl start ollama

Open WebUI
-----------------
Install Open WebUI
$ python -m pip install open-webui

Launch the Server
$ open-webui serve &

To see the Web UI go to: http://127.0.0.1:8080

Upgrade locally installed packages
$ python -m pip install -U open-webui

Visit https://openwebui.com/u/haervwe to access the collection of tools.

Locate the desired tool or function on the hub page.
Click the "Get" button 
Open WebUI URL : http://127.0.0.1:8080
Import to WebUI.
Save the tool.

Admin Panel > Settings > Connections > Manage Ollama API Connections > Click on Configure icon
Edit Connection URL: http://localhost:11434
Save

Click on Manage icon 
Access model names for downloading, click here
Filter models
Copy the name and paste to pull a model from Ollama.com
deepseek-r1:1.5b
llama3.2:1b
gemma2:2b

Click on Models to see the downloaded models.

$ sudo systemctl stop ollama

Interactive Chat Commands
$ export OLLAMA_FLASH_ATTENTION=1
$ export OLLAMA_KV_CACHE_TYPE=f16|q8_0|q4_0
$ ollama serve
$ ollama pull llama3.2:1b
$ ollama run llama3.2:1b
$ ollama stop llama3.2:1b

Download GGUF model from huggingface.
$ ollama pull hf.co/city96/HunyuanVideo-gguf:latest