ubuntu 安装grpc

概述

– 资料

ubuntu下安装配置grpc_ubuntu安装grpc_hsy12342611的博客-CSDN博客

安装

–准备环境(安装gcc那些)

sudo apt-get install pkg-config

sudo apt-get install autoconf automake libtool make g++ unzip

sudo apt-get install libgflags-dev libgtest-dev

sudo apt-get install clang libc+±dev

– 安装protobuf

– 安装cares库

https://github.com/c-ares/c-ares/releases

tar -zxvf c-ares-cares-1_19_0.tar.gz

mkdir build

cd build

cmake …

make

sudo make install


ps: 头文件默认安装在: /usr/local/include

lib文件默认安装在: /usr/local/lib

详细细节查看 make install 时候的日志

– 安装grpc

gRPC下载编译和安装——Linux/Windows_grpc安装linux_real沛林的博客-CSDN博客

gRPC编译和安装——Linux版_grpc linux安装编译_ooMelloo的博客-CSDN博客

  • 下载:

    • git链接: https://github.com/grpc/grpc

      git clone https://github.com/grpc/grpc.git

      cd grpc

      git submodule update --init

      git submodule update --init --recursive //确保库下载完全


      ps:上面的若确认以及下载完成,就不用继续后面的动作了

      cd third_party

      git submodule update --init --recursive

      • 如果速度慢,手动到third_party 下载如下:

        git clone https://github.com/abseil/abseil-cpp.git

        git clone https://github.com/google/benchmark

        git clone https://github.com/google/bloaty.git

        git clone https://github.com/google/boringssl.git

        git clone https://github.com/c-ares/c-ares.git

        git clone https://github.com/envoyproxy/data-plane-api.git

        git clone https://github.com/googleapis/googleapis.git

        git clone https://github.com/google/googletest.git

        git clone https://github.com/census-instrumentation/opencensus-proto.git

        git clone https://github.com/protocolbuffers/protobuf.git

        git clone https://github.com/google/re2.git

        git clone https://github.com/cncf/xds.git

        git clone https://github.com/madler/zlib

    • gitee链接:git clone https://github.com/grpc/grpc

      git clone https://gitee.com/mirrors/grpc-framework grpc

      cd grpc

      cat .gitmodules // 查看文件里的submodule, 将GitHub改成Gitee

      git submodule update --init

  • 编译

    cd grpc

    mkdir build

    cd build
    cmake -DCMAKE_INSTALL_PREFIX=/usr/local … // 指定安装路径 , 通常不需要,其默认安装在/usr/local/include和lib中

    make -j2

    sudo make install

你可能感兴趣的:(ubuntu环境部署,ubuntu,linux,运维)