{"id":1492,"date":"2025-01-24T06:06:57","date_gmt":"2025-01-24T06:06:57","guid":{"rendered":"https:\/\/zahiralam.com\/blog\/?p=1492"},"modified":"2025-01-24T07:01:40","modified_gmt":"2025-01-24T07:01:40","slug":"run-a-powerful-openai-alternative-locally-on-ubuntu-installing-deepseek-r1-with-ollama","status":"publish","type":"post","link":"https:\/\/zahiralam.com\/blog\/run-a-powerful-openai-alternative-locally-on-ubuntu-installing-deepseek-r1-with-ollama\/","title":{"rendered":"Run a Powerful OpenAI Alternative Locally on Ubuntu: Installing DeepSeek-R1 with Ollama"},"content":{"rendered":"\n<p>DeepSeek-R1 is a powerful open-source large language model (LLM) designed for advanced reasoning and problem-solving. This guide shows you how to install and run DeepSeek-R1 locally on your Ubuntu system using Ollama, a streamlined framework for managing and running LLMs. This provides a compelling alternative to cloud-based solutions like OpenAI&#8217;s models, offering greater control, privacy, and potentially lower costs.\n\n\n\n<h2 class=\"wp-block-heading\"><strong>Why Run DeepSeek-R1 Locally on Ubuntu?<\/strong><\/h2>\n\n\n\n<p>Running LLMs like DeepSeek-R1 locally on your Ubuntu machine offers several advantages:\n\n\n\n<ul class=\"wp-block-list\">\n<li><strong>Privacy:<\/strong>&nbsp;Keep your data and prompts on your own system.<\/li>\n\n\n\n<li><strong>Cost-Effectiveness:<\/strong>&nbsp;Avoid recurring cloud computing costs.<\/li>\n\n\n\n<li><strong>Offline Access:<\/strong>&nbsp;Use the model even without an internet connection.<\/li>\n\n\n\n<li><strong>Customization:<\/strong>&nbsp;Fine-tune and experiment with the model on your own hardware.<\/li>\n<\/ul>\n\n\n\n<h2 class=\"wp-block-heading\"><strong>Prerequisites:<\/strong><\/h2>\n\n\n\n<ul class=\"wp-block-list\">\n<li>A running Ubuntu system (desktop or server).<\/li>\n\n\n\n<li>Internet connection (for initial download).<\/li>\n\n\n\n<li>Sufficient disk space (depending on the model size).<\/li>\n\n\n\n<li>Ollama installed. Follow our guide:&nbsp;<a target=\"_blank\" rel=\"noreferrer noopener\" href=\"https:\/\/zahiralam.com\/blog\/setting-up-ollama-on-ubuntu-a-beginners-guide\/\">Setting Up Ollama on Ubuntu: A Beginner&#8217;s Guide<\/a><\/li>\n<\/ul>\n\n\n\n<h2 class=\"wp-block-heading\"><strong>DeepSeek-R1 Model Sizes and Storage Requirements:<\/strong><\/h2>\n\n\n\n<p>DeepSeek-R1 comes in various sizes, each with different performance characteristics and storage needs:\n\n\n\n<ul class=\"wp-block-list\">\n<li><code>deepseek-r1:1.5b<\/code>: <strong>1.1 GB<\/strong> (Good for testing and resource-constrained systems)<\/li>\n\n\n\n<li><code>deepseek-r1:7b<\/code>: <strong>4.7 GB<\/strong><\/li>\n\n\n\n<li><code>deepseek-r1:8b<\/code>: <strong>4.9 GB<\/strong><\/li>\n\n\n\n<li><code>deepseek-r1:14b<\/code>: <strong>9 GB<\/strong> (<strong>Recommended for a balance of performance and resource usage<\/strong>)<\/li>\n\n\n\n<li><code>deepseek-r1:32b<\/code>: <strong>19 GB<\/strong> (Use with caution; requires significant RAM)<\/li>\n\n\n\n<li><code>deepseek-r1:70b<\/code>: <strong>42 GB<\/strong> (Requires substantial disk space and powerful hardware)<\/li>\n\n\n\n<li><code>deepseek-r1:671b<\/code>: <strong>404 GB<\/strong> (Not practical for most personal computers)<\/li>\n<\/ul>\n\n\n\n<h2 class=\"wp-block-heading\"><strong>Installation Steps:<\/strong><\/h2>\n\n\n\n<p>1. <strong>Open a Terminal:<\/strong>&nbsp;Use Ctrl+Alt+T or search for &#8220;Terminal&#8221; in your applications.\n\n\n\n<p>2. <strong>Install DeepSeek-R1:<\/strong>&nbsp;Use the&nbsp;<code>ollama run<\/code>&nbsp;command followed by the desired model name. \n\n\n\n<p>For example, to install the 14b version:\n\n\n\n<div class=\"code-block-container\">\n                        <pre class=\"wp-block-code\"><code id=\"code-1\">ollama run deepseek-r1:14b<\/code><\/pre>\n                        <amp-iframe sandbox=\"allow-scripts\" width=\"94\" height=\"72\" frameborder=\"0\" \n                                    src=\"https:\/\/zahiralam.com\/blog\/wp-content\/plugins\/amp-copy-code-button\/copier.html#ollama%20run%20deepseek-r1%3A14b\">\n                            <button class=\"copy-button\" data-label=\"ollama run deepseek-r1:14b\"  placeholder disabled>Copy<\/button>\n                        <\/amp-iframe>\n                    <\/div>\n\n\n\n<p>Replace&nbsp;<code>14b<\/code>&nbsp;with the desired size (e.g.,&nbsp;<code>1.5b<\/code>,&nbsp;<code>7b<\/code>, etc.).\n\n\n\n<p>3. <strong>Wait for Download and Setup:<\/strong>&nbsp;Ollama will download the model files and set everything up. This may take some time depending on your internet connection and the model size.\n\n\n\n<p>4.<strong> Interact with DeepSeek-R1:<\/strong>&nbsp;Once the installation is complete, you can start interacting with the model directly in the terminal.\n\n\n\n<h2 class=\"wp-block-heading\"><strong>Optimizing Performance on Ubuntu:<\/strong><\/h2>\n\n\n\n<ul class=\"wp-block-list\">\n<li><strong>Swap Space:<\/strong>&nbsp;If you have limited RAM, configure swap space to prevent out-of-memory errors.<\/li>\n\n\n\n<li><strong>Hardware Considerations:<\/strong>&nbsp;A dedicated GPU can significantly accelerate performance.<\/li>\n\n\n\n<li><strong>Model Selection:<\/strong>&nbsp;Choose a smaller model if you have limited resources.<\/li>\n<\/ul>\n\n\n\n<h2 class=\"wp-block-heading\"><strong>Troubleshooting:<\/strong><\/h2>\n\n\n\n<ul class=\"wp-block-list\">\n<li><strong>Out of Memory Errors:<\/strong>&nbsp;Try using a smaller model or increasing your swap space.<\/li>\n\n\n\n<li><strong>Network Issues:<\/strong>&nbsp;Check your internet connection<\/li>\n<\/ul>\n\n\n\n<h2 class=\"wp-block-heading\"><strong>Conclusion:<\/strong><\/h2>\n\n\n\n<p>Installing DeepSeek-R1 on Ubuntu with Ollama provides a powerful local AI solution. By following these steps, you can harness the capabilities of this advanced LLM directly on your machine. Remember to choose a model size appropriate for your hardware and explore the possibilities of local AI development.\n","protected":false},"excerpt":{"rendered":"<p>DeepSeek-R1 is a powerful open-source large language model (LLM) designed for advanced reasoning and problem-solving. This guide shows you how to install and run DeepSeek-R1 [&#8230;]<\/p>\n","protected":false},"author":1,"featured_media":1499,"comment_status":"open","ping_status":"open","sticky":false,"template":"","format":"standard","meta":{"footnotes":""},"categories":[24],"tags":[255,21,18,66],"class_list":["post-1492","post","type-post","status-publish","format-standard","has-post-thumbnail","hentry","category-artificial-intelligence","tag-deepseek-r1","tag-ollama","tag-ubuntu","tag-ubuntu-24-04"],"amp_enabled":true,"_links":{"self":[{"href":"https:\/\/zahiralam.com\/blog\/wp-json\/wp\/v2\/posts\/1492","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/zahiralam.com\/blog\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/zahiralam.com\/blog\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/zahiralam.com\/blog\/wp-json\/wp\/v2\/users\/1"}],"replies":[{"embeddable":true,"href":"https:\/\/zahiralam.com\/blog\/wp-json\/wp\/v2\/comments?post=1492"}],"version-history":[{"count":5,"href":"https:\/\/zahiralam.com\/blog\/wp-json\/wp\/v2\/posts\/1492\/revisions"}],"predecessor-version":[{"id":1500,"href":"https:\/\/zahiralam.com\/blog\/wp-json\/wp\/v2\/posts\/1492\/revisions\/1500"}],"wp:featuredmedia":[{"embeddable":true,"href":"https:\/\/zahiralam.com\/blog\/wp-json\/wp\/v2\/media\/1499"}],"wp:attachment":[{"href":"https:\/\/zahiralam.com\/blog\/wp-json\/wp\/v2\/media?parent=1492"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/zahiralam.com\/blog\/wp-json\/wp\/v2\/categories?post=1492"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/zahiralam.com\/blog\/wp-json\/wp\/v2\/tags?post=1492"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}