• XSS.stack #1 – первый литературный журнал от юзеров форума

How-To set up Open WebUI (without Docker) on a VPS

qubit_matrix

floppy-диск
Пользователь
Регистрация
21.01.2025
Сообщения
5
Реакции
0
Hi,

first you will need a VPS, you can get one from anywhere. I would recommend at least 2 vCPU, 8 GB memory and a disk size of 80 GB.

You log into the server using ssh and start off by creating a user, let's say "servicesuser". Then you log into that user using "sudo su serviceuser".

You install miniconda:
Код:
wget https://repo.anaconda.com/miniconda/Miniconda3-latest-Linux-x86_64.sh
bash ~/Miniconda3-latest-Linux-x86_64.sh
source ~/.bashrc

Then you need to install nvm, node (>=18.13.0 <=22.x.x) and npm (>=6.0.0):
Код:
curl -o- https://raw.githubusercontent.com/nvm-sh/nvm/v0.39.2/install.sh | bash
source ~/.bashrc
nvm --version
nvm install 22
nvm use 22

After that you clone the Git repo:
Код:
git clone https://github.com/open-webui/open-webui
cd open-webui
npm run build
cd backend
conda create --name open-webui python=3.11
conda activate open-webui
pip install -r requirements.txt -U
chmod +x start.sh
./start.sh

In /etc/systemd/system/ you create a openwebui.service file:
Код:
[Unit]
Description=Open WebUI Service
After=network.target

[Service]
Type=simple
User=servicesuser
WorkingDirectory=/home/servicesuser/open-webui-with-payments/backend
ExecStart=/bin/bash -c "source /home/servicesuser/miniconda3/etc/profile.d/conda.sh && conda activate open-webui && ./start.sh"
Restart=always
RestartSec=5
Environment="PATH=/opt/conda/bin:/usr/local/sbin:/usr/local/bin:/usr/sbin:/usr/bin:/sbin:/bin"

[Install]
WantedBy=multi-user.target

You can use nano or any other editor that comes with Ubuntu.

To make the website available, you can use nginx and for https certbot.

Create a file /etc/nginx/sites-available/openwebui-config (replace yourdomainname.com with your actual domain):
Код:
server {
    server_name yourdomainname.com;

    location / {
        proxy_pass http://localhost: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;

    # Websocket upgrade
    proxy_http_version 1.1;
    proxy_set_header Upgrade $http_upgrade;
    proxy_set_header Connection "upgrade";
    }

    # Redirect HTTP to HTTPS
    #return 301 https://$host$request_uri;

    listen 443 ssl; # managed by Certbot
    ssl_certificate /etc/letsencrypt/live/yourdomainname.com/fullchain.pem; # managed by Certbot
    ssl_certificate_key /etc/letsencrypt/live/yourdomainname.com/privkey.pem; # managed by Certbot
    include /etc/letsencrypt/options-ssl-nginx.conf; # managed by Certbot
    ssl_dhparam /etc/letsencrypt/ssl-dhparams.pem; # managed by Certbot

}

server {
    if ($host = yourdomainname.com) {
        return 301 https://$host$request_uri;
    } # managed by Certbot


    listen 80;
    server_name yourdomainname.com;
    return 404; # managed by Certbot


}

Now before you start, make a copy of .env.example to .env and adjust your settings.

With service openwebui start you can start the service. Don't forget to use certbot to create the letsencrypt certificates.

As an endpoint, you can try https://openrouter.ai/

From there you can integrate payment processor into the existing Git repo. Hint: You can use groups to manage paid users.
 


Напишите ответ...
  • Вставить:
Прикрепить файлы
Верх