1.download:Releases · protocolbuffers/protobuf · GitHub
2.解压到合适的目录
tar -zxvf protobuf-all-3.16.3.tar.gz
3.进入解压目录
cd protobuf-3.16.3
4.检测安装环境是否满足条件,生成Makefile
./configure --prefix=/usr/local/protobuf
5.编译 安装
make && make install
6.配置环境变量
cd ~
vim .bash_profile
export PROTOBUF=/usr/local/protobuf
export PATH=$PROTOBUF/bin:$PATH
7.激活环境变量使其生效
source .bash_profile
8.查看是否安装成功
protoc --version