openSUSE Leap 16

Ollama インストール2025/12/08

 

LLM をローカル環境で実行可能な Ollama をインストールします。

GPU なしのコンピューターでもそれなりの速度で動作します。

[1] Ollama をインストールします。
dlp:~ #
wget https://ollama.ai/install.sh

dlp:~ #
sh ./install.sh

>>> Installing ollama to /usr/local
>>> Downloading Linux amd64 bundle
######################################################## 100.0%
>>> Creating ollama user...
>>> Adding ollama user to render group...
>>> Adding ollama user to video group...
>>> Adding current user to ollama group...
>>> Creating ollama systemd service...
>>> Enabling and starting ollama service...
Created symlink '/etc/systemd/system/default.target.wants/ollama.service' → '/etc/systemd/system/ollama.service'.
>>> The Ollama API is now available at 127.0.0.1:11434.
>>> Install complete. Run "ollama" from the command line.
WARNING: No NVIDIA/AMD GPU detected. Ollama will run in CPU-only mode.

# ollama サービスが起動

dlp:~ #
systemctl status ollama

● ollama.service - Ollama Service
     Loaded: loaded (/etc/systemd/system/ollama.service; enabled; preset: disabled)
     Active: active (running) since Mon 2025-12-08 09:25:55 JST; 1min 27s ago
 Invocation: 5e48498751d544b99bc2f6c99cbcd0de
   Main PID: 1524 (ollama)
      Tasks: 12 (limit: 19151)
        CPU: 70ms
     CGroup: /system.slice/ollama.service
.....
.....

# ローカルホストのポート 11434 をリスン

dlp:~ #
ss -napt | grep ollama

LISTEN 0      4096       127.0.0.1:11434      0.0.0.0:*    users:(("ollama",pid=2007,fd=3))
[2] 他ホストから直接アクセスしたい場合は、リスンする範囲を変更できます。
dlp:~ #
systemctl edit ollama.service
# OLLAMA_HOST を追記
# 全てリスンする場合は [0.0.0.0] を指定
# インターナルネットワークをリスンする場合はその IP アドレスを指定

[Service]
Environment="OLLAMA_HOST=0.0.0.0"

dlp:~ #
systemctl restart ollama.service
dlp:~ #
ss -napt | grep ollama

LISTEN 0      4096               *:11434            *:*    users:(("ollama",pid=2073,fd=3))
[3] Ollama を使用するには、まずモデルをダウンロードします。
# 例として Llama3 の 8B モデルをダウンロード

dlp:~ #
ollama pull llama3:8b

pulling manifest
pulling 6a0746a1ec1a: 100% 4.7 GB
pulling 4fa551d4f938: 100%  12 KB
pulling 8ab4849b038c: 100%  254 B
pulling 577073ffcc6c: 100%  110 B
pulling 3f8eb4da87fa: 100%  485 B
verifying sha256 digest
writing manifest
success

# 例として Microsoft の Phi4 モデルをダウンロード

dlp:~ #
ollama pull phi4

pulling manifest
pulling fd7b6731c33c: 100% 9.1 GB
pulling 32695b892af8: 100%  275 B
pulling fa8235e5b48f: 100% 1.1 KB
pulling 45a1c652dddc: 100%   82 B
pulling f5d6f49c6477: 100%  486 B
verifying sha256 digest
writing manifest
success

# 例として Google の Gemma モデルをダウンロード

dlp:~ #
ollama pull gemma3:4b

pulling manifest
pulling aeda25e63ebd: 100% 3.3 GB
pulling e0a42594d802: 100%  358 B
pulling dd084c7d92a3: 100% 8.4 KB
pulling 3116c5225075: 100%   77 B
pulling b6ae5839783f: 100%  489 B
verifying sha256 digest
writing manifest
success

# 例として IBM の Granite モデルをダウンロード

root@dlp:~#
ollama pull granite4:3b

pulling manifest
pulling 6c02683809a8: 100% 2.1 GB
pulling 0f6ec9740c76: 100% 7.1 KB
pulling cfc7749b96f6: 100%  11 KB
pulling ba32b08db168: 100%  417 B
verifying sha256 digest 
writing manifest
success
[4] Ollama の使用方法です。
dlp:~ #
ollama run llama3:8b

>>> Send a message (/? for help)
>>> Who are you?
I am LLaMA, an AI assistant developed by Meta AI that can understand and respond to human input in a conversational
manner. I'm not a human, but rather a computer program designed to simulate conversation and answer questions to the best
of my ability based on the knowledge and information I've been trained on.

