Logo
  • Ubuntu
  • CentOS
  • Debian
  • Fedora
  • RedHat

How to Install GO on Debian 11 - DesignLinux

Dec 06 2022
designlinux 0 Comments
how-to-install-go-on-debian-11

Go is a modern open source programming language developed by Google Developers. Go, often referred to as golang. Many popular applications such as, Kubernetes, Terraform, Rancher, Docker, etc. are written in Go language. In this tutorial described how to install Go on Debian 11.

How to Install GO on Debian 11#

Follow the below steps to download and install Go on Debian 11:

Step 1 – Download GO#

At the time of writing this article, latest stable version of Go is version 1.19.3. You can check latest version of Go Download page.

You can download Go tarball using wget or curl:

wget https://dl.google.com/go/go1.19.3.linux-amd64.tar.gz

Now, you should verify the tarball using below command:

sha256sum go1.19.3.linux-amd64.tar.gz

It should display output as below:

27d356e2a0b30d9983b60a788cf225da5f914066b37a6b4f69d457ba55a626ff go1.19.3.linux-amd64.tar.gz

Make sure the output should exact match with the hash value provided at the Go download page.

Step 2 – Exract File#

After that, extract the downloaded tarball using following command inside /usr/local directory. Ensure that you should run below command as a root or user with sudo privileges:

sudo tar -C /usr/local -xzf go1.19.3.linux-amd64.tar.gz

Step 3 – Setting Go Path Variable#

Set path environment variable in order to find Go executable binaries by system. For that we need to open /.bash_profile using below command:

sudo nano ~/.bash_profile

Now add the below lines to it:

export PATH=$PATH:/usr/local/go/bin:$GOPATH/bin

Save and close the file. After that run below command to reload running profile:

source ~/.bash_profile

That’s it. At this point, Go has been installed on your CentOS system.

Step 4 – Verify Installation#

You can verify the Go installation by Go version command:

go version

Output should look like this:

go version go1.19.3 linux/amd64

Step 4 – Verify Installation#

To test GO is properly installed, you can create a simple Hello World program which will print “Hello World” message. Follow below steps to build simple program.

First of all, create a workspace directory for Go. You can get more details about go workspace directory visit this page:

mkdir ~/go

Next, create a src directory inside it using below command:

mkdir -p ~/go/src/hello

In this directory create a file named hello.go and add below content to it:

sudo nano ~/go/src/hello/hello.go
package main

import "fmt"

func main() {
    fmt.Printf("Hello, World\n")
}

Now go back /go/src/hello to build the file and issue go build command:

cd ~/go/src/hello
go build

The above command will build an executable file with name hello.

You can run the program using executable using following command:

./hello
Hello, World

Conclusion#

You successfully learn how to install GO on Debian 11 system. If you have any queries feel free to comment below.

Related

Tags: debian, go

How to Install and Configure Fail2ban on Ubuntu 22.04

Prev Post

How to Find Linux OS Name and Kernel Version You Are Running

Next Post
Archives
  • January 2023
  • December 2022
  • November 2022
  • October 2022
  • September 2022
  • July 2022
  • June 2022
  • April 2022
  • March 2022
  • February 2022
  • January 2022
  • December 2021
  • November 2021
  • October 2021
  • September 2021
  • August 2021
  • July 2021
  • June 2021
  • May 2021
  • April 2021
  • March 2021
  • February 2021
  • January 2021
  • December 2020
  • November 2020
  • October 2020
  • September 2020
  • August 2020
  • July 2020
  • June 2020
  • May 2020
Categories
  • AlmaLinux
  • Android
  • Ansible
  • Apache
  • Arch Linux
  • AWS
  • Backups
  • Bash Shell
  • Bodhi Linux
  • CentOS
  • CentOS Stream
  • Chef
  • Cloud Software
  • CMS
  • Commandline Tools
  • Control Panels
  • CouchDB
  • Data Recovery Tools
  • Databases
  • Debian
  • Deepin Linux
  • Desktops
  • Development Tools
  • Docker
  • Download Managers
  • Drupal
  • Editors
  • Elementary OS
  • Encryption Tools
  • Fedora
  • Firewalls
  • FreeBSD
  • FTP
  • GIMP
  • Git
  • Hadoop
  • HAProxy
  • Java
  • Jenkins
  • Joomla
  • Kali Linux
  • KDE
  • Kubernetes
  • KVM
  • Laravel
  • Let's Encrypt
  • LFCA
  • Linux Certifications
  • Linux Commands
  • Linux Desktop
  • Linux Distros
  • Linux IDE
  • Linux Mint
  • Linux Talks
  • Lubuntu
  • LXC
  • Mail Server
  • Manjaro
  • MariaDB
  • MongoDB
  • Monitoring Tools
  • MySQL
  • Network
  • Networking Commands
  • NFS
  • Nginx
  • Nodejs
  • NTP
  • Open Source
  • OpenSUSE
  • Oracle Linux
  • Package Managers
  • Pentoo
  • PHP
  • Podman
  • Postfix Mail Server
  • PostgreSQL
  • Python
  • Questions
  • RedHat
  • Redis Server
  • Rocky Linux
  • Security
  • Shell Scripting
  • SQLite
  • SSH
  • Storage
  • Suse
  • Terminals
  • Text Editors
  • Top Tools
  • Torrent Clients
  • Tutorial
  • Ubuntu
  • Udemy Courses
  • Uncategorized
  • VirtualBox
  • Virtualization
  • VMware
  • VPN
  • VSCode Editor
  • Web Browsers
  • Web Design
  • Web Hosting
  • Web Servers
  • Webmin
  • Windows
  • Windows Subsystem
  • WordPress
  • Zabbix
  • Zentyal
  • Zorin OS
Visits
  • 0
  • 485
  • 1,055,257

DesignLinux.com © All rights reserved

Go to mobile version