Install GNMI client in Centos or Red Hat Linux

I have two options:

  • gnmi_get / gnmi_set (less preferred for me)
  • gnmic (preferred and much easier install)

gnmi_get / gnmi_set installation

Some notes how to quickly Install GNMI client (gnmi_get) in Centos or Red Hat Linux. You can get more info at

I ran into a couple of issues, check last section for troubleshooting ideas.

Install go

If you have go, skip this section

cd ~
curl -O
tar -xvf go1.16.5.linux-amd64.tar.gz
mv go /usr/local/.

Now, add GOPATH and GOBIN to your path in .bash_profile

[root ~]# cat .bash_profile
# .bash_profile

# Get the aliases and functions
if [ -f ~/.bashrc ]; then
    . ~/.bashrc

# User specific environment and startup programs


export PATH
export GOROOT
export GOBIN
[root ~]# source .bash_profile

Check it

[root ~]# go version
go version go1.16.5 linux/amd64

Install GNMI client

go get
cd /usr/local/go/src/
go install ./...
cd $GOPATH/bin
chmod 755 ./../src/

Test it

[root ~]# gnmi_get
F0607 14:59:18.862111  125755 credentials.go:138] Please provide a -target_name

And you’re good to go!

Install gnmic

Also, you have the option of gnmic (preferred). The installation is very simple:

bash -c "$(curl -sL"


I got some issues with the paths for go after executing ‘go get’. I couldn’t find the github src folder. Something wrong with my GOROOT and GOPATH env variables: “warning: GOPATH set to GOROOT (/usr/local/go) has no effect”

Then I went to the path were I called it and found this:

cd ~/go/pkg/mod/

What I did after to fix was:

mkdir -p /usr/local/go/src/
mv gnxi\@v0.0.0-20210423111716-4b504ef806a7 /usr/local/go/src/
cd /usr/local/go/src/
go install ./...

## and the rest stay the same like above...

See ya!

Leave a Reply