Here is a comprehensive, summarized step-by-step guide for setting up your Open WebUI on an Ubuntu server, making it accessible online using your domain sayhi.us.

Summary

  1. Set up WSL and Ubuntu (if on Windows).
  2. Install Ollama and add a model.
  3. Monitor GPU performance (optional).
  4. Install Docker.
  5. Run Open WebUI Docker container.
  6. Install and configure Pyenv and Python.
  7. Install Stable Diffusion.
  8. Configure port forwarding on your router.4. Run on Phone and Computer
  9. Update DNS settings on GoDaddy.
  10. Set up Nginx as a reverse proxy (optional).
  11. Secure your site with SSL/TLS (optional).

Step-by-Step Guide

1. Set Up WSL and Ubuntu (If on Windows)

  1. Install WSL and Ubuntu:
   wsl --install
  1. Connect to a WSL Instance in a New Window:
   wsl -d Ubuntu

2. Install Ollama and Add a Model

  1. Download and Install Ollama:
    Visit Ollama’s Download Page and follow the instructions.
  2. Add a Model to Ollama:
   ollama pull llama2

3. Monitor GPU Performance (Optional)

  1. Install NVIDIA Tools:
   sudo apt-get install nvidia-driver-460 nvidia-cuda-toolkit
  1. Watch GPU Performance:
   watch -n 0.5 nvidia-smi

4. Install Docker

  1. Add Docker’s Official GPG Key and Repository:
   sudo apt-get update
   sudo apt-get install -y 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
  1. Install Docker:
   sudo apt-get install -y docker-ce docker-ce-cli containerd.io docker-buildx-plugin docker-compose-plugin

5. Run Open WebUI Docker Container

  1. Run the Container:
   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

6. Install and Configure Pyenv and Python

  1. Install Pyenv Prerequisites:
   sudo apt install -y make build-essential libssl-dev zlib1g-dev \
   libbz2-dev libreadline-dev libsqlite3-dev wget curl llvm libncurses5-dev \
   libncursesw5-dev xz-utils tk-dev libffi-dev liblzma-dev git
  1. Install Pyenv:
   curl https://pyenv.run | bash
  1. Configure Shell for Pyenv:
    Add the following lines to your shell configuration file (~/.bashrc for Bash):
   echo 'export PYENV_ROOT="$HOME/.pyenv"' >> ~/.bashrc
   echo 'export PATH="$PYENV_ROOT/bin:$PATH"' >> ~/.bashrc
   echo 'eval "$(pyenv init --path)"' >> ~/.bashrc
   echo 'eval "$(pyenv init -)"' >> ~/.bashrc
   echo 'eval "$(pyenv virtualenv-init -)"' >> ~/.bashrc
   source ~/.bashrc
  1. Install Python 3.10 with Pyenv:
   pyenv install 3.10.0
   pyenv global 3.10.0
  1. Verify Python Installation:
   python --version  # Should output Python 3.10.0

7. Install Stable Diffusion

  1. Download Stable Diffusion WebUI Script:
   wget -q https://raw.githubusercontent.com/AUTOMATIC1111/stable-diffusion-webui/master/webui.sh
  1. Make the Script Executable:
   chmod +x webui.sh
  1. Run the WebUI:
   ./webui.sh --listen --api

8. Configure Port Forwarding on Your Router

  1. Log into Your Router:
    Access your router’s web interface (usually http://192.168.0.1).
  2. Navigate to “Virtual Servers” and Add a New Rule:
  • Name: OpenWebUI
  • Interface: Default or as required
  • External Port: 8080
  • Internal Port: 8080
  • Internal Server IP: 192.168.0.173
  • Protocol: TCP
  • Status: Enable
  • Save/Apply the Rule

9. Update DNS Settings on GoDaddy

  1. Log into Your GoDaddy Account:
    Access the DNS management page for sayhi.us.
  2. Add/Edit the A Record:
  • Name: @
  • Value: 162.210.21.19 (your new static IP)
  • TTL: 600 seconds
  1. Add/Edit the CNAME Record (if needed):
  • Name: www
  • Value: sayhi.us
  • TTL: 1 Hour

10. Set Up Nginx as a Reverse Proxy (Optional but Recommended)

  1. Install Nginx:
   sudo apt-get update
   sudo apt-get install nginx
  1. Configure Nginx:
    Create a new configuration file for your domain:
   sudo nano /etc/nginx/sites-available/sayhi.us

Add the following content:

   server {
       listen 80;
       server_name sayhi.us www.sayhi.us;

       location / {
           proxy_pass http://192.168.0.173:8080;
           proxy_set_header Host $host;
           proxy_set_header X-Real-IP $remote_addr;
           proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for;
           proxy_set_header X-Forwarded-Proto $scheme;
       }
   }
  1. Enable the Configuration:
   sudo ln -s /etc/nginx/sites-available/sayhi.us /etc/nginx/sites-enabled/
   sudo nginx -t
   sudo systemctl restart nginx

11. Secure Your Site with SSL/TLS (Optional but Recommended)

  1. Install Certbot:
   sudo apt-get install certbot python3-certbot-nginx
  1. Obtain a Certificate:
   sudo certbot --nginx -d sayhi.us -d www.sayhi.us
  1. Follow the On-Screen Instructions: Certbot will automatically configure SSL for your Nginx server.
  2. Set Up Automatic Renewal:
   sudo certbot renew --dry-run

Final Testing and Verification

  1. Access Your Site:
    Try accessing your site using http://sayhi.us or http://www.sayhi.us to ensure the traffic is correctly routed to your internal server.
  2. Check for Errors:
    If there are issues, check the Nginx error logs:
   sudo tail -f /var/log/nginx/error.log

By following these steps, you will have your Open WebUI set up and accessible via your domain sayhi.us.