{"id":15277,"date":"2024-05-10T19:47:00","date_gmt":"2024-05-10T17:47:00","guid":{"rendered":"https:\/\/linux-bibel.at\/?p=15277"},"modified":"2024-05-18T08:48:15","modified_gmt":"2024-05-18T06:48:15","slug":"ollama-ki-unter-linux-lokal-nutzen","status":"publish","type":"post","link":"https:\/\/linux-bibel.at\/index.php\/2024\/05\/10\/ollama-ki-unter-linux-lokal-nutzen\/","title":{"rendered":"Ollama &#8211; KI unter Linux lokal nutzen"},"content":{"rendered":"\n<p class=\"wp-block-paragraph\">Die meisten KI-Funktionen (<em>K\u00fcnstliche Intelligenz<\/em>) lassen sich nur online nutzen &#8211; etwa ChatGPT, Google Gemini (<em>ehemals Bard<\/em>) und viele weitere. Aber inzwischen gibt es auch so einige Open-Source-KIs &#8211; sogenannte LLMs, etwa die von Facebook &#8211; llama2. Solche lassen sich auch lokal nutzen &#8211; und, nat\u00fcrlich auch unter Linux, ganz einfach installieren mit Ollama.<\/p>\n\n\n\n<h3 class=\"wp-block-heading\">Ollama installieren<\/h3>\n\n\n\n<p class=\"wp-block-paragraph\">Sie finden das Script zur Installation unter <a href=\"https:\/\/ollama.com\/download\" target=\"_blank\" rel=\"noreferrer noopener\">Ollama<\/a> zum Download &#8211; einfacher gelingt dies als root auf dem Terminal mit dem Befehl:<\/p>\n\n\n\n<pre class=\"wp-block-code\"><code>curl -fsSL https:\/\/ollama.com\/install.sh | sh<\/code><\/pre>\n\n\n\n<p class=\"wp-block-paragraph\">Haben Sie nur <code>sudo<\/code> &#8211; starten Sie den Befehl als normaler Benutzer. Ein kleiner Tipp: Finden Sie solche Befehle auf nicht offiziellen Seiten, so laden Sie das Script erst nur herunter und sehen es sich erst einmal an, bevor Sie es starten \ud83d\ude01:<\/p>\n\n\n\n<figure class=\"wp-block-image size-large is-resized\"><a href=\"https:\/\/linux-bibel.at\/wp-content\/uploads\/2024\/05\/ollama.jpeg\" rel=\"lightbox-0\"><img loading=\"lazy\" decoding=\"async\" width=\"1024\" height=\"604\" src=\"https:\/\/linux-bibel.at\/wp-content\/uploads\/2024\/05\/ollama-1024x604.jpeg\" alt=\"\" class=\"wp-image-15278\" style=\"width:678px;height:auto\" srcset=\"https:\/\/linux-bibel.at\/wp-content\/uploads\/2024\/05\/ollama-1024x604.jpeg 1024w, https:\/\/linux-bibel.at\/wp-content\/uploads\/2024\/05\/ollama-1536x906.jpeg 1536w, https:\/\/linux-bibel.at\/wp-content\/uploads\/2024\/05\/ollama-2048x1208.jpeg 2048w, https:\/\/linux-bibel.at\/wp-content\/uploads\/2024\/05\/ollama-150x89.jpeg 150w, https:\/\/linux-bibel.at\/wp-content\/uploads\/2024\/05\/ollama-300x177.jpeg 300w, https:\/\/linux-bibel.at\/wp-content\/uploads\/2024\/05\/ollama-768x453.jpeg 768w\" sizes=\"auto, (max-width: 1024px) 100vw, 1024px\" \/><\/a><\/figure>\n\n\n\n<p class=\"wp-block-paragraph\">Haben Sie keine NVIDIA im Computer eingebaut, wird die KI sp\u00e4ter etwas tr\u00e4ge sein &#8211; au\u00dfer die CPU gibt ein wenig her.<\/p>\n\n\n\n<p class=\"wp-block-paragraph\">Installiert wird die Software \u00fcbrigens unter &#8222;\/usr\/local\/bin&#8220; &#8211; ein<\/p>\n\n\n\n<pre class=\"wp-block-code\"><code>rm \/usr\/local\/bin\/ollama<\/code><\/pre>\n\n\n\n<p class=\"wp-block-paragraph\">als root am Terminal l\u00e4sst die Software wieder verschwinden.<\/p>\n\n\n\n<h3 class=\"wp-block-heading\">KIs mit Ollama installieren<\/h3>\n\n\n\n<p class=\"wp-block-paragraph\">Ollama ist nur die Software, mit der Sie KI-Sprachmodelle installieren und ausf\u00fchren. Also gilt es, erst einmal sie zu installieren. Ollama l\u00e4uft nach der Installation automatisch &#8211; dies zeigt die Adresse:<\/p>\n\n\n\n<pre class=\"wp-block-code\"><code>localhost:11434<\/code><\/pre>\n\n\n\n<p class=\"wp-block-paragraph\">Im Webbrowser:<\/p>\n\n\n\n<figure class=\"wp-block-image size-large is-resized\"><a href=\"https:\/\/linux-bibel.at\/wp-content\/uploads\/2024\/05\/ollama-1.jpeg\" rel=\"lightbox-1\"><img loading=\"lazy\" decoding=\"async\" width=\"1024\" height=\"384\" src=\"https:\/\/linux-bibel.at\/wp-content\/uploads\/2024\/05\/ollama-1-1024x384.jpeg\" alt=\"\" class=\"wp-image-15279\" style=\"width:449px;height:auto\" srcset=\"https:\/\/linux-bibel.at\/wp-content\/uploads\/2024\/05\/ollama-1-1024x384.jpeg 1024w, https:\/\/linux-bibel.at\/wp-content\/uploads\/2024\/05\/ollama-1-150x56.jpeg 150w, https:\/\/linux-bibel.at\/wp-content\/uploads\/2024\/05\/ollama-1-300x113.jpeg 300w, https:\/\/linux-bibel.at\/wp-content\/uploads\/2024\/05\/ollama-1-768x288.jpeg 768w, https:\/\/linux-bibel.at\/wp-content\/uploads\/2024\/05\/ollama-1.jpeg 1092w\" sizes=\"auto, (max-width: 1024px) 100vw, 1024px\" \/><\/a><\/figure>\n\n\n\n<p class=\"wp-block-paragraph\">Dies muss nat\u00fcrlich nicht sein, Sie k\u00f6nnen die Software \u00fcber <a href=\"https:\/\/linux-bibel.at\/index.php\/2023\/09\/03\/systemd-die-steuerzentrale-von-linux\/\" data-type=\"post\" data-id=\"783\">Systemd<\/a> steuern &#8211; also als root auf dem Terminal:<\/p>\n\n\n\n<pre class=\"wp-block-code\"><code>systemctl status ollama.service\nsystemctl diasble --now ollama.service\nsystemctl start ollama.service\nsystemctl stop ollama.service\nsystemctl enable --now ollama.service<\/code><\/pre>\n\n\n\n<p class=\"wp-block-paragraph\">Noch k\u00f6nnen Sie \u00fcber die Software am Terminal keine KIs suchen &#8211; Sie m\u00fcssen sich noch auf die Webseite bem\u00fchen &#8211; <a href=\"https:\/\/ollama.com\/library?ref=itsfoss.com\" target=\"_blank\" rel=\"noreferrer noopener\">Ollama-KIs<\/a>.<\/p>\n\n\n\n<p class=\"wp-block-paragraph\">Mit:<\/p>\n\n\n\n<pre class=\"wp-block-code\"><code>ollama pull KI<\/code><\/pre>\n\n\n\n<p class=\"wp-block-paragraph\">installieren Sie anschlie\u00dfend die gew\u00fcnschte KI &#8211; gleich ein Versuch:<\/p>\n\n\n\n<pre class=\"wp-block-code\"><code>ollama pull llama2<\/code><\/pre>\n\n\n\n<p class=\"wp-block-paragraph\">Dies gelingt als normaler Benutzer:<\/p>\n\n\n\n<figure class=\"wp-block-image size-large is-resized\"><a href=\"https:\/\/linux-bibel.at\/wp-content\/uploads\/2024\/05\/ollama-2.jpeg\" rel=\"lightbox-2\"><img loading=\"lazy\" decoding=\"async\" width=\"1024\" height=\"280\" src=\"https:\/\/linux-bibel.at\/wp-content\/uploads\/2024\/05\/ollama-2-1024x280.jpeg\" alt=\"\" class=\"wp-image-15280\" style=\"width:668px;height:auto\" srcset=\"https:\/\/linux-bibel.at\/wp-content\/uploads\/2024\/05\/ollama-2-1024x280.jpeg 1024w, https:\/\/linux-bibel.at\/wp-content\/uploads\/2024\/05\/ollama-2-1536x419.jpeg 1536w, https:\/\/linux-bibel.at\/wp-content\/uploads\/2024\/05\/ollama-2-2048x559.jpeg 2048w, https:\/\/linux-bibel.at\/wp-content\/uploads\/2024\/05\/ollama-2-150x41.jpeg 150w, https:\/\/linux-bibel.at\/wp-content\/uploads\/2024\/05\/ollama-2-300x82.jpeg 300w, https:\/\/linux-bibel.at\/wp-content\/uploads\/2024\/05\/ollama-2-768x210.jpeg 768w\" sizes=\"auto, (max-width: 1024px) 100vw, 1024px\" \/><\/a><\/figure>\n\n\n\n<p class=\"wp-block-paragraph\">Im Fall von llama2 sind dies rund 3,8 GB. Die heruntergeladene KI gilt es jetzt \u00fcber Ollama zu starten, hierzu dient die Syntax:<\/p>\n\n\n\n<pre class=\"wp-block-code\"><code>ollama run modell<\/code><\/pre>\n\n\n\n<p class=\"wp-block-paragraph\">In meinem Beispiel also:<\/p>\n\n\n\n<pre class=\"wp-block-code\"><code>ollama run llama2<\/code><\/pre>\n\n\n\n<p class=\"wp-block-paragraph\">Schon wartet die KI auf Anfragen:<\/p>\n\n\n\n<figure class=\"wp-block-image size-large is-resized\"><a href=\"https:\/\/linux-bibel.at\/wp-content\/uploads\/2024\/05\/ollama-3.jpeg\" rel=\"lightbox-3\"><img loading=\"lazy\" decoding=\"async\" width=\"1024\" height=\"280\" src=\"https:\/\/linux-bibel.at\/wp-content\/uploads\/2024\/05\/ollama-3-1024x280.jpeg\" alt=\"\" class=\"wp-image-15281\" style=\"width:687px;height:auto\" srcset=\"https:\/\/linux-bibel.at\/wp-content\/uploads\/2024\/05\/ollama-3-1024x280.jpeg 1024w, https:\/\/linux-bibel.at\/wp-content\/uploads\/2024\/05\/ollama-3-1536x419.jpeg 1536w, https:\/\/linux-bibel.at\/wp-content\/uploads\/2024\/05\/ollama-3-2048x559.jpeg 2048w, https:\/\/linux-bibel.at\/wp-content\/uploads\/2024\/05\/ollama-3-150x41.jpeg 150w, https:\/\/linux-bibel.at\/wp-content\/uploads\/2024\/05\/ollama-3-300x82.jpeg 300w, https:\/\/linux-bibel.at\/wp-content\/uploads\/2024\/05\/ollama-3-768x210.jpeg 768w\" sizes=\"auto, (max-width: 1024px) 100vw, 1024px\" \/><\/a><\/figure>\n\n\n\n<p class=\"wp-block-paragraph\">Meine erste dumme Frage: &#8222;W<em>as ist Linux?<\/em>&#8220; Die Software antwortet auf diese Frage in Deutsch zwar auf Englisch, dies ist kein Problem. Ich dachte eigentlich, dass die Software ohne NVIDIA-Grafikkarte Probleme machen w\u00fcrde, aber hier, mit einer Intel-GPU am Laptop, kein Problem &#8211; nicht langsamer als etwa ChatGPT im Webbrowser:<\/p>\n\n\n\n<figure class=\"wp-block-image size-large is-resized\"><a href=\"https:\/\/linux-bibel.at\/wp-content\/uploads\/2024\/05\/ollama-4.jpeg\" rel=\"lightbox-4\"><img loading=\"lazy\" decoding=\"async\" width=\"1024\" height=\"607\" src=\"https:\/\/linux-bibel.at\/wp-content\/uploads\/2024\/05\/ollama-4-1024x607.jpeg\" alt=\"\" class=\"wp-image-15282\" style=\"width:673px;height:auto\" srcset=\"https:\/\/linux-bibel.at\/wp-content\/uploads\/2024\/05\/ollama-4-1024x607.jpeg 1024w, https:\/\/linux-bibel.at\/wp-content\/uploads\/2024\/05\/ollama-4-1536x910.jpeg 1536w, https:\/\/linux-bibel.at\/wp-content\/uploads\/2024\/05\/ollama-4-2048x1213.jpeg 2048w, https:\/\/linux-bibel.at\/wp-content\/uploads\/2024\/05\/ollama-4-150x89.jpeg 150w, https:\/\/linux-bibel.at\/wp-content\/uploads\/2024\/05\/ollama-4-300x178.jpeg 300w, https:\/\/linux-bibel.at\/wp-content\/uploads\/2024\/05\/ollama-4-768x455.jpeg 768w\" sizes=\"auto, (max-width: 1024px) 100vw, 1024px\" \/><\/a><\/figure>\n\n\n\n<p class=\"wp-block-paragraph\">Nicht mal der L\u00fcfter hat zu arbeiten begonnen. Mit <code>\/?<\/code> l\u00e4sst sich unter llama2 etwa die Hilfe anzeigen, mit <kbd>Strg+d<\/kbd> oder <code>\/bye<\/code> beenden Sie die KI &#8211; Ollama l\u00e4uft aber weiter &#8211; siehe Systemd oben.<\/p>\n\n\n\n<p class=\"wp-block-paragraph\">Installierte KIs lassen Sie sich mit:<\/p>\n\n\n\n<pre class=\"wp-block-code\"><code>ollama list<\/code><\/pre>\n\n\n\n<p class=\"wp-block-paragraph\">anzeigen:<\/p>\n\n\n\n<figure class=\"wp-block-image size-large is-resized\"><a href=\"https:\/\/linux-bibel.at\/wp-content\/uploads\/2024\/05\/ollama-5.jpeg\" rel=\"lightbox-5\"><img loading=\"lazy\" decoding=\"async\" width=\"1024\" height=\"203\" src=\"https:\/\/linux-bibel.at\/wp-content\/uploads\/2024\/05\/ollama-5-1024x203.jpeg\" alt=\"\" class=\"wp-image-15283\" style=\"width:683px;height:auto\" srcset=\"https:\/\/linux-bibel.at\/wp-content\/uploads\/2024\/05\/ollama-5-1024x203.jpeg 1024w, https:\/\/linux-bibel.at\/wp-content\/uploads\/2024\/05\/ollama-5-1536x304.jpeg 1536w, https:\/\/linux-bibel.at\/wp-content\/uploads\/2024\/05\/ollama-5-2048x406.jpeg 2048w, https:\/\/linux-bibel.at\/wp-content\/uploads\/2024\/05\/ollama-5-150x30.jpeg 150w, https:\/\/linux-bibel.at\/wp-content\/uploads\/2024\/05\/ollama-5-300x59.jpeg 300w, https:\/\/linux-bibel.at\/wp-content\/uploads\/2024\/05\/ollama-5-768x152.jpeg 768w\" sizes=\"auto, (max-width: 1024px) 100vw, 1024px\" \/><\/a><\/figure>\n\n\n\n<p class=\"wp-block-paragraph\">Mit:<\/p>\n\n\n\n<pre class=\"wp-block-code\"><code>ollama rm modell<\/code><\/pre>\n\n\n\n<p class=\"wp-block-paragraph\">entfernen Sie eine KI wieder aus dem System &#8211; etwa:<\/p>\n\n\n\n<pre class=\"wp-block-code\"><code>ollama rm llama2<\/code><\/pre>\n\n\n\n<h3 class=\"wp-block-heading\">Weiteres<\/h3>\n\n\n\n<p class=\"wp-block-paragraph\">Wichtig &#8211; bevor Sie Ollama wie oben beschrieben deinstallieren, deaktivieren Sie den Service. Sie k\u00f6nnen Ollama auch mit der grafischen Oberfl\u00e4che <a href=\"https:\/\/linux-bibel.at\/index.php\/2024\/05\/18\/ollama-mit-gui-unter-linux-nutzen\/\" data-type=\"post\" data-id=\"15380\">Open WebUI<\/a> nutzen.<\/p>\n<div class=\"pld-like-dislike-wrap pld-custom\">\r\n    <div class=\"pld-like-wrap  pld-common-wrap\">\r\n    <a href=\"javascript:void(0)\" class=\"pld-like-trigger pld-like-dislike-trigger  \" title=\"Gef\u00e4llt mir\" data-post-id=\"15277\" data-trigger-type=\"like\" data-restriction=\"cookie\" data-already-liked=\"0\">\r\n                            <img src=\"https:\/\/linux-bibel.at\/wp-content\/uploads\/2023\/12\/Daumen-Hoch.png\" alt=\"Gef\u00e4llt mir\" \/>\r\n            <\/a>\r\n    <span class=\"pld-like-count-wrap pld-count-wrap\">5    <\/span>\r\n<\/div><div class=\"pld-dislike-wrap  pld-common-wrap\">\r\n    <a href=\"javascript:void(0)\" class=\"pld-dislike-trigger pld-like-dislike-trigger  \" title=\"Gef\u00e4llt mir nicht\" data-post-id=\"15277\" data-trigger-type=\"dislike\" data-restriction=\"cookie\" data-already-liked=\"0\">\r\n                            <img src=\"https:\/\/linux-bibel.at\/wp-content\/uploads\/2023\/12\/Daumen-Runter.png\" alt=\"Gef\u00e4llt mir nicht\" \/>\r\n            <\/a>\r\n    <span class=\"pld-dislike-count-wrap pld-count-wrap\">0<\/span>\r\n<\/div><\/div>","protected":false},"excerpt":{"rendered":"<p>Die meisten KI-Funktionen (K\u00fcnstliche Intelligenz) lassen sich nur online nutzen &#8211; etwa ChatGPT, Google Gemini (ehemals Bard) und viele weitere. Aber inzwischen gibt es auch so einige Open-Source-KIs &#8211; sogenannte LLMs, etwa die von Facebook &#8211; llama2. Solche lassen sich auch lokal nutzen &#8211; und, nat\u00fcrlich auch unter Linux, ganz einfach installieren mit Ollama. Ollama [&hellip;]<\/p>\n","protected":false},"author":1,"featured_media":15282,"comment_status":"open","ping_status":"open","sticky":false,"template":"","format":"standard","meta":{"footnotes":""},"categories":[628,4],"tags":[697,12,698,7,6],"class_list":["post-15277","post","type-post","status-publish","format-standard","has-post-thumbnail","hentry","category-kuenstliche-intelligenz","category-terminal","tag-ki","tag-kommandozeile","tag-kuenstliche-intelligenz","tag-shell","tag-terminal"],"_links":{"self":[{"href":"https:\/\/linux-bibel.at\/index.php\/wp-json\/wp\/v2\/posts\/15277","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/linux-bibel.at\/index.php\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/linux-bibel.at\/index.php\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/linux-bibel.at\/index.php\/wp-json\/wp\/v2\/users\/1"}],"replies":[{"embeddable":true,"href":"https:\/\/linux-bibel.at\/index.php\/wp-json\/wp\/v2\/comments?post=15277"}],"version-history":[{"count":5,"href":"https:\/\/linux-bibel.at\/index.php\/wp-json\/wp\/v2\/posts\/15277\/revisions"}],"predecessor-version":[{"id":15387,"href":"https:\/\/linux-bibel.at\/index.php\/wp-json\/wp\/v2\/posts\/15277\/revisions\/15387"}],"wp:featuredmedia":[{"embeddable":true,"href":"https:\/\/linux-bibel.at\/index.php\/wp-json\/wp\/v2\/media\/15282"}],"wp:attachment":[{"href":"https:\/\/linux-bibel.at\/index.php\/wp-json\/wp\/v2\/media?parent=15277"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/linux-bibel.at\/index.php\/wp-json\/wp\/v2\/categories?post=15277"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/linux-bibel.at\/index.php\/wp-json\/wp\/v2\/tags?post=15277"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}