How To Install golang-grpc-gateway on Ubuntu 18.04

In this tutorial we learn how to install golang-grpc-gateway on Ubuntu 18.04. golang-grpc-gateway is gRPC to JSON proxy generator for Golang – binaries

Introduction

In this tutorial we learn how to install golang-grpc-gateway on Ubuntu 18.04.

What is golang-grpc-gateway

golang-grpc-gateway is:

Grpc-gateway is a protoc plugin that reads gRPC service definitions and generates a reverse-proxy server which translates a RESTful JSON API into gRPC. The server is generated according to custom options in your gRPC definition and helps you to provide your APIs in both gRPC and RESTful style at the same time.

This package contains the generator binaries.

There are three methods to install golang-grpc-gateway on Ubuntu 18.04. We can use apt-get, apt and aptitude. In the following sections we will describe each method. You can choose one of them.

Install golang-grpc-gateway Using apt-get

Update apt database with apt-get using the following command.

sudo apt-get update

After updating apt database, We can install golang-grpc-gateway using apt-get by running the following command:

sudo apt-get -y install golang-grpc-gateway

Install golang-grpc-gateway Using apt

Update apt database with apt using the following command.

sudo apt update

After updating apt database, We can install golang-grpc-gateway using apt by running the following command:

sudo apt -y install golang-grpc-gateway

Install golang-grpc-gateway Using aptitude

If you want to follow this method, you might need to install aptitude first since aptitude is usually not installed by default on Ubuntu. Update apt database with aptitude using the following command.

sudo aptitude update

After updating apt database, We can install golang-grpc-gateway using aptitude by running the following command:

sudo aptitude -y install golang-grpc-gateway

How To Uninstall golang-grpc-gateway on Ubuntu 18.04

To uninstall only the golang-grpc-gateway package we can use the following command:

sudo apt-get remove golang-grpc-gateway

Uninstall golang-grpc-gateway And Its Dependencies

To uninstall golang-grpc-gateway and its dependencies that are no longer needed by Ubuntu 18.04, we can use the command below:

sudo apt-get -y autoremove golang-grpc-gateway

Remove golang-grpc-gateway Configurations and Data

To remove golang-grpc-gateway configuration and data from Ubuntu 18.04 we can use the following command:

sudo apt-get -y purge golang-grpc-gateway

Remove golang-grpc-gateway configuration, data, and all of its dependencies

We can use the following command to remove golang-grpc-gateway configurations, data and all of its dependencies, we can use the following command:

sudo apt-get -y autoremove --purge golang-grpc-gateway

References

Summary

In this tutorial we learn how to install golang-grpc-gateway package on Ubuntu 18.04 using different package management tools: apt, apt-get and aptitude.