【基础篇】dapr入门开发环境搭建

目录

 

1.安装 Hyper-V

Enable-WindowsOptionalFeature -Online -FeatureName Microsoft-Hyper-V -All

2.安装WSL2

2.1以管理员启动运行 Windows PowerShell 

PS C:\Users\Administrator> wsl --update -- 更新wsl
正在安装: 适用于 Linux 的 Windows 子系统
已安装 适用于 Linux 的 Windows 子系统。
PS C:\Users\Administrator> wsl -v -l
WSL 版本: 1.1.3.0
内核版本: 5.15.90.1
WSLg 版本: 1.0.49
MSRDC 版本: 1.2.3770
Direct3D 版本: 1.608.2-61064218
DXCore 版本: 10.0.25131.1002-220531-1700.rs-onecore-base2-hyp
Windows版本: 10.0.19045.2604
PS C:\Users\Administrator> wsl --set-default-version 2

2.2安装Ubuntu18.04

Microsoft Store 官方下载地址: https://apps.microsoft.com/store/detail/ubuntu-22042-lts/9PN20MSR04DW

注意:安装成功需要打开Ubuntu 22.04 设置新的用户和密码!

如遇到参考的对象类型不支持尝试的操作。

Error code: Wsl/Service/0x8007273d
 管理员身份启动cmd/powershell运行

 

 netsh winsock reset

就可以。

Installing, this may take a few minutes...
参考的对象类型不支持尝试的操作。
Error code: Wsl/Service/0x8007273d
参考的对象类型不支持尝试的操作。
Error code: Wsl/Service/0x8007273d
参考的对象类型不支持尝试的操作。
Error code: Wsl/Service/0x8007273d
Please create a default UNIX user account. The username does not need to match your Windows username.
For more information visit: https://aka.ms/wslusers
Enter new UNIX username: duia
参考的对象类型不支持尝试的操作。
Error code: Wsl/Service/0x8007273d
Enter new UNIX username: duia
New password:
Retype new password:
passwd: password updated successfully
Installation successful!
To run a command as administrator (user "root"), use "sudo <command>".
See "man sudo_root" for details.

Welcome to Ubuntu 22.04.1 LTS (GNU/Linux 5.15.90.1-microsoft-standard-WSL2 x86_64)

 * Documentation:  https://help.ubuntu.com
 * Management:     https://landscape.canonical.com
 * Support:        https://ubuntu.com/advantage

This message is shown once a day. To disable it please create the
/home/duia/.hushlogin file.
duia@DESKTOP-1VQ67DE:~$

 

3.安装Docker(Win10 系统)

Docker Desktop 是 Docker 在 Windows 10 和 macOS 操作系统上的官方安装方式,这个方法依然属于先在虚拟机中安装 Linux 然后再安装 Docker 的方法。

Docker Desktop 官方下载地址: https://docs.docker.com/desktop/install/windows-install/

注意:此方法仅适用于 Windows 10 操作系统专业版、企业版、教育版和部分家庭版!

注意:启动Docker可能会遇到WSL相关的问题

4.安装Dapr脚手架

Dapr官方文档地址: https://docs.dapr.io/zh-hans/getting-started/

脚本安装 :通过命令行输入以下脚本,默认会安装到 c:\dapr 目录,此种方式比较考验网络,安装不成功可以多尝试几次,实在无法成功请百度手动安装方式

powershell -Command "iwr -useb https://raw.githubusercontent.com/dapr/cli/master/install/install.ps1 | iex"

 

 

C:\Windows\system32>dapr init
Making the jump to hyperspace...
Container images will be pulled from Docker Hub
Installing runtime version 1.10.2
Downloading binaries and setting up components...
dapr_placement container exists or is running. please run `dapr uninstall` first before running `dapr init`

C:\Windows\system32>dapr -v
CLI version: 1.10.0
Runtime version: n/a

C:\Windows\system32>dapr uninstall
Removing Dapr from your machine...
Removing directory: C:\Users\Administrator\.dapr\bin
Removing container: dapr_placement
Dapr has been removed successfully

C:\Windows\system32>dapr init
Making the jump to hyperspace...
Container images will be pulled from Docker Hub
Installing runtime version 1.10.2
Downloading binaries and setting up components...
error downloading daprd binary: Get "https://github.com/dapr/dapr/releases/download/v1.10.2/daprd_windows_amd64.zip": dial tcp 20.205.243.166:443: connectex: A connection attempt failed because the connected party did not properly respond after a period of time, or established connection failed because connected host has failed to respond.

C:\Windows\system32>dapr init
Making the jump to hyperspace...
Container images will be pulled from Docker Hub
Installing runtime version 1.10.2
Downloading binaries and setting up components...
dapr_placement container exists or is running. please run `dapr uninstall` first before running `dapr init`

C:\Windows\system32>dapr -v
CLI version: 1.10.0
Runtime version: n/a 

 

z遇到这种情况乱就很难受 初始化dapr运行时始终不成功 这种情况就需要手动去github下载dapr运行时了

 

4.安装成功

1.打开Docker会多出这几个基础服务应用

2.安装程序文件路径

//dapr
C:\dapr
//本机daprd、dashboard和pubsub配置文件路径
C:\Users\Administrator\.dapr

 

 

posted @ 2023-03-11 22:13  棙九九  阅读(624)  评论(0编辑  收藏  举报