我要评分
获取效率
正确性
完整性
易理解

Installing Protobuf

CentOS

  1. Install Protobuf.
    1
    yum install -y protobuf protobuf-devel
    
  2. Check whether Protobuf is installed successfully.
    1
    protoc --version
    

    The installation is successful if information similar to the following is displayed:

  3. Deploy Protoc in the local Maven repository.
    1
    mvn install:install-file -DgroupId=com.google.protobuf -DartifactId=protoc -Dversion=2.5.0 -Dclassifier=linux-aarch_64 -Dpackaging=exe -Dfile=/usr/bin/protoc
    

openEuler

  1. Download and decompress the source code.
    1
    2
    wget https://github.com/protocolbuffers/protobuf/releases/download/v2.5.0/protobuf-2.5.0.tar.gz
    tar -zxf protobuf-2.5.0.tar.gz
    
  2. Move the decompressed directory to the /opt/tools/installed/ directory.
    1
    mv protobuf-2.5.0 /opt/tools/installed/
    
  3. Go to the /opt/tools/installed/ directory.
    1
    cd /opt/tools/installed
    
  4. Download the protoc.zip package and decompress it to obtain the protoc.patch file whose storage path can be specified.
    1
    2
    3
    wget https://mirrors.huaweicloud.com/kunpeng/archive/kunpeng_solution/bigdata/Patch/protoc.zip
    unzip protoc.zip
    cp ./protoc/protoc.patch ./protobuf-2.5.0/src/google/protobuf/stubs/
    
  5. Go to the protobuf-2.5.0/src/google/protobuf/stubs/ directory and install the patch.
    1
    2
    cd protobuf-2.5.0/src/google/protobuf/stubs/
    patch -p1 < protoc.patch
    
  6. Go back to the root directory of protobuf-2.5.0, compile the file, and install it in the default directory.
    1
    2
    cd /opt/tools/installed/protobuf-2.5.0
    ./autogen.sh && ./configure CFLAGS='-fsigned-char' && make -j8 && make install
    
  7. Deploy Protoc in the local Maven repository.
    1
    mvn install:install-file -DgroupId=com.google.protobuf -DartifactId=protoc -Dversion=2.5.0 -Dclassifier=linux-aarch_64 -Dpackaging=exe -Dfile=/usr/local/bin/protoc