Available Commands: serve Start Ollama create Create a model show Show information for a model run Run a model stop Stop a running model pull Pull a model from a registry push Push a model to a registry signin Sign in to ollama.com signout Sign out from ollama.com list List models ps List running models cp Copy a model rm Remove a model launch Launch the Ollama menu or an integration help Help about any command
Flags: -h, --help help for ollama --nowordwrap Don't wrap words to the next line automatically --verbose Show timings for response -v, --version Show version information
Use "ollama [command] --help" for more information about a command.
설정 후 source ~/.bashrc와 sudo systemctl restart ollama를 잊지 마세요.
[ls 명령]
모델 목록 조회
1 2 3 4 5 6
$ ollama ls NAME ID SIZE MODIFIED gemma4:e2b 7fbdbf8f5e45 7.2 GB 3 days ago gemma4-e4b-32k:latest 6d2a1a196ef9 9.6 GB 4 weeks ago gemma4:e4b c6eb396dbd59 9.6 GB 4 weeks ago qwen2.5-coder:latest dae161e27b0e 4.7 GB 4 weeks ag
gemma4-e4b: 다운로드한 원래 모델
gemma4-e4b-32k: 모델의 파라미터를 수정한 Modelfile 에서 생성한 새 모델
브라우저로 11434 포트에 접속해 보면 ‘Ollama is running’ 을 확인 가능하다.
[ps 명령]
ps 명령은 실행중인 ollama 프로세스를 확인할 수 있다.
1 2 3
$ ollama ps NAME ID SIZE PROCESSOR CONTEXT UNTIL gemma4:e2b 7fbdbf8f5e45 7.7 GB 75%/25% CPU/GPU 4096 4 minutes from now
ollama 는 설치시 리눅스 계열에서는 systemd 로 설치된다. systemd 상태를 확인할 수 있다.
1 2 3 4 5 6 7
$ systemctl status ollama ● ollama.service - Ollama Service Loaded: loaded (/etc/systemd/system/ollama.service; enabled; preset: enabled) Active: active (running) since Fri 2026-05-29 22:02:07 KST; 9h ago Main PID: 165 (ollama) Tasks: 25 (limit: 28826)
[로그 확인]
로그 확인은 journalctl 를 사용한다.
1 2 3 4
journalctl -u ollama -f 5월 29 07:42:11 goyangi2 ollama[165]: time=2026-05-29T07:42:11.649+09:00 level=INFO source=server.go:1398 msg="waiting for server to become available" status="llm server loading model" 5월 29 07:42:19 goyangi2 ollama[165]: time=2026-05-29T07:42:19.188+09:00 level=INFO source=server.go:1402 msg="llama runner started in 69.72 seconds" 5월 29 07:42:19 goyangi2 ollama[165]: [GIN] 2026/05/29 - 07:42:19 | 200 | 1m10s | 127.0.0.1 | POST "/api/generate"
줄수 만큼 로그 기록 확인
1
journalctl -u ollama -n 100
[OpenAI API 호환 엔드포인트]
Ollama는 별도의 설정 없이도 OpenAI와 호환되는 API 엔드포인트를 기본적으로 제공합니다.
$ sudo systemctl show ollama --property=Environment
Modelfile 로 성능 조정
ollama 는 Modelfile 을 이용해 기존 모델의 파라미터를 조정해 새로운 모델로 서빙할 수 있다.
모델파일
Modelfile 은 텍스트 파일로 특정 모델의 파라미터, 프롬프를 조정해 새로운 모델로 생성할 수 있다.
모델은 FROM 구문에 지정한다. 1) ollma 에 등록된 모델을 사용하거나, 2) gguf 경로, 3) hf.co 의 URI 를 사용하면 된다.
1 2 3 4 5 6 7
$ ollama ls NAME ID SIZE MODIFIED qwen3-14b-han:latest bb1dc5fee044 9.0 GB 10 hours ago hf.co/unsloth/Qwen3-14B-GGUF:Q4_K_M 1c75fc1b9127 9.0 GB 10 hours ago gemma4-e4b-32k:latest 2bb4cc1b3660 9.6 GB 3 days ago my-default:latest 2bb4cc1b3660 9.6 GB 3 days ago gemma4:e4b c6eb396dbd59 9.6 GB 3 days ago
모델파일 작성
Modelfile 작성시 텍스트 파일에 FROM 구문으로 모델을 지정하고 팔라미터를 설정하면 된다.
다음은 ollama 모델에 할당한 num_ctx 토큰량 컨텍스트 크기를 직접 지정하는 예이다.
1 2
FROM qwen2.5-coder:7b # 모델 이름(ollama 다운로드) 혹은 모델의 위치 PARAMETER num_ctx 32768 # 컨텍스트 크기를 32768(32k)로 설정
[모델 생성]
새 파라미터로 모델을 생성
1
ollama create qwen-7b-32k -f Modelfile
새 모델 런치
1
ollama run qwen-7b-32k
모델 파일 파라미터
GPU 가속 최적화 (GPU Layers 설정)
Ollama는 기본적으로 GPU에 모델 레이어를 분배하지만, 때때로 VRAM 여유가 있음에도 일부를 CPU(RAM)에 남겨두는 경우가 있습니다. 모든 연산을 GPU에서 처리하도록 강제하면 속도가 비약적으로 향상됩니다.
gpu layers 는 모델 메타 정보에서 확인이 가능하다
1 2 3
FROM qwen2.5-coder:7b # -1은 가능한 모든 레이어를 GPU에 올리라는 뜻입니다. PARAMETER num_gpu -1
Context Window
ollma 모델은 **Context Window(문맥 창)**가 4096 으로 제한되는데 num_ctx 토큰량 컨텍스트 크기를 직접 지정한다.
1
PARAMETER num_ctx 32768 # 컨텍스트 크기를 32768(32k)로 설정
KV 캐시 양자화 (Flash Attention 및 메모리 절약)
32k와 같은 긴 컨텍스트를 사용할 때 가장 많은 메모리를 잡아먹는 것은 모델 자체보다 KV Cache(이전 대화를 기억하는 메모리)입니다. Ollama 최신 버전에서는 이를 압축하여 VRAM 부담을 줄일 수 있습니다.
템
1
PARAMETER temperature 1.0
무작위 토큰 선택을 제한하여 코드 일관성 유지
PARAMETER top_p 0.95 PARAMETER top_k 64
기존 모델의 파라미터 확인
다운 받은 모델의 세부 파라미터를 확인할 수 있다. 이 정보를 모델 파일로 리다이렉트해서 편집해 사용할 수 있다.
ollama show 로 모델의 파라미터를 확인하고 결과를 모델 파일로 리다이렉트하면 저장할 수 있다.
1
ollama show qwen3-14b-coding --modelfile > Modelfile