- Notifications
You must be signed in to change notification settings - Fork0
Streamlined Ollama WebUI Setup: Automated Scripts, LLM Integration, and Desktop Shortcut Creation
License
Priyansusahoo/ollama-webUI
Folders and files
Name | Name | Last commit message | Last commit date | |
---|---|---|---|---|
Repository files navigation
Automated scripts to simplify the process of Ollama and its WebUI Launch in one click on Ubuntu 24.04.1 LTS (Gnome).
Setting up a Large Language Model (LLM) like
DeepSeek-r1
with 8 billion parameters, andCreating a
desktop entry
for easy access to the WebUI (Auto start ollama server and Validations)
⭐Star this repo if you find it useful! ⭐
$ curl -fsSL https://ollama.com/install.sh | sh$ sudo systemctl enable ollama$ sudo systemctl start ollama
Select an LLM of your choice fromhere.
For demonstration I will install DeepSeek-r1 8 billion parameters (4.9 GB):
$ ollama run deepseek-r1:8b
This will take some time, after successfully installing
>>> /bye
prerequisites (SNAP):
$ sudo apt update$ sudo apt install snapd
Ollama-WebUI:
$ sudo snap install ollama-webui --beta
Save this
ollama-launcher.sh
to ~/.scripts folder as mentioned$HOME/scripts/ollama-launcher.sh
$ cd$ mkdir -p ~/.scripts/$ cd scripts/$ touch ollama-launcher.sh$ vim ollama-launcher.sh
ollama-launcher.sh
:#!/bin/bash# Configuration OLLAMA_HOST="127.0.0.1:11434" OLLAMA_WEBUI_PORT=8080# Changed to match your actual web UI port# Check for required commandscheck_commands() {if!command -v ollama&> /dev/null;thenecho"Error: Ollama is not installed. Please install Ollama first."exit 1fiif!command -v ollama-webui&> /dev/null;thenecho"Error: ollama-webui command not found. Please install it first."exit 1fi }# Function to check/start Ollamastart_ollama() {if curl -s$OLLAMA_HOST>/dev/null;thenecho"✓ Ollama is already running"return 0fiecho"⚠️ Ollama is not running. Starting now..."# Try systemd service firstifcommand -v systemctl>/dev/null&& systemctl start ollama2>/dev/null;thenecho"✓ Ollama started via system service"elseecho"✓ Starting Ollama in background..." nohup ollama serve> /dev/null2>&1&fi# Wait for Ollama to become availableecho -n"⏳ Waiting for Ollama to start"local max_attempts=15for((i=1; i<=$max_attempts; i++));doif curl -s$OLLAMA_HOST>/dev/null;thenecho -e"\n✓ Ollama is ready!"return 0fiecho -n"." sleep 1doneecho -e"\n❌ Failed to start Ollama after$max_attempts attempts"exit 1 }# Function to handle port conflictshandle_port_conflict() {echo"🛑 Port$OLLAMA_WEBUI_PORT is already in use"# Find PID using the port pid=$(ss -tulpn| grep":$OLLAMA_WEBUI_PORT"| awk'{print $7}'| cut -d= -f2| cut -d, -f1)if [-n"$pid" ];thenecho"🔍 Found existing process (PID:$pid)"read -p"❓ Do you want to kill this process and continue? [y/N]" responseif [["$response"=~ ^[Yy]$ ]];thenkill -9$pidecho"✅ Killed process$pid"return 0elseecho"❎ Exiting script"exit 1fielseecho"⚠️ Port in use but no process found - check your system"exit 1fi }# Function to start web UIstart_webui() {if ss -tuln| grep -q":$OLLAMA_WEBUI_PORT";thenecho"✓ Web UI already running"return 0fiecho"🚀 Starting Ollama Web UI..."if! nohup ollama-webui --port$OLLAMA_WEBUI_PORT> /dev/null2>&1&then handle_port_conflict nohup ollama-webui --port$OLLAMA_WEBUI_PORT> /dev/null2>&1&fiecho -n"⏳ Waiting for Web UI"local max_attempts=10for((i=1; i<=$max_attempts; i++));doif ss -tuln| grep -q":$OLLAMA_WEBUI_PORT";thenecho -e"\n✓ Web UI is ready!"return 0fiecho -n"." sleep 1doneecho -e"\n❌ Failed to start Web UI after$max_attempts attempts"exit 1 }# Open browser functionopen_browser() {echo"🌐 Opening browser at http://localhost:$OLLAMA_WEBUI_PORT" xdg-open"http://localhost:$OLLAMA_WEBUI_PORT" }# Main script execution check_commands start_ollama start_webui open_browser
After copying the content to
ollama-launcher.sh
, give the required permissions$ chmod +x ollama-launcher.sh
Copy
ollama-WebUI-Create-desktop-entry.sh
and save it in ~/.scripts folder which we previously created in the User's HOME directory and give the required permissions$ cd$ cd scripts/$ touch ollama-WebUI-Create-desktop-entry.sh$ vim ollama-WebUI-Create-desktop-entry.sh
ollama-WebUI-Create-desktop-entry.sh
:#!/bin/bash# Create desktop entrycat>~/.local/share/applications/ollama-webui.desktop<<EOL[Desktop Entry]Version=1.0Name=Ollama WebUIComment=Launch Ollama Web InterfaceExec=/bin/bash -c "$HOME/scripts/ollama-launcher.sh"Icon=$HOME/.icons/ollama-webui.pngTerminal=falseType=ApplicationCategories=Utility;Application;Keywords=Ollama;AI;LLM;StartupNotify=trueEOL# Download specified iconmkdir -p~/.iconsif [!-f~/.icons/ollama-webui.png ];then wget https://raw.githubusercontent.com/Priyansusahoo/ollama-webUI/refs/heads/main/ollama-webUI.png -O~/.icons/ollama-webui.pngfi# Set permissionschmod +x~/.local/share/applications/ollama-webui.desktopupdate-desktop-database~/.local/share/applications/echo"Desktop entry created with custom icon!"echo"Look for 'Ollama WebUI' in your application menu."
Permission:
$ chmod +x ollama-WebUI-Create-desktop-entry.sh
Execute the Script:
$ ./ollama-WebUI-Create-desktop-entry.sh
After successfully executing the script check your app drawer and you will find the "Ollama WebUI" icon.