Tools: 로컬 LLM 셋업 가이드 (v48) (2026)

Tools: 로컬 LLM 셋업 가이드 (v48) (2026)

로컬 LLM 셋업 가이드 (v48)

1. 개요 및 사전 준비

사전 요구사항:

시스템 확인:

2. 프레임워크 비교

3. 권장 설정 설치 (llama.cpp + Ollama)

llama.cpp 설치:

Ollama 설치:

4. 모델 선택 가이드

코드 개발용 모델:

일반 목적 모델:

5. 양자화 유형 설명

양자화 예제:

6. API 설정 및 통합

로컬 API 서버 시작:

간단한 API 통신:

7. Systemd 서비스 설정

로컬 LLM 서비스 파일 생성:

서비스 시작:

8. 모니터링 및 성능 최적화

시스템 모니터링:

성능 최적화:

9. 실제 사용 예제

코드 생성 테스트:

API 연동 예제 (Python):

10. 성능 벤치마크

벤치마크 실행:

부록: 코드 품질 게이트 도구 개발 계획 로컬 LLM은 인터넷 연결 없이 AI 모델을 실행하여 코드 품질과 보안을 유지하는 데 필수적입니다. 이 가이드는 개발자들이 빠르고 효율적으로 로컬 LLM을 설정할 수 있도록 돕습니다. 이 가이드를 따라하면 개발자는 로컬 LLM을 쉽게 설정하고 관리할 수 있습니다. 모델 선택과 양자화 전략을 잘 조정하면 높은 성능과 효율성을 동시에 달성할 수 있습니다. 로컬 LLM 환경에서 다음과 같은 도구를 개발하여 실제 문제 해결: 이 도구는 개발자들이 AI 도구를 더 효과적으로 활용하면서 코드 품질을 유지할 수 있도록 지원합니다. 가이드 완료: v48 버전으로 실제 사용 가능한 로컬 LLM 환경 구축이 완료되었습니다. 📥 Get the full guide on Gumroad: https://gumroad.com/l/auto ($7) Templates let you quickly answer FAQs or store snippets for re-use. Hide child comments as well For further actions, you may consider blocking this person and/or reporting abuse

Command

Copy

