Dart+GRPC Ubuntu环境安装和测试

GRPC Dart Ubuntu

  • 下载dart sdk 2.10压缩包(国内访问不到)

    官方地址:https://storage.googleapis.com/dart-archive/channels/stable/release/2.10.4/sdk/dartsdk-linux-x64-release.zip
    我的地址:https://download.csdn.net/download/HumorChen99/13646501
    
  • 解压、添加到环境里去

    unzip dartsdk-linux-x64-release.zip
    cd dart-sdk\bin
    pwd
    #把pwd显示的目录加入到path,例如我的显示的是/root/dart-sdk/bin
    echo 'export PATH=$PATH:/root/dart-sdk/bin' >> /etc/profile
    #生效
    source /etc/profile
    #测试
    dart --version
    
  • 更换pub源为清华源

    echo 'export PUB_HOSTED_URL="https://mirrors.tuna.tsinghua.edu.cn/dart-pub"' >> ~/.bashrc
    source ~/.bashrc
    
  • 安装apt-transport-https

    apt update
    apt-get install apt-transport-https -y
    
  • 安装proto编译器protoc

    apt install protobuf-compiler -y
    #查看
    protoc --version
    
  • 安装dart插件protoc_plugin

    pub global activate protoc_plugin
    echo 'export PATH=$PATH:/root/.pub-cache/bin' >> /etc/profile
    source /etc/profile
    
  • 下载示范项目并运行

    git clone https://github.com/grpc/grpc-dart
    cd grpc-dart/example/helloworld
    #获取依赖包
    pub get
    dart bin/server.dart
    dart bin/client.dart
    

在这里插入图片描述

posted @ 2020-12-11 18:37  HumorChen99  阅读(1)  评论(0编辑  收藏  举报  来源