AMP AMP

How to install Go on Linux Debian 11.3

To Install Go on Linux Debian 11.3

Introduction:

Go was originally built for programs related to networking and infrastructure. It was intended to replace popular high-performance server-side languages like java and C++. Today, go is used for a variety of applications like cloud and serverside applications, DevOps, command line tools and much more.

Step 1: Check the OS version by using the below command

root@linuxhelp:~# lsb_release –a
No LSB modules are available.
Distributor ID: Debian
Description:    Debian GNU/Linux 11 (bullseye)
Release:        11
Codename:       bullseye
No LSB modules are available.

Step 2: check the IP address by using the below command

root@linuxhelp:~# ip a
1: lo: <LOOPBACK,UP,LOWER_UP> mtu 65536 qdisc noqueue state UNKNOWN group default qlen 1000
    link/loopback 00:00:00:00:00:00 brd 00:00:00:00:00:00
    inet 127.0.0.1/8 scope host lo
       valid_lft forever preferred_lft forever
    inet6 ::1/128 scope host
       valid_lft forever preferred_lft forever
2: ens33: <BROADCAST,MULTICAST,UP,LOWER_UP> mtu 1500 qdisc pfifo_fast state UP group default qlen 1000
    link/ether 00:0c:29:f2:4d:6c brd ff:ff:ff:ff:ff:ff
    altname enp2s1
    inet 192.168.6.133/23 brd 192.168.7.255 scope global noprefixroute ens33
       valid_lft forever preferred_lft forever
    inet6 fe80::b6ad:ef36:1ad2:bcbb/64 scope link noprefixroute

Step 3: Update the package by using the below command

root@linuxhelp:~# apt-get update
Hit:1 http://deb.debian.org/debian bullseye InRelease
Hit:2 http://security.debian.org/debian-security bullseye-security InRelease
Hit:3 http://deb.debian.org/debian bullseye-updates InRelease
Hit:4 https://packages.sury.org/php bullseye InRelease
Reading package lists... Done

Step 4: Download the golang package by using the below command

root@linuxhelp:~# wget -q https://storage.googleapis.com/golang/getgo/installer_linux

Step 5: Give the executable permission by using the below command

root@linuxhelp:~# chmod +x installer_linux

Step 6: Install the package by using the below command

root@linuxhelp:~# ./installer_linux
Welcome to the Go installer!
Downloading Go version go1.18.3 to /root/.go
This may take a bit of time...
Downloaded!
Setting up GOPATH
GOPATH has been set up!

Step 7: Add the go function file to the system shell scripts by using the below command

root@linuxhelp:~# source /root/.bash_profile

Step 8: check the Go version by using the below command

root@linuxhelp:~# go version
go version
go version go1.18.3 linux/amd64

Conclusion:

We have reached the end of this article. In this guide, we have walked you through the steps required to install Go on Linux Debian 11.3. Your feedback is much welcome.

FAQ
Q
5. How will you check the version of go?
A
To check the version, use the command (go version).
Q
4. How will you add the go function file and run it?
A
To add and run the go function file, use the source /root/.bash_profile command
Q
3. Which command line was used to install the package?
A
The command line used to install the package is ./installer_linux
Q
2. Which permission do we need to give?
A
Executable Permission (chmod +x installer_linux)
Q
1. How will you download the go installation package?
A
To download the go installation package use wget -q https://storage.googleapis.com/golang/getgo/installer_linux