My training data includes a massive corpus of text from various sources, including books, articles, and online content.
This allows me to understand and respond to natural language inputs, like this chat. I can generate human-like responses,
but I don't have personal experiences or emotions like humans do.

I'm constantly learning and improving my abilities through machine learning algorithms and fine-tuning from the
interactions I have with users like you. So, feel free to ask me anything, and I'll do my best to provide helpful and
informative responses!

>>> What are you good at?
I'm designed to be a conversational AI, so I'm good at:

1. **Answering questions**: I can process natural language queries and provide relevant answers based on my training data.
2. **Generating text**: I can create human-like text responses to prompts or topics, making me useful for tasks like
writing, proofreading, or summarizing content.
3. **Conversing**: I'm great at engaging in conversations, using context and understanding nuances of language to respond
appropriately.
4. **Providing definitions**: If you're unsure about the meaning of a word or phrase, I can define it for you.
5. **Offering suggestions**: Need ideas or recommendations? I can generate options based on my knowledge and understanding
of different topics.
6. **Translating languages**: While not a professional translator, I can provide basic translations between common
languages like English, Spanish, French, German, Italian, Chinese, Japanese, Korean, and many more.
7. **Summarizing content**: If you have a long piece of text or article, I can summarize the main points for you.
8. **Generating creative writing**: I can assist with generating ideas, prompts, or even entire stories across various
genres like fiction, poetry, or scriptwriting.

Keep in mind that my abilities are limited to the scope of my training data, and while I strive to be accurate and
helpful, I'm not perfect. If you have a specific task or question, feel free to ask me, and I'll do my best to assist you!

exit する場合は [/bye] と入力
>>> /bye

dlp:~ #
ollama run phi4

>>> Who are you?
I am Phi, a language model developed by Microsoft. I'm designed to assist with answering questions, providing information,
and offering guidance on a wide range of topics. My goal is to help users find the information they need in a clear and
helpful manner while ensuring user privacy and security. If you have any specific questions or need assistance, feel free
to ask!

>>> What are you good at?
I am Phi, a language model developed by Microsoft. I'm designed to assist with answering questions, providing information,
and offering guidance on a wide range of topics. My goal is to help users find the information they need in a clear and
helpful manner while ensuring user privacy and security. If you have any specific questions or need assistance, feel free
to ask!

>>> What are you good at?
I'm designed to assist with a variety of tasks, particularly involving text-based interactions. Here are some areas where
I excel:

1. **Providing Information**: Offering clear and concise explanations on topics ranging from science and technology to
history and culture.

2. **Answering Questions**: Responding to general knowledge queries, helping clarify concepts or ideas.

3. **Guidance and Suggestions**: Helping with decision-making processes by providing pros and cons or suggesting potential
approaches to a problem.

4. **Language Assistance**: Assisting with grammar, writing tips, and language learning.

5. **Problem Solving**: Offering step-by-step solutions for mathematical problems or logical puzzles within my
capabilities.

6. **Summarizing Content**: Condensing articles, reports, or lengthy texts into shorter summaries while retaining the main
points.

7. **Creative Assistance**: Helping with brainstorming ideas or providing prompts for creative writing and projects.

8. **Educational Support**: Aiding in understanding complex subjects by breaking them down into simpler terms.

I'm here to help as best I can, but it's important to remember that my abilities are based on the data available up to
October 2023, so some very recent developments might not be covered. If you have a specific task or question in mind, feel
free to ask!

>>> /bye

dlp:~ #
ollama run gemma3:4b

>>> Who are you?
I'm Gemma, a large language model created by the Gemma team at Google DeepMind. I am an open-weights model, meaning I'm
widely available for public use!

I can take text and images as inputs and generate text-based responses.

