# protoc Protocol Buffers 是一种轻便高效的结构化数据存储格式,可用于结构化数据串行化,很适合做数据存储或 RPC 数据交换格式。它可用于通讯协议、数据存储等领域的语言无关、平台无关、可扩展的序列化结构数据格式。简单的说就是干和xml一样的事,把某种数据结构的信息,以某种格式保存起来。主要用于数据存储、传输协议格式等场合。 ## Linux安装 [下载地址](https://github.com/protocolbuffers/protobuf/releases) 1、下载linux_x86_64的压缩包.zip文件 ```bash wget https://github.com/protocolbuffers/protobuf/releases/download/v3.20.0/protoc-3.20.0-linux-x86_64.zip unzip protoc-3.20.0-linux-x86_64.zip ``` 2、安装前先看看readme.txt, 学学英语 ```bash cat readme.txt Protocol Buffers - Google's data interchange format Copyright 2008 Google Inc. https://developers.google.com/protocol-buffers/ This package contains a precompiled binary version of the protocol buffer compiler (protoc). This binary is intended for users who want to use Protocol Buffers in languages other than C++ but do not want to compile protoc themselves. To install, simply place this binary somewhere in your PATH. If you intend to use the included well known types then don't forget to copy the contents of the 'include' directory somewhere as well, for example into '/usr/local/include/'. Please refer to our official github site for more installation instructions: https://github.com/protocolbuffers/protobuf ``` 3、安装 名义上是安装,实际上只是将编译好的可执行文件放入对应的位置而已,一般我习惯性的放入`/usr/local/bin` 和 `/usr/local/include` ,这样全局都可以访问到。 ```bash mv bin/protoc /usr/local/bin mv include/* /usr/local/include ``` 4、验证一下 ```bash protoc --version libprotoc 3.20.0 ```