Install Go and grpcurl on Ubuntu
With your Ubuntu terminal up, let’s get started!
The first thing is to grab the latest version from the Go download page here. You can ‘right click’ and copy the link. Then execute this command:
wget <download link>
Make sure to paste in your download link where the brackets are. Next, extract the files:
tar -xf go1.21.3.linux-amd64.tar.gz
This will create a folder named ‘go’. This next step is not always needed, but it’s good practice. It will remove any previous version installed:
sudo rm -rf /usr/local/go
Since we are going to be moving the ‘go’ folder we just extracted to a root owned folder ‘/usr/local’, we need to change it’s ownership to root.
sudo chown -R root:root ./go
Now we can move it to its new home
sudo mv -v go /usr/local
Go is now installed, but in order to run commands we need to update our profile, let’s open it up with nano and add some new lines
sudo nano /etc/profile
Then add the following at the bottom
# Go Lang Path
export GOPATH=$HOME/go
export PATH=$PATH:/usr/local/go/bin:$GOPATH/bin
Now you can either exit out of your terminal and open it back up, or you can reload your profile with
source /etc/profile
That’s it! Go is installed. To verify you can check the version by running this
go version
I also want to install grpcurl, so to do that I just need one command:
go install github.com/fullstorydev/grpcurl/cmd/grpcurl@latest
This will take sometime as it downloads and installs. To make sure everything is working you can run the ‘help’ command, you should see the help text printed
grpcurl -help
And that’s it! Congratulations, you now have Go and grpcurl installed!