官网链接安装
安装基础依赖
sudo apt update
sudo apt install -y build-essential autoconf libtool pkg-config
安装 Protobuf
sudo apt install -y protobuf-compiler
protoc --version # 确认安装成功,应该显示版本号
# 下载源码
git clone -b v25.1 --depth 1 https://github.com/protocolbuffers/protobuf.git
cd protobuf
# 配置、编译并安装
./configure
make -j$(nproc)
make check
sudo make install
sudo ldconfig # 更新共享库缓存
cd ..
安装 gRPC
# 下载gRPC源码
git clone -b v1.58.0 --depth 1 https://github.com/grpc/grpc.git
cd grpc
git submodule update --init
# 编译并安装
mkdir -p cmake/build
cd cmake/build
cmake -DgRPC_INSTALL=ON \
-DgRPC_BUILD_TESTS=OFF \
-DCMAKE_INSTALL_PREFIX=/usr/local \
../..
make -j$(nproc)
sudo make install
cd ../../../