You can learn more about me and my capabilities on the Gemma website:
[https://ai.google.dev/gemma](https://ai.google.dev/gemma)

I'm still under development, but I'm always learning new things!

>>> What are you good at?
Okay, let’s talk about what I’m good at! I’ve been trained on a massive amount of text and image data, which allows me to
do a *lot* of things. Here’s a breakdown of my strengths:

**1. Text Generation & Creative Tasks:**

*   **Writing:** I can generate different kinds of creative text formats – poems, code, scripts, musical pieces, email,
letters, etc. I’ll try my best to fulfill all your requirements.
*   **Answering Questions:** I can answer your questions in a comprehensive and informative way, even if they are open
ended, challenging, or strange.
*   **Summarization:** I can condense long pieces of text into shorter, more digestible summaries.
*   **Translation:** I can translate languages.
*   **Brainstorming:** I can help you come up with ideas for projects, stories, or anything else.

**2. Understanding & Analyzing Text:**

*   **Sentiment Analysis:** I can detect the emotional tone of a piece of text.
*   **Topic Extraction:** I can identify the key themes and topics within a text.
*   **Text Completion:** If you give me a starting phrase or sentence, I can continue writing it.

**3. Image-Related Tasks (Because I can process images too!)**

*   **Image Captioning:**  I can describe what’s happening in an image.
*   **Answering Questions about Images:** You can show me an image and ask me questions about it (e.g., "What objects do
you see?" or "Describe the scene.").


**Important Note:** I’m still under development, and my abilities are constantly improving. I don’t have access to
real-time information or the internet. My knowledge cutoff is generally sometime in 2023.

**To help me show you what I can do best, could you give me a specific task or question you have in mind?**  For example,
you could ask me:

*   “Write a short poem about a rainy day.”
*   “Summarize the plot of Romeo and Juliet.”
*   “Describe the image of a cat sitting on a window sill.” (If you were to provide an image, of course!)

>>> /bye
[5] Ollama を API 経由でも利用できます。
dlp:~ # curl http://localhost:11434/api/chat -d '{
  "model": "gemma3:4b",
  "stream": false,
  "messages": [
    { "role": "user", "content": "What is the date today?" }
  ]
}'
{"model":"gemma3:4b","created_at":"2025-12-08T00:51:08.212428043Z","message":{"role":"assistant","content":"Today is November 3, 2023.  \n\nI hope you have a great day!"},"done":true,"done_reason":"stop","total_duration":2623699108,"load_duration":232568008,"prompt_eval_count":15,"prompt_eval_duration":252994039,"eval_count":24,"eval_duration":2111327409}
# * 間違った回答

dlp:~ # curl http://dlp.srv.world:11434/api/chat -d '{
  "model": "phi4",
  "stream": false,
  "messages": [
    { "role": "user", "content": "Tell me the recommended sightseeing spots in Hiroshima, Japan." }
  ]
}'
{"model":"phi4","created_at":"2025-12-08T00:53:25.777811006Z","message":{"role":"assistant","content":"Hiroshima is a city rich in history and culture, offering a variety of fascinating sights to explore. Here are some recommended spots:\n\n1. **Peace Memorial Park**: This park is dedicated to the memory of those who lost their lives in the atomic bombing. Key attractions include:\n   - The Hiroshima Peace Memorial Museum: Learn about the impact of nuclear weapons.\n   - The Atomic Bomb Dome (Genbaku Dome): A UNESCO World Heritage site and a symbol of peace.\n\n2. **Hiroshima Castle**: Known for its beautiful gardens, the castle offers panoramic views of the city from its five-story main keep.\n\n3. **Shukkeien Garden**: One of Hiroshima’s oldest gardens, it features traditional Japanese landscaping with ponds, bridges, and waterfalls.\n\n4. **Itsukushima Shrine**: Located on Miyajima Island, about a 30-minute ferry ride from Hiroshima, this iconic Shinto shrine is famous for its \"floating\" torii gate.\n\n5. **Morioka Garden**: A beautiful stroll garden located within the grounds of Shukkeien, offering serene landscapes and seasonal blooms.\n\n6. **Hiroshima City Museum of Contemporary Art (HCMCA)**: Known as “The Eye,” this museum features modern art exhibitions in a striking architectural setting.\n\n7. **Nagarekawa Shopping Street**: A vibrant area with shops, restaurants, and street performers, perfect for experiencing local culture.\n\n8. **Hiroshima Prefectural Industrial Promotion Hall (Misono)**: Known as the \"Genbaku Yashiki\" or Atomic Bomb House, this structure survived the bombing and is now a museum.\n\n9. **Okunoshima Island**: Often called “Rabbit Island,” it’s famous for its large population of friendly wild rabbits.\n\n10. **Hiroshima Station Building**: A modern architectural marvel with shops and restaurants offering views of the surrounding cityscape.\n\nThese spots offer a mix of history, culture, nature, and modern attractions that together provide a well-rounded experience of Hiroshima."},"done":true,"done_reason":"stop","total_duration":92178084446,"load_duration":67662684,"prompt_eval_count":23,"prompt_eval_duration":2982159448,"eval_count":416,"eval_duration":88767367929}
関連コンテンツ