Home Set up ChatGPT locally using Ollama and open webui
Post
Cancel

Set up ChatGPT locally using Ollama and open webui

Set up ChatGPT Locally Using Ollama and Open Webui

Introduction

In this guide, we will set up ChatGPT locally using Ollama and open webui.

Install WSL2 and Ubuntu 20.04

  • Use this command to install WSL2 and Ubuntu 20.04
    1
    
    wsl --install
    

  • After installation, open Ubuntu 20.04 and set up your username and password.

  • Update and upgrade the system
    1
    
    sudo apt update && sudo apt upgrade -y
    

Install Ollama

  • Use this command to install Ollama
    1
    
    curl -fsSL https://ollama.com/install.sh | sh
    

    or visit Ollama and follow the instructions.

  • Now download the AI model from Ollama
  • Then run the following command to install the model
    1
    
    ollama install <model-name>
    

  • Now your AI model is installed and running. You can stop the model by running the following command
    1
    
    /bye
    

Installing Docker

  • Use this command to install Docker
1
2
3
4
5
6
7
8
9
10
11
sudo apt-get update
sudo apt-get install ca-certificates curl
sudo install -m 0755 -d /etc/apt/keyrings
sudo curl -fsSL https://download.docker.com/linux/ubuntu/gpg -o /etc/apt/keyrings/docker.asc
sudo chmod a+r /etc/apt/keyrings/docker.asc

echo \
  "deb [arch=$(dpkg --print-architecture) signed-by=/etc/apt/keyrings/docker.asc] https://download.docker.com/linux/ubuntu \
  $(. /etc/os-release && echo "$VERSION_CODENAME") stable" | \
  sudo tee /etc/apt/sources.list.d/docker.list > /dev/null
sudo apt-get update

  • Install Docker
    1
    
    sudo apt-get install docker-ce docker-ce-cli containerd.io docker-buildx-plugin docker-compose-plugin
    

  • or visit Docker and follow the instructions.

Install Open Webui

  • Use this command to install Open Webui
    1
    
    sudo docker run -d --network=host -v open-webui:/app/backend/data -e OLLAMA_BASE_URL=http://127.0.0.1:11434 --name open-webui --restart always ghcr.io/open-webui/open-webui:main
    

  • Now you can click on the settings icon and add the Ollama API URL

  • Now you can start chatting with your AI model by selecting the model and clicking on the chat icon

Additional Models Installation

  • You can click on the settings and click on the models tab
  • Then enter the model name and click on the install button

  • You can change the model by clicking on the top left corner and selecting the model

More Information

  • To stop the Open Webui container, use this command
    1
    
    sudo docker stop open-webui
    
  • To start the Open Webui container, use this command
    1
    
    sudo docker start open-webui
    
  • To remove the Open Webui container, use this command
    1
    
    sudo docker rm open-webui
    
  • To stop wsl2, use this command
    1
    
    wsl --shutdown
    
  • To uninstall Unbuntu, use this command
    1
    
    wsl --unregister Ubuntu
    
  • To uninstall WSL2, use this command
    1
    
    wsl --uninstall