-
서버에 Open WebUI 올려서 서빙하기 / LLM 모델 사용하기DEV/nlp 2025. 3. 24. 18:22
Open WebUI Setting
📌 Conda Setting
- Conda 환경에 Open WebUI를 설정하기 위해 콘다 설치 및 실행
- Install : https://anaconda.org/anaconda/conda
# Install conda create -n open-webui python=3.11 # Conda Activate conda activate open-webui
📌 Install Open WebUI
# Conda 환경에서 진행 pip install open-webui
📌 (Option) Set Port
# 이미 서버에서 8080를 사용중이라 타 포트로 수정하여 서빙 # 하단 경로 파일의 serve 함수(def serve) 내 Port를 수정, defalut는 8080 >> /home/seokbong/anaconda3/envs/open-webui/lib/python3.11/site-packages/open_webui/__init__.py
📌 Open WebUI Start
# 서비스에 띄워서 계속 사용할 예정이라면 하단의 Service Setting으로 넘어갈 것. open-webui serve
📌 CUDA Install
# 드라이버 리스트 ubuntu-drivers devices # 최신 드라이버 자동 Install sudo ubuntu-drivers autoinstall # 패키지 업데이트 sudo apt update sudo apt upgrade -y # CUDA 개발 환경 설치 sudo apt install nvidia-cuda-toolkit # 시스템 재부팅 sudo reboot
📌 Service Setting
# 서비스 작성 sudo vi /etc/systemd/system/open-webui.service # 하단 내용을 open-webui.service에 작성 # * user, group, execstart은 본인 환경에 맞춰서 수정 [Unit] Description=Open-WebUI Service After=network.target [Service] Type=simple User=seokbong Group=seokbong WorkingDirectory=/home/seokbong ExecStart=/bin/bash -l -c "source /home/seokbong/anaconda3/etc/profile.d/conda.sh && conda activate open-webui && open-webui serve" Restart=always RestartSec=5 [Install] WantedBy=multi-user.target # 저장 (esc > :q) # deamon reload sudo systemctl daemon-reload # open-webui service restart sudo systemctl restart open-webui # service status 확인 sudo systemctl status open-webui # 별첨 # service 정지, 실행 명령어는... sudo systemctl stop open-webui.service sudo systemctl start open-webui.service
📌 (Option) Nginx 설정
# NginX 설정 예시 server { server_name seokbong.tplinkdns.com; listen 443 ssl; ssl_certificate /etc/letsencrypt/live/...pem; ssl_certificate_key /etc/letsencrypt/live/...pem; include /etc/letsencrypt/options-ssl-nginx.conf; ssl_dhparam /etc/letsencrypt/ssl-dhparams.pem; location / { proxy_pass http://127.0.0.1:5001; add_header Access-Control-Allow-Origin *; add_header Access-Control-Allow-Methods *; add_header Access-Control-Allow-Headers *; proxy_set_header Upgrade $http_upgrade; proxy_set_header Connection "Upgrade"; 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; proxy_http_version 1.1; } # 기타 Path ... }
📌 Ollama Install
- 로컬에서 모델을 Install하여 구동하기 위해서는 Ollama 설정 및 모델 다운로드가 필요.
- https://github.com/ollama/ollama
📌 Ollama Model Install
- Ollama 모델 설치 예시 (Gemma3, 12b)
- https://ollama.com/library/gemma3:12b
# Run 하면 자동으로 설치함 ollama run gemma3:12b
📌 Ollama 기본 명령어
- Llama 2 모델 다운로드: ollama pull llama2
- Llama 2 모델 실행 및 질문: ollama run llama2
- 모델 실행 후 터미널에 "안녕하세요" 입력 후 Enter
- 모델이 "안녕하세요! 무엇을 도와드릴까요?" 와 같은 답변 생성
- 다운로드된 모델 목록 확인: ollama list
- Llama 2 모델 삭제: ollama delete llama2
'DEV > nlp' 카테고리의 다른 글
Openmanus + Ollama 내장 모델 사용하기. (0) 2025.03.26 Ollama python 모델 실행하기. (0) 2024.10.28 Mac OS / Windows Ollama로 eeve 모델 설치하여 사용하기 (2) 2024.09.25 NLP 자연어 처리 정리 1 (0) 2024.08.22 LLaMA2 Meta의 LLM... (1) 2024.04.18