{"id":28456,"date":"2025-03-13T12:25:58","date_gmt":"2025-03-13T04:25:58","guid":{"rendered":"https:\/\/www.aisharenet.com\/?p=28456"},"modified":"2025-03-13T12:25:58","modified_gmt":"2025-03-13T04:25:58","slug":"ollama-anzhuangyupeiai-3","status":"publish","type":"post","link":"https:\/\/www.kdjingpai.com\/ja\/ollama-anzhuangyupeiai-3\/","title":{"rendered":"Ollama \u5b89\u88c5\u4e0e\u914d\u7f6e &#8211; Linux \u7cfb\u7edf\u7bc7"},"content":{"rendered":"<h2>\u7b80\u4ecb<\/h2>\n<p>\u672c\u8282\u5b66\u4e60\u5982\u4f55\u5728 Linux \u7cfb\u7edf\u4e2d\u5b8c\u6210 <a href=\"https:\/\/www.kdjingpai.com\/en\/ollama\/\">Ollama<\/a> \u7684\u5b89\u88c5\u4e0e\u914d\u7f6e\uff0c\u4ee5\u53ca\u5bf9 Ollama \u66f4\u65b0\uff0c\u7279\u5b9a\u7248\u672c\u7684\u5b89\u88c5\uff0c\u67e5\u770b\u65e5\u5fd7\u548c\u5378\u8f7d\u3002<\/p>\n<h2>\u4e00\u3001\u5feb\u901f\u5b89\u88c5<\/h2>\n<p>Ollama \u4e0b\u8f7d\uff1ahttps:\/\/ollama.com\/download<\/p>\n<p>Ollama \u5b98\u65b9\u4e3b\u9875\uff1ahttps:\/\/ollama.com<\/p>\n<p>Ollama \u5b98\u65b9 GitHub \u6e90\u4ee3\u7801\u4ed3\u5e93\uff1ahttps:\/\/github.com\/ollama\/ollama\/<\/p>\n<p>\u5b98\u7f51\u63d0\u4f9b\u4e86\u4e00\u6761\u547d\u4ee4\u884c\u5feb\u901f\u5b89\u88c5\u7684\u65b9\u6cd5\u3002<\/p>\n<p><img loading=\"lazy\" decoding=\"async\" class=\"aligncenter size-full wp-image-28457\" title=\"Ollama \u5b89\u88c5\u4e0e\u914d\u7f6e - Linux \u7cfb\u7edf\u7bc7-1\" src=\"https:\/\/www.kdjingpai.com\/wp-content\/uploads\/2025\/03\/b2bb11f08d2dc8c.png\" alt=\"Ollama \u5b89\u88c5\u4e0e\u914d\u7f6e - Linux \u7cfb\u7edf\u7bc7-1\" width=\"520\" height=\"409\" srcset=\"https:\/\/www.kdjingpai.com\/wp-content\/uploads\/2025\/03\/b2bb11f08d2dc8c.png 520w, https:\/\/www.kdjingpai.com\/wp-content\/uploads\/2025\/03\/b2bb11f08d2dc8c-15x12.png 15w\" sizes=\"auto, (max-width: 520px) 100vw, 520px\" \/><\/p>\n<pre><code>curl -fsSL https:\/\/ollama.com\/install.sh | sh\r\n<\/code><\/pre>\n<p><a href=\"https:\/\/github.com\/datawhalechina\/handy-ollama\/blob\/main\/docs\/images\/C2-3-2.png\"> <img loading=\"lazy\" decoding=\"async\" class=\"aligncenter size-full wp-image-28458\" title=\"Ollama \u5b89\u88c5\u4e0e\u914d\u7f6e - Linux \u7cfb\u7edf\u7bc7-2\" src=\"https:\/\/www.kdjingpai.com\/wp-content\/uploads\/2025\/03\/19096b3624c583c.png\" alt=\"Ollama \u5b89\u88c5\u4e0e\u914d\u7f6e - Linux \u7cfb\u7edf\u7bc7-2\" width=\"616\" height=\"91\" srcset=\"https:\/\/www.kdjingpai.com\/wp-content\/uploads\/2025\/03\/19096b3624c583c.png 616w, https:\/\/www.kdjingpai.com\/wp-content\/uploads\/2025\/03\/19096b3624c583c-18x3.png 18w\" sizes=\"auto, (max-width: 616px) 100vw, 616px\" \/> <\/a><\/p>\n<p>\u6b64\u547d\u4ee4\u5c06\u81ea\u52a8\u4e0b\u8f7d\u6700\u65b0\u7248\u672c\u7684 Ollama \u5e76\u5b8c\u6210\u5b89\u88c5\uff0c\u4ee5\u4e0b\u662f Ollama \u4f7f\u7528\u5e38\u89c1\u7684\u6307\u4ee4\uff1a<\/p>\n<pre><code>ollama serve         #\u542f\u52a8ollama\r\nollama create        #\u4ece\u6a21\u578b\u6587\u4ef6\u521b\u5efa\u6a21\u578b\r\nollama show          #\u663e\u793a\u6a21\u578b\u4fe1\u606f\r\nollama run           #\u8fd0\u884c\u6a21\u578b\r\nollama pull          #\u4ece\u6ce8\u518c\u8868\u4e2d\u62c9\u53d6\u6a21\u578b\r\nollama push          #\u5c06\u6a21\u578b\u63a8\u9001\u5230\u6ce8\u518c\u8868\r\nollama list          #\u5217\u51fa\u6a21\u578b\r\nollama cp            #\u590d\u5236\u6a21\u578b\r\nollama rm            #\u5220\u9664\u6a21\u578b\r\nollama help          #\u83b7\u53d6\u6709\u5173\u4efb\u4f55\u547d\u4ee4\u7684\u5e2e\u52a9\u4fe1\u606f\r\n<\/code><\/pre>\n<ul>\n<li>\u9a8c\u8bc1\u5b89\u88c5\u5b8c\u6210\uff0c\u5728\u00a0<code>Exec<\/code>\u00a0\u5904\u8f93\u5165\uff1a<\/li>\n<\/ul>\n<pre><code>ollama -h\r\n<\/code><\/pre>\n<p>\u8f93\u51fa\u5982\u4e0b\uff1a\u5373\u8868\u793a\u5b89\u88c5\u6210\u529f\ud83c\udf89<\/p>\n<p><img loading=\"lazy\" decoding=\"async\" class=\"aligncenter size-full wp-image-28459\" title=\"Ollama \u5b89\u88c5\u4e0e\u914d\u7f6e - Linux \u7cfb\u7edf\u7bc7-3\" src=\"https:\/\/www.kdjingpai.com\/wp-content\/uploads\/2025\/03\/05d7063783eea23.png\" alt=\"Ollama \u5b89\u88c5\u4e0e\u914d\u7f6e - Linux \u7cfb\u7edf\u7bc7-3\" width=\"534\" height=\"301\" srcset=\"https:\/\/www.kdjingpai.com\/wp-content\/uploads\/2025\/03\/05d7063783eea23.png 534w, https:\/\/www.kdjingpai.com\/wp-content\/uploads\/2025\/03\/05d7063783eea23-18x10.png 18w\" sizes=\"auto, (max-width: 534px) 100vw, 534px\" \/><\/p>\n<ul>\n<li>\u5f00\u542f\u5e76\u4f7f\u7528 Ollama<\/li>\n<\/ul>\n<p>\u9996\u5148\uff0c\u5728\u7ec8\u7aef\u4e2d\u5f00\u542f Ollama\uff0c\u5e76\u5728\u540e\u53f0\u6302\u8d77<\/p>\n<pre><code>ollama serve\r\n<\/code><\/pre>\n<p><img loading=\"lazy\" decoding=\"async\" class=\"aligncenter size-full wp-image-28460\" title=\"Ollama \u5b89\u88c5\u4e0e\u914d\u7f6e - Linux \u7cfb\u7edf\u7bc7-4\" src=\"https:\/\/www.kdjingpai.com\/wp-content\/uploads\/2025\/03\/37973d1dabc4667.png\" alt=\"Ollama \u5b89\u88c5\u4e0e\u914d\u7f6e - Linux \u7cfb\u7edf\u7bc7-4\" width=\"1043\" height=\"348\" srcset=\"https:\/\/www.kdjingpai.com\/wp-content\/uploads\/2025\/03\/37973d1dabc4667.png 1043w, https:\/\/www.kdjingpai.com\/wp-content\/uploads\/2025\/03\/37973d1dabc4667-768x256.png 768w, https:\/\/www.kdjingpai.com\/wp-content\/uploads\/2025\/03\/37973d1dabc4667-18x6.png 18w\" sizes=\"auto, (max-width: 1043px) 100vw, 1043px\" \/><\/p>\n<p><a href=\"https:\/\/ollama.com\/library\">library (ollama.com)<\/a>\u8fd9\u91cc\u662f Ollama \u7684\u6a21\u578b\u5e93\uff0c\u641c\u7d22\u4f60\u60f3\u8981\u7684\u6a21\u578b\uff0c\u5f00\u542f\u65b0\u7684\u7ec8\u7aef\uff0c\u542f\u52a8\uff01<\/p>\n<pre><code>ollama run llama3\r\n<\/code><\/pre>\n<p>\u4e0b\u8f7d\u901f\u5ea6\u53d6\u51b3\u4e8e\u4f60\u7684\u5e26\u5bbd\uff0c\u4e0b\u8f7d\u5b8c\u6bd5\u5373\u53ef\u4f7f\u7528\u270c\u8bb0\u5f97\u4f7f\u7528\u00a0<code>control + D<\/code>\u00a0\u9000\u51fa\u804a\u5929<\/p>\n<p><img loading=\"lazy\" decoding=\"async\" class=\"aligncenter size-full wp-image-28461\" title=\"Ollama \u5b89\u88c5\u4e0e\u914d\u7f6e - Linux \u7cfb\u7edf\u7bc7-5\" src=\"https:\/\/www.kdjingpai.com\/wp-content\/uploads\/2025\/03\/56e3de1664368d2.png\" alt=\"Ollama \u5b89\u88c5\u4e0e\u914d\u7f6e - Linux \u7cfb\u7edf\u7bc7-5\" width=\"1046\" height=\"487\" srcset=\"https:\/\/www.kdjingpai.com\/wp-content\/uploads\/2025\/03\/56e3de1664368d2.png 1046w, https:\/\/www.kdjingpai.com\/wp-content\/uploads\/2025\/03\/56e3de1664368d2-768x358.png 768w, https:\/\/www.kdjingpai.com\/wp-content\/uploads\/2025\/03\/56e3de1664368d2-18x8.png 18w\" sizes=\"auto, (max-width: 1046px) 100vw, 1046px\" \/><\/p>\n<h2>\u4e8c\u3001\u624b\u52a8\u5b89\u88c5<\/h2>\n<p>\u6ce8\u610f\uff1a \u5982\u679c\u4e4b\u524d\u5df2\u7ecf\u5b89\u88c5\u4e86\u65e7\u7248\u672c\u7684ollama\uff0c\u90a3\u4e48\u9700\u8981\u5148\u5b8c\u6210\u624b\u52a8\u5378\u8f7d\uff0c<code>sudo rm -rf \/usr\/lib\/ollama<\/code>\u00a0\u66f4\u591a\u9700\u6c42\ud83d\udc49\u53c2\u8003<a href=\"https:\/\/github.com\/ollama\/ollama\/blob\/main\/docs\/linux.md\">\u5b98\u7f51<\/a><\/p>\n<h3>2.1 \u4e0b\u8f7d\u5e76\u89e3\u538b\u4e0e\u64cd\u4f5c\u7cfb\u7edf\u5339\u914d\u7684\u5b89\u88c5\u5305<\/h3>\n<pre><code>curl -L https:\/\/ollama.com\/download\/ollama-linux-amd64.tgz -o ollama-linux-amd64.tgz\r\nsudo tar -C \/usr -xzf ollama-linux-amd64.tgz\r\n<\/code><\/pre>\n<p><strong>AMD GPU<\/strong>\u4e0b\u8f7d\uff1a<\/p>\n<pre><code>curl -L https:\/\/ollama.com\/download\/ollama-linux-amd64-rocm.tgz -o ollama-linux-amd64-rocm.tgz\r\nsudo tar -C \/usr -xzf ollama-linux-amd64-rocm.tgz\r\n<\/code><\/pre>\n<p><strong>ARM 64<\/strong>\u4e0b\u8f7d\uff1a<\/p>\n<pre><code>curl -L https:\/\/ollama.com\/download\/ollama-linux-arm64.tgz -o ollama-linux-arm64.tgz\r\nsudo tar -C \/usr -xzf ollama-linux-arm64.tgz\r\n<\/code><\/pre>\n<h3>2.2 \u542f\u52a8 Ollama\u5e76\u9a8c\u8bc1<\/h3>\n<p>\u8f93\u5165\u4ee5\u4e0b\u547d\u4ee4\u542f\u52a8 Ollama\uff1a<\/p>\n<pre><code>ollama serve\r\n<\/code><\/pre>\n<p>\u53e6\u5f00\u542f\u4e00\u4e2a\u7ec8\u7aef\uff0c\u8f93\u5165\u4ee5\u4e0b\u547d\u4ee4\uff0c\u9a8c\u8bc1ollama\u662f\u5426\u8fd0\u884c\u6210\u529f<\/p>\n<pre><code>ollama -v\r\n<\/code><\/pre>\n<h3>2.3 \u5c06 Ollama \u6dfb\u52a0\u4e3a\u81ea\u542f\u52a8\u670d\u52a1\uff08\u63a8\u8350\uff09<\/h3>\n<p>\u9996\u5148\uff0c\u4e3a Ollama \u521b\u5efa\u7528\u6237\u548c\u7ec4\uff1a<\/p>\n<pre><code>sudo useradd -r -s \/bin\/false -U -m -d \/usr\/share\/ollama ollama\r\nsudo usermod -a -G ollama $(whoami)\r\n<\/code><\/pre>\n<p>\u7136\u540e\u5728\u8be5\u4f4d\u7f6e\uff1a<code>\/etc\/systemd\/system\/ollama.service<\/code>\u00a0\u521b\u5efa\u670d\u52a1\u6587\u4ef6<\/p>\n<pre><code>[Unit]\r\nDescription=Ollama Service\r\nAfter=network-online.target\r\n[Service]\r\nExecStart=\/usr\/bin\/ollama serve\r\nUser=ollama\r\nGroup=ollama\r\nRestart=always\r\nRestartSec=3\r\nEnvironment=\"PATH=$PATH\"\r\n[Install]\r\nWantedBy=default.target\r\n<\/code><\/pre>\n<p>\u6700\u540e\u542f\u52a8\u670d\u52a1\uff1a<\/p>\n<pre><code>sudo systemctl daemon-reload\r\nsudo systemctl enable ollama\r\n<\/code><\/pre>\n<h2>\u4e09\u3001\u66f4\u65b0<\/h2>\n<p>\u518d\u6b21\u8fd0\u884c\u4e4b\u524d\u7684\u5b89\u88c5\u8bed\u53e5\u6765\u66f4\u65b0 Ollama\uff1a<\/p>\n<pre><code>curl -fsSL https:\/\/ollama.com\/install.sh | sh\r\n<\/code><\/pre>\n<p>\u6216\u8005\u91cd\u65b0\u4e0b\u8f7d\u6700\u65b0\u7684Ollama\u5305\uff1a<\/p>\n<pre><code>curl -L https:\/\/ollama.com\/download\/ollama-linux-amd64.tgz -o ollama-linux-amd64.tgz\r\nsudo tar -C \/usr -xzf ollama-linux-amd64.tgz\r\n<\/code><\/pre>\n<h2>\u56db\u3001\u5b89\u88c5\u7279\u5b9a\u7248\u672c<\/h2>\n<p>\u8bbe\u7f6e\u00a0<code>OLLAMA_VERSION<\/code>\u5b57\u6bb5\uff0c\uff0c\u53ef\u4ee5\u5b89\u88c5\u5bf9\u5e94\u7684\u7248\u672c<\/p>\n<pre><code>curl -fsSL https:\/\/ollama.com\/install.sh | OLLAMA_VERSION=0.5.7 sh\r\n<\/code><\/pre>\n<h2>\u4e94\u3001\u67e5\u770b\u65e5\u5fd7<\/h2>\n<p>\u67e5\u770b\u4f5c\u4e3a\u542f\u52a8\u670d\u52a1\u8fd0\u884c\u7684 Ollama \u7684\u65e5\u5fd7\uff1a<\/p>\n<pre><code>journalctl -e -u ollama\r\n<\/code><\/pre>\n<h2>\u516d\u3001\u5378\u8f7d<\/h2>\n<ul>\n<li>\u5220\u9664 Ollama \u670d\u52a1\uff1a<\/li>\n<\/ul>\n<pre><code>sudo systemctl stop ollama\r\nsudo systemctl disable ollama\r\nsudo rm \/etc\/systemd\/system\/ollama.service\r\n<\/code><\/pre>\n<ul>\n<li>\u4ece bin \u76ee\u5f55\u4e2d\u5220\u9664 Ollama \u4e8c\u8fdb\u5236\u6587\u4ef6\uff1a\u00a0<code>\/usr\/local\/bin <\/code>,<code>\/usr\/bin<\/code>\u00a0,<code>\/bin<\/code><\/li>\n<\/ul>\n<pre><code>sudo rm $(which ollama)\r\n<\/code><\/pre>\n<ul>\n<li>\u5220\u9664\u4e0b\u8f7d\u7684\u6a21\u578b\u548c Ollama \u670d\u52a1\u7528\u6237\u548c\u7ec4\uff1a<\/li>\n<\/ul>\n<pre><code>sudo rm -r \/usr\/share\/ollama\r\nsudo userdel ollama\r\nsudo groupdel ollama\r\n<\/code><\/pre>\n<ul>\n<li>\u5220\u9664\u4e0b\u8f7d\u7684\u5e93\u6587\u4ef6<\/li>\n<\/ul>\n<pre><code>sudo rm -rf \/usr\/local\/lib\/ollama<\/code><\/pre>\n","protected":false},"excerpt":{"rendered":"<p>\u7b80\u4ecb \u672c\u8282\u5b66\u4e60\u5982\u4f55\u5728 Linux \u7cfb\u7edf\u4e2d\u5b8c\u6210 Ollama \u7684\u5b89\u88c5\u4e0e\u914d\u7f6e\uff0c\u4ee5\u53ca\u5bf9 Ollama \u66f4\u65b0\uff0c\u7279\u5b9a\u7248\u672c\u7684\u5b89\u88c5\uff0c\u67e5\u770b\u65e5\u5fd7\u548c\u5378\u8f7d\u3002 \u4e00\u3001\u5feb\u901f\u5b89\u88c5 Ollama \u4e0b\u8f7d\uff1ahttps:\/\/ollama.com\/download Ollama &#8230;<\/p>\n","protected":false},"author":1,"featured_media":0,"comment_status":"open","ping_status":"closed","sticky":false,"template":"","format":"standard","meta":{"footnotes":""},"categories":[182],"tags":[],"class_list":["post-28456","post","type-post","status-publish","format-standard","hentry","category-shicao"],"_links":{"self":[{"href":"https:\/\/www.kdjingpai.com\/ja\/wp-json\/wp\/v2\/posts\/28456","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/www.kdjingpai.com\/ja\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/www.kdjingpai.com\/ja\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/www.kdjingpai.com\/ja\/wp-json\/wp\/v2\/users\/1"}],"replies":[{"embeddable":true,"href":"https:\/\/www.kdjingpai.com\/ja\/wp-json\/wp\/v2\/comments?post=28456"}],"version-history":[{"count":0,"href":"https:\/\/www.kdjingpai.com\/ja\/wp-json\/wp\/v2\/posts\/28456\/revisions"}],"wp:attachment":[{"href":"https:\/\/www.kdjingpai.com\/ja\/wp-json\/wp\/v2\/media?parent=28456"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/www.kdjingpai.com\/ja\/wp-json\/wp\/v2\/categories?post=28456"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/www.kdjingpai.com\/ja\/wp-json\/wp\/v2\/tags?post=28456"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}