{"id":4520,"date":"2025-01-05T18:20:52","date_gmt":"2025-01-05T18:20:52","guid":{"rendered":"https:\/\/www.qworqs.com\/blog\/?p=4520"},"modified":"2025-03-13T15:49:55","modified_gmt":"2025-03-13T15:49:55","slug":"ollama","status":"publish","type":"post","link":"https:\/\/www.voodoo.business\/blog\/2025\/01\/05\/ollama\/","title":{"rendered":"Ollama"},"content":{"rendered":"\n<h3 class=\"wp-block-heading\">1- Installing<\/h3>\n\n\n\n<p>1.1 &#8211; Linux<\/p>\n\n\n\n<p>On Debian linux, Installing Ollama is a one liner, just enter the following in your terminal<\/p>\n\n\n\n<pre class=\"wp-block-preformatted\">curl -fsSL https:\/\/ollama.com\/install.sh | sh<\/pre>\n\n\n\n<p>Yup, that is it, move on to using Ollama<\/p>\n\n\n\n<p>1.2 Windows and MAC<\/p>\n\n\n\n<p>Just go to <a href=\"https:\/\/ollama.com\/\">https:\/\/ollama.com\/<\/a>, download it, and run the installer ! you are done<\/p>\n\n\n\n<h2 class=\"wp-block-heading\"><strong>Optional: Changing the models directory<\/strong><\/h2>\n\n\n\n<p>AI models can be very big, sometimes half a terabyte, for example, at the time of writing, deepseek model was around 700GBs, but the disk you are copying to needs to be an SSD if you want reasonable speed.<\/p>\n\n\n\n<p>So here are the steps<\/p>\n\n\n\n<ul class=\"wp-block-list\">\n<li><code>sudo systemctl stop ollama<\/code><\/li>\n\n\n\n<li><code>sudo mkdir -p \/hds\/2tb\/ollama_models<\/code> (Wherever you want the data to be)<\/li>\n\n\n\n<li><code>sudo chown ollama:ollama \/hds\/2tb\/ollama_models<\/code> (Whatever your username is)<\/li>\n\n\n\n<li><code>sudo mkdir -p \/etc\/systemd\/system\/ollama.service.d\/<\/code> (This is the override conf)<\/li>\n\n\n\n<li><code>sudo nano \/etc\/systemd\/system\/ollama.service.d\/override.conf<\/code><br>and add the following to it<br>[Service]<br>Environment=&#8221;OLLAMA_MODELS=\/hds\/2tb\/ollama_models&#8221;<\/li>\n\n\n\n<li><code>sudo systemctl daemon-reload<\/code><\/li>\n\n\n\n<li><code>sudo systemctl start ollama<\/code><\/li>\n\n\n\n<li><code>sudo systemctl show -p Environment ollama<\/code><\/li>\n<\/ul>\n\n\n\n<h3 class=\"wp-block-heading\">Using it !<\/h3>\n\n\n\n<p>Using Ollama is simple, just open your terminal window or command prompt , then activate your conda environment (Or venv) , and run the following command, for the sake of this example, I will run<\/p>\n\n\n\n<pre class=\"wp-block-preformatted\">ollama run llama3.2<\/pre>\n\n\n\n<p><strong>llama3.3<\/strong> with its 70 billion parameters will require a minimum of 64GB of ram, so don&#8217;t try that unless you have the RAM for it ! for comparison, 3.2 has 2 billion, which is around 3% of 3.3<\/p>\n\n\n\n<p>It should now probably download about 2GBs of data (The model llama3.2 has around 2 billion parameters) And you are done, Now you can ask it anything<\/p>\n\n\n\n<p>For example, create an article for me explaining this and that, <\/p>\n\n\n\n<p>Once done, just enter &#8220;\/bye&#8221; to exit the ollama prompt and quit the session<\/p>\n\n\n\n<p>If you want to for example clear the context or do anything else, just use the command \/? for a list of commands<\/p>\n\n\n\n<p>Now, you have used the lama3.2, but on this <a href=\"https:\/\/ollama.com\/search\">ollama models page<\/a>, you will find that there are many others that you can use !<\/p>\n\n\n\n<p>Others include models that help you with coding, or models that are more targeted towards chat-bot QA, either way, you should take a close look at them, even if for the fun of it<\/p>\n\n\n\n<h2 class=\"wp-block-heading\">Is ollama running ?<\/h2>\n\n\n\n<p>Just visit (<a href=\"http:\/\/localhost:11434\/\">http:\/\/localhost:11434\/<\/a>) in your browser, and you should see the message (Ollama is running)<\/p>\n\n\n\n<p>What models have been installed (ex: ollama pull llama3.2)<\/p>\n\n\n\n<pre class=\"wp-block-preformatted\">ollama list<\/pre>\n\n\n\n<p>Remove installed models from system<\/p>\n\n\n\n<p>Start by listing the models like the above, then you can remove them with rm<\/p>\n\n\n\n<pre class=\"wp-block-preformatted\">ollama rm llama3.2<\/pre>\n\n\n\n<h2 class=\"wp-block-heading\">Modifying a model&#8217;s settings<\/h2>\n\n\n\n<p>An example of what you may want to modify may be for example If you have a GPU, but you do not want it to be used by Ollama, to do this, you will need to create a model file, the steps to creating this file for llama 3.2, (The small one) are as follows<\/p>\n\n\n\n<pre class=\"wp-block-preformatted\"># Copy the llama 3.2 base file<br>ollama show llama3.2:latest --modelfile &gt; ~\/cpullama3.2.modelfile<br># edit the file ~\/cpullama3.2 and edit the FROM line to read<br>FROM llama3.2:latest<br># go to the parameters section, and add the parameters you need<br># In our case, PARAMETER num_gpu 0<br>PARAMETER num_gpu 0<br># Create your custom model<br>ollama create cpullama3.2 --file cpullama3.2.modelfile<\/pre>\n\n\n\n<p>The last command above resulted in the following output<\/p>\n\n\n\n<pre class=\"wp-block-preformatted\">transferring model data <br>using existing layer sha256:dde5aa3fc5ffc17176b5e8bdc82f587b24b2678c6c66101bf7da77af9f7ccdff <br>using existing layer sha256:fcc5a6bec9daf9b561a68827b67ab6088e1dba9d1fa2a50d7bbcc8384e0a265d <br>using existing layer sha256:a70ff7e570d97baaf4e62ac6e6ad9975e04caa6d900d3742d37698494479e0cd <br>using existing layer sha256:966de95ca8a62200913e3f8bfbf84c8494536f1b94b49166851e76644e966396 <br>using existing layer sha256:fcc5a6bec9daf9b561a68827b67ab6088e1dba9d1fa2a50d7bbcc8384e0a265d <br>using existing layer sha256:a70ff7e570d97baaf4e62ac6e6ad9975e04caa6d900d3742d37698494479e0cd <br>creating new layer sha256:650ff8e84978b35dd2f3ea3653ed6bf020a95e7deb031ceae487cdd98dedc2e3 <br>creating new layer sha256:f29c86d4cf6a4072deefa0ff196b7960da63b229686497b02aad4f5202d263ea <br>writing manifest <br>success <br><\/pre>\n\n\n\n<p>Above, although you simply created a &#8220;model&#8221; by copying the existing model&#8217;s config file ! nothing more nothing less<\/p>\n\n\n\n<h2 class=\"wp-block-heading\">Ollama API<\/h2>\n\n\n\n<p>So, above, your terminal allowed you to chat with the model, much like what you do when you open Claude or ChatGPT, if you want to access things via API, here is how.<\/p>\n\n\n\n<h2 class=\"wp-block-heading\">Disable Ollama<\/h2>\n\n\n\n<p>To make sure Ollama does not come up at boot, execute the following two commands<\/p>\n\n\n\n<pre class=\"wp-block-preformatted\">sudo systemctl stop ollama<br>sudo systemctl disable ollama<\/pre>\n\n\n\n<h2 class=\"wp-block-heading\">Removing Ollama<\/h2>\n\n\n\n<p><\/p>\n","protected":false},"excerpt":{"rendered":"<p>1- Installing 1.1 &#8211; Linux On Debian linux, Installing Ollama is a one liner, just enter the following in your terminal curl -fsSL https:\/\/ollama.com\/install.sh | sh Yup, that is it, move on to using Ollama 1.2 Windows and MAC Just go to https:\/\/ollama.com\/, download it, and run the installer ! you are done Optional: Changing [&hellip;]<\/p>\n","protected":false},"author":1,"featured_media":0,"comment_status":"open","ping_status":"open","sticky":false,"template":"","format":"standard","meta":{"footnotes":""},"categories":[176,211],"tags":[],"class_list":["post-4520","post","type-post","status-publish","format-standard","hentry","category-ai","category-local-ai"],"_links":{"self":[{"href":"https:\/\/www.voodoo.business\/blog\/wp-json\/wp\/v2\/posts\/4520","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/www.voodoo.business\/blog\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/www.voodoo.business\/blog\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/www.voodoo.business\/blog\/wp-json\/wp\/v2\/users\/1"}],"replies":[{"embeddable":true,"href":"https:\/\/www.voodoo.business\/blog\/wp-json\/wp\/v2\/comments?post=4520"}],"version-history":[{"count":30,"href":"https:\/\/www.voodoo.business\/blog\/wp-json\/wp\/v2\/posts\/4520\/revisions"}],"predecessor-version":[{"id":5135,"href":"https:\/\/www.voodoo.business\/blog\/wp-json\/wp\/v2\/posts\/4520\/revisions\/5135"}],"wp:attachment":[{"href":"https:\/\/www.voodoo.business\/blog\/wp-json\/wp\/v2\/media?parent=4520"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/www.voodoo.business\/blog\/wp-json\/wp\/v2\/categories?post=4520"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/www.voodoo.business\/blog\/wp-json\/wp\/v2\/tags?post=4520"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}