반응형

 

왜 Ollama인가?

클라우드 vs 로컬 LLM 비교

기준 클라우드 (OpenAI, Claude) 로컬 (Ollama)
비용 사용량 기반 (토큰당 과금) 하드웨어 투자 후 무료
프라이버시 데이터가 외부로 전송됨 데이터가 로컬에 유지
지연시간 네트워크 왕복 시간 포함 로컬 처리 (더 빠를 수 있음)
커스터마이징 제한적 완전한 제어 (모델 수정 가능)
모델 선택 제공사 모델만 오픈소스 모델 자유롭게 사용
가용성 서비스 장애 시 중단 네트워크 독립적

로컬 LLM이 적합한 시나리오

다음 경우에 Ollama를 선택하세요:

  1. 민감한 데이터 처리
    • 의료·금융·법률 문서 분석
    • 사내 기밀 정보 처리
    • GDPR/HIPAA 등 규제 준수 필요
  2. 높은 사용량
    • 일일 수백만 토큰 이상 처리
    • API 비용이 부담스러운 경우
    • 배치 처리·실험 단계
  3. 오프라인 환경
    • 인터넷 접속 제한된 환경
    • 군사·정부 프로젝트
    • 현장 디바이스 (엣지 컴퓨팅)
  4. 커스터마이징 요구
    • 파인튜닝 모델 배포
    • 특수 프롬프트 템플릿 필요
    • 모델 병합·실험

다음 경우에는 클라우드 고려:

  • 초기 프로토타입 (빠른 검증 필요)
  • 최신 최고 성능 모델 필요 (GPT-4, Claude Opus 등)
  • 인프라 관리 리소스 부족
  • 소규모·간헐적 사용

설치 및 환경 설정

시스템 요구사항

최소 사양 (소형 모델용):

  • CPU: 4코어 이상
  • RAM: 8GB
  • 디스크: 10GB 여유 공간
  • OS: macOS, Linux, Windows (WSL2)

권장 사양 (중대형 모델용):

  • CPU: 8코어 이상 (또는 GPU)
  • RAM: 16GB+
  • GPU: NVIDIA (CUDA 지원) 또는 Apple Silicon
  • 디스크: 50GB+ SSD

macOS 설치

방법 1: Homebrew (권장)

# Homebrew 설치 (없는 경우)
/bin/bash -c "$(curl -fsSL https://raw.githubusercontent.com/Homebrew/install/HEAD/install.sh)"

# Ollama 설치
brew install ollama

# 설치 확인
ollama --version
# 출력: ollama version 0.1.x

방법 2: 공식 설치 스크립트

curl -fsSL https://ollama.com/install.sh | sh

# 서비스 자동 시작 (macOS)
brew services start ollama

Linux 설치 (Ubuntu/Debian)

# 공식 설치 스크립트
curl -fsSL https://ollama.com/install.sh | sh

# systemd 서비스로 자동 시작
sudo systemctl enable ollama
sudo systemctl start ollama

# 상태 확인
sudo systemctl status ollama

수동 설치 (바이너리):

# 최신 릴리스 다운로드
curl -L https://github.com/ollama/ollama/releases/latest/download/ollama-linux-amd64 -o ollama

# 실행 권한 부여
chmod +x ollama

# PATH에 추가
sudo mv ollama /usr/local/bin/

# 데몬 실행
ollama serve &

Windows 설치

WSL2 사용 (권장):

# PowerShell에서 WSL2 설치
wsl --install

# Ubuntu 재시작 후 WSL 터미널에서
curl -fsSL https://ollama.com/install.sh | sh

네이티브 Windows (실험적):

# Chocolatey로 설치
choco install ollama

# 또는 공식 Windows 인스톨러 다운로드
# https://ollama.com/download/windows

Docker 설치 (플랫폼 독립)

# CPU 전용
docker run -d -v ollama:/root/.ollama -p 11434:11434 --name ollama ollama/ollama

# NVIDIA GPU 지원
docker run -d --gpus=all -v ollama:/root/.ollama -p 11434:11434 --name ollama ollama/ollama

# 실행 확인
curl http://localhost:11434/api/version

설치 확인

# 1. 버전 확인
ollama --version

# 2. 서버 상태 확인
curl http://localhost:11434/api/tags

# 3. 테스트 모델 실행
ollama run llama3:8b

모델 관리 완전 가이드

인기 모델 카탈로그

모델 파라미터 크기 RAM 요구 속도 품질 주요 용도
llama3:8b 8B 4.7GB 8GB ★★★★☆ ★★★★☆ 범용 (추천 시작점)
llama3:70b 70B 40GB 64GB ★★☆☆☆ ★★★★★ 고품질 작업
mistral:7b 7B 4.1GB 6GB ★★★★★ ★★★☆☆ 빠른 응답 필요 시
mixtral:8x7b 47B 26GB 32GB ★★★☆☆ ★★★★★ 복잡한 추론
codellama:13b 13B 7.4GB 16GB ★★★☆☆ ★★★★☆ 코드 생성
phi-2 2.7B 1.7GB 4GB ★★★★★ ★★☆☆☆ 저사양 환경
gemma:7b 7B 5.0GB 8GB ★★★★☆ ★★★★☆ Google 모델

모델 다운로드

# 기본 다운로드 (최신 버전)
ollama pull llama3:8b

# 특정 양자화 버전 (메모리 절약)
ollama pull llama3:8b-q4_0      # 4-bit 양자화 (3.5GB)
ollama pull llama3:8b-q8_0      # 8-bit 양자화 (7.0GB)

# 여러 모델 동시 다운로드
ollama pull llama3:8b & \
ollama pull mistral:7b & \
ollama pull codellama:13b &
wait
echo "모든 모델 다운로드 완료"

모델 조회 및 삭제

# 로컬 모델 목록
ollama list

# 출력 예시:
# NAME              ID              SIZE      MODIFIED
# llama3:8b         a6f7e2f3c1d8    4.7GB     2 days ago
# mistral:7b        b8c9d0e1f2a3    4.1GB     1 week ago

# 모델 상세 정보
ollama show llama3:8b

# 모델 삭제
ollama rm mistral:7b

# 디스크 공간 확인
du -sh ~/.ollama/models
반응형

+ Recent posts