> 文章列表 > ubuntu下安装配置grpc

ubuntu下安装配置grpc

ubuntu下安装配置grpc

目录

1.准备环境

 2.安装protobuf

3.安装cares库

3.安装grpc-1.17.x


1.准备环境

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

如下为我本机gcc版本

 2.安装protobuf

wget https://github.com/protocolbuffers/protobuf/releases/download/v3.6.1/protobuf-cpp-3.6.1.tar.gztar xzvf protobuf-cpp-3.6.1.tar.gz
cd protobuf-cpp-3.6.1
./autogen.sh
make
sudo make install
sudo ldconfig
//查看版本
protoc --version

3.安装cares库

https://github.com/c-ares/c-ares/releases
tar -zxvf c-ares-cares-1_19_0.tar.gz 
cmake .
make 
sudo make install

3.安装grpc-1.17.x

unzip grpc-1.17.x.zip
cd grpc-1.17.x/
make
sudo make install
cd examples/cpp/
cd helloworld/
make

默认安装位置为/usr/local/

 ./greeter_server 

 ./greeter_client