# GPU 확인 nvidia-smi # RAM 확인 free -h # 디스크 공간 확인 df -h # GPU 확인 nvidia-smi # RAM 확인 free -h # 디스크 공간 확인 df -h # GPU 확인 nvidia-smi # RAM 확인 free -h # 디스크 공간 확인 df -h # 소스 코드 다운로드 -weight: 500;">git clone https://github.com/ggerganov/llama.cpp cd llama.cpp # 빌드 make clean make # 소스 코드 다운로드 -weight: 500;">git clone https://github.com/ggerganov/llama.cpp cd llama.cpp # 빌드 make clean make # 소스 코드 다운로드 -weight: 500;">git clone https://github.com/ggerganov/llama.cpp cd llama.cpp # 빌드 make clean make # Ollama 설치 스크립트 실행 -weight: 500;">curl -fsSL https://ollama.com/-weight: 500;">install.sh | sh # 서비스 시작 -weight: 600;">sudo -weight: 500;">systemctl -weight: 500;">start ollama -weight: 600;">sudo -weight: 500;">systemctl -weight: 500;">enable ollama # Ollama 설치 스크립트 실행 -weight: 500;">curl -fsSL https://ollama.com/-weight: 500;">install.sh | sh # 서비스 시작 -weight: 600;">sudo -weight: 500;">systemctl -weight: 500;">start ollama -weight: 600;">sudo -weight: 500;">systemctl -weight: 500;">enable ollama # Ollama 설치 스크립트 실행 -weight: 500;">curl -fsSL https://ollama.com/-weight: 500;">install.sh | sh # 서비스 시작 -weight: 600;">sudo -weight: 500;">systemctl -weight: 500;">start ollama -weight: 600;">sudo -weight: 500;">systemctl -weight: 500;">enable ollama # Ollama에서 모델 다운로드 ollama pull codellama:7b ollama pull llama3:8b # Ollama에서 모델 다운로드 ollama pull codellama:7b ollama pull llama3:8b # Ollama에서 모델 다운로드 ollama pull codellama:7b ollama pull llama3:8b # 모델을 Q4_K_M로 변환 ./convert-hf-to-ggml.py ./models/CodeLlama-7B/ --outtype q4_K_M # 모델을 Q4_K_M로 변환 ./convert-hf-to-ggml.py ./models/CodeLlama-7B/ --outtype q4_K_M # 모델을 Q4_K_M로 변환 ./convert-hf-to-ggml.py ./models/CodeLlama-7B/ --outtype q4_K_M # llama.cpp API 서버 시작 ./server -m ./models/CodeLlama-7B/ggml-model-q4_K_M.bin \ -c 2048 \ --port 8080 \ --host 0.0.0.0 # Ollama API 서버 시작 ollama serve # llama.cpp API 서버 시작 ./server -m ./models/CodeLlama-7B/ggml-model-q4_K_M.bin \ -c 2048 \ --port 8080 \ --host 0.0.0.0 # Ollama API 서버 시작 ollama serve # llama.cpp API 서버 시작 ./server -m ./models/CodeLlama-7B/ggml-model-q4_K_M.bin \ -c 2048 \ --port 8080 \ --host 0.0.0.0 # Ollama API 서버 시작 ollama serve # -weight: 500;">curl을 통한 테스트 -weight: 500;">curl http://localhost:8080/completion \ -H "Content-Type: application/json" \ -d '{ "prompt": "def fibonacci(n):", "n_predict": 100, "temperature": 0.2 }' # -weight: 500;">curl을 통한 테스트 -weight: 500;">curl http://localhost:8080/completion \ -H "Content-Type: application/json" \ -d '{ "prompt": "def fibonacci(n):", "n_predict": 100, "temperature": 0.2 }' # -weight: 500;">curl을 통한 테스트 -weight: 500;">curl http://localhost:8080/completion \ -H "Content-Type: application/json" \ -d '{ "prompt": "def fibonacci(n):", "n_predict": 100, "temperature": 0.2 }' -weight: 600;">sudo nano /etc/systemd/system/local-llm.-weight: 500;">service -weight: 600;">sudo nano /etc/systemd/system/local-llm.-weight: 500;">service -weight: 600;">sudo nano /etc/systemd/system/local-llm.-weight: 500;">service [Unit] Description=Local LLM Server After=network.target [Service] Type=simple User=developer WorkingDirectory=/home/developer/llama.cpp ExecStart=/home/developer/llama.cpp/server -m /home/developer/models/CodeLlama-7B/ggml-model-q4_K_M.bin -c 2048 --port 8080 Restart=always RestartSec=10 [Install] WantedBy=multi-user.target [Unit] Description=Local LLM Server After=network.target [Service] Type=simple User=developer WorkingDirectory=/home/developer/llama.cpp ExecStart=/home/developer/llama.cpp/server -m /home/developer/models/CodeLlama-7B/ggml-model-q4_K_M.bin -c 2048 --port 8080 Restart=always RestartSec=10 [Install] WantedBy=multi-user.target [Unit] Description=Local LLM Server After=network.target [Service] Type=simple User=developer WorkingDirectory=/home/developer/llama.cpp ExecStart=/home/developer/llama.cpp/server -m /home/developer/models/CodeLlama-7B/ggml-model-q4_K_M.bin -c 2048 --port 8080 Restart=always RestartSec=10 [Install] WantedBy=multi-user.target -weight: 600;">sudo -weight: 500;">systemctl daemon-reload -weight: 600;">sudo -weight: 500;">systemctl -weight: 500;">enable local-llm -weight: 600;">sudo -weight: 500;">systemctl -weight: 500;">start local-llm -weight: 600;">sudo -weight: 500;">systemctl -weight: 500;">status local-llm -weight: 600;">sudo -weight: 500;">systemctl daemon-reload -weight: 600;">sudo -weight: 500;">systemctl -weight: 500;">enable local-llm -weight: 600;">sudo -weight: 500;">systemctl -weight: 500;">start local-llm -weight: 600;">sudo -weight: 500;">systemctl -weight: 500;">status local-llm -weight: 600;">sudo -weight: 500;">systemctl daemon-reload -weight: 600;">sudo -weight: 500;">systemctl -weight: 500;">enable local-llm -weight: 600;">sudo -weight: 500;">systemctl -weight: 500;">start local-llm -weight: 600;">sudo -weight: 500;">systemctl -weight: 500;">status local-llm # GPU 사용량 모니터링 nvidia-smi -l 1 # CPU/메모리 사용량 htop # 로그 확인 journalctl -u local-llm -f # GPU 사용량 모니터링 nvidia-smi -l 1 # CPU/메모리 사용량 htop # 로그 확인 journalctl -u local-llm -f # GPU 사용량 모니터링 nvidia-smi -l 1 # CPU/메모리 사용량 htop # 로그 확인 journalctl -u local-llm -f # 메모리 최적화 옵션 ./server -m model.bin \ -c 2048 \ -n 128 \ --threads 8 \ --port 8080 # 메모리 최적화 옵션 ./server -m model.bin \ -c 2048 \ -n 128 \ --threads 8 \ --port 8080 # 메모리 최적화 옵션 ./server -m model.bin \ -c 2048 \ -n 128 \ --threads 8 \ --port 8080 -weight: 500;">curl -X POST http://localhost:8080/completion \ -H "Content-Type: application/json" \ -d '{ "prompt": "# Python 함수: 리스트에서 최대값 찾기\n\ndef find_max(numbers):", "n_predict": 50, "temperature": 0.1, "-weight: 500;">stop": ["\n\n"] }' -weight: 500;">curl -X POST http://localhost:8080/completion \ -H "Content-Type: application/json" \ -d '{ "prompt": "# Python 함수: 리스트에서 최대값 찾기\n\ndef find_max(numbers):", "n_predict": 50, "temperature": 0.1, "-weight: 500;">stop": ["\n\n"] }' -weight: 500;">curl -X POST http://localhost:8080/completion \ -H "Content-Type: application/json" \ -d '{ "prompt": "# Python 함수: 리스트에서 최대값 찾기\n\ndef find_max(numbers):", "n_predict": 50, "temperature": 0.1, "-weight: 500;">stop": ["\n\n"] }' import requests import json def query_llm(prompt): response = requests.post( 'http://localhost:8080/completion', json={ 'prompt': prompt, 'n_predict': 100, 'temperature': 0.2 } ) return response.json()['content'] # 사용 예시 result = query_llm("def quicksort(arr):") print(result) import requests import json def query_llm(prompt): response = requests.post( 'http://localhost:8080/completion', json={ 'prompt': prompt, 'n_predict': 100, 'temperature': 0.2 } ) return response.json()['content'] # 사용 예시 result = query_llm("def quicksort(arr):") print(result) import requests import json def query_llm(prompt): response = requests.post( 'http://localhost:8080/completion', json={ 'prompt': prompt, 'n_predict': 100, 'temperature': 0.2 } ) return response.json()['content'] # 사용 예시 result = query_llm("def quicksort(arr):") print(result) # llama.cpp 벤치마크 ./bench -m ./models/CodeLlama-7B/ggml-model-q4_K_M.bin -c 2048 --threads 8 # 성능 결과 예시: # Tokens/sec: 25.3 # Total time: 2.3s # llama.cpp 벤치마크 ./bench -m ./models/CodeLlama-7B/ggml-model-q4_K_M.bin -c 2048 --threads 8 # 성능 결과 예시: # Tokens/sec: 25.3 # Total time: 2.3s # llama.cpp 벤치마크 ./bench -m ./models/CodeLlama-7B/ggml-model-q4_K_M.bin -c 2048 --threads 8 # 성능 결과 예시: # Tokens/sec: 25.3 # Total time: 2.3s - Linux 시스템 (Ubuntu 20.04 이상 권장) - NVIDIA GPU (CUDA 지원) 또는 CPU - 최소 16GB RAM (추천 32GB 이상) - 최소 20GB 디스크 공간 - CodeLlama-7B: 7B 파라미터, 코드 생성 최적화 - StarCoder2-15B: 고성능, 다양한 언어 지원 - Phi-3-medium: 가볍고 빠른 코드 생성 - Llama3-8B: 균형 잡힌 성능 - Mistral-7B: 높은 품질 - IDE 플러그인: 실시간 코드 품질 검사 - CI/CD 통합: 자동화된 코드 리뷰 시스템 - 성능 모니터링: 코드 생성 성능 트래킹