Powershell Install deepseek

发布于:2025-02-26 ⋅ 阅读:(13) ⋅ 点赞:(0)

 前言

deepseekAI助手。它具有聊天机器人功能,可以与用户进行自然语言交互,回答问题、提供建议和帮助解决问题。DeepSeek 的特点包括:

  1. 强大的语言理解能力:能够理解和生成自然语言,与用户进行流畅的对话。
  2. 多领域知识:涵盖科技、文化、历史等多个领域的知识,能够回答各种类型的问题。
  3. 持续学习:系统会不断学习和优化,提高回答的准确性和相关性。
  4. 安全隐私:注重用户数据的安全和隐私保护,遵守相关法律法规。

DeepSeek 旨在通过先进的人工智能技术,为用户提供高效、便捷的服务,提升工作和生活的效率。

前提条件,允许执行脚本

  • 开启wmi,配置网卡,参考 
  • 或者执行执行set-executionpolicy remotesigned -Confirm:$false -Force

创建一键部署deepseek自动化脚本

powershell-install-deepseek.ps1
<# Powershell Install deepseek
+++++++++++++++++++++++++++++++++++++++++++++++++++++
+  _____                       _____ _          _ _ +
+ |  __ \                     / ____| |        | | |+
+ | |__) |____      _____ _ _| (___ | |__   ___| | |+
+ |  ___/ _ \ \ /\ / / _ \ '__\___ \| '_ \ / _ \ | |+
+ | |  | (_) \ V  V /  __/ |  ____) | | | |  __/ | |+
+ |_|   \___/ \_/\_/ \___|_| |_____/|_| |_|\___|_|_|+
+ +++++++++++++++++++++++++++++++++++++++++++++++++++
                                                                                                              
# Powershell Install deepseek
# .\powershell-install-deepseek.ps1

# ollama download
https://ollama.com/download/windows
https://ollama.com/download/mac
https://ollama.com/download/linux
https://github.com/ollama/ollama/releases

#deepseek Models
https://ollama.com/library

# deepseek images
https://ollama.com/search
https://ollama.com/library/deepseek-r1

# download chatboxai
https://chatboxai.app/zh#download

# ollama install
https://ollama.cadn.net.cn/windows.html

# nssm download
https://nssm.cc/release/

#ollama Variable 
ollama help serve
https://github.com/ollama/ollama/blob/main/docs/faq.md
#>

$drive="c:"
$system_site="C:\Program Files"

# ollama environment variable
$ollama_url="https://github.com/ollama/ollama/releases/download/v0.5.11/"
$ollama_zip="ollama-windows-amd64.zip"
$ollama_new="ollama"
$ollama_models="models"
$ollama_port='11434'

# deepseek environment variable
$deepseek_r1_models="1.5b"

# nssm environment variable
$nssm_url="https://nssm.cc/release/"
$nssm_zip="nssm-2.24.zip"
$nssm_catalogue="nssm-2.24"
$nssm_new="nssm"

function Install-ollama {
    if (-not (Get-Command ollama -ErrorAction SilentlyContinue)) {
        if ($?) {
			
Write-Host "download ollama" -ForegroundColor Green
Invoke-WebRequest -Uri $ollama_url\$ollama_zip -OutFile "$drive\$ollama_zip"

Write-Host "Create a directory ollama models" -ForegroundColor Green
New-Item -ItemType Directory -Path "$drive\$ollama_new\$ollama_models" -Force

Write-Host "Unzip the ollama installation file" -ForegroundColor Green
Expand-Archive -Path $drive\$ollama_zip -DestinationPath $drive\$ollama_new

Write-Host "download nssm" -ForegroundColor Green
Invoke-WebRequest -Uri $nssm_url\$nssm_zip -OutFile $drive\$nssm_zip

Write-Host "unzip nssm" -ForegroundColor Green
Expand-Archive -Path $drive\$nssm_zip -DestinationPath $system_site -Force
Rename-Item -Path $system_site\$nssm_catalogue -NewName $nssm_new

Write-Host "ollama nssm system path" -ForegroundColor Green
$env:path += ";$drive\$ollama_new"
$env:path += ";$drive\$ollama_new\$ollama_models"
$env:path += ";$system_site\$nssm_new\win64"
setx PATH $env:path /M
setx /M OLLAMA_HOST "0.0.0.0"
setx /M OLLAMA_ORIGINS "*"
setx /M OLLAMA_MODELS "$drive\$ollama_new\$ollama_models"

Write-Host "creation ollama server" -ForegroundColor Green
nssm install $ollama_new "$drive\$ollama_new\ollama.exe" serve
Start-Service $ollama_new

Write-Host "Viewing ollama the installation Directory" -ForegroundColor Green
where.exe ollama

Write-Host "check ollama version" -ForegroundColor Green
ollama --version

Write-Host "download deepseek model" -ForegroundColor Green
ollama run deepseek-r1:$deepseek_r1_models

Write-Host "firewall ollama port" -ForegroundColor Green
New-NetFirewallRule -DisplayName "$ollama_new" -Direction Outbound -profile any -LocalPort $ollama_port -Protocol TCP -Action Allow
New-NetFirewallRule -DisplayName "$ollama_new" -Direction Inbound -profile any -LocalPort $ollama_port -Protocol TCP -Action Allow

Write-Host "delete ollama nssm" -ForegroundColor Green
Remove-Item $drive\$ollama_zip, $drive\$nssm_zip -recurse

      Write-Host "The ollama Install Success..." -ForegroundColor Green
        } else {
            Write-Host "The ollama Install Failed..." -ForegroundColor Red
            exit 1
        }
    } else {
        Write-Host "The ollama Install already..." -ForegroundColor Yellow
    }
}

function Main {
    Install-ollama
}

Main

执行一键安装deepseek

.\powershell-install-deepseek.ps1

自动化部署输出结果展示

chatbox 连接deepseek

  • chatbox 下载,有很多的你也可以尝试使用其它的方式接入
  • 模型提供方ollama api
  • api 域名你的主机IP和端口
  • 模型,你部署的模型选择

ollama api访问接口测试

  • 正式环境不要对外开放

与deepseek ai 对话