Skip to main content

How to Install Go (Golang) on Linux: Step-by-Step Guide

HardReset.InfoJanuary 12, 20266 min67 views
2 connections·4 entities in this video→

Downloading and Extracting Go

  • πŸ’‘ Go (Golang) is a programming language that will be installed on the Linux system.
  • πŸš€ The official Linux tar.gz archive is downloaded from go.dev.
  • πŸ“‚ The downloaded archive is extracted to the /usr/local directory using the sudo tar -xzf command.

Configuring Go Environment Variables

  • πŸ› οΈ The ~/.bashrc file is edited to configure the Go environment.
  • πŸ”— The PATH is updated to include /usr/local/go/bin.
  • πŸ“¦ The GOPATH is set to ~/go and its bin directory is also added to the PATH.
  • πŸ”„ The shell configuration is reloaded using source ~/.bashrc.

Verifying the Installation

  • βœ… The Go installation is verified by checking the version with go version, which should display Go 1.22.5.

Running a Simple Go Program

  • πŸ“ A workspace directory is created, and a main.go file is written with a basic "hello world" program.
  • πŸ’» The program is executed using go run main.go, and the output "hello world" confirms the successful installation.
Knowledge graph4 entities Β· 2 connections

How they connect

An interactive map of every person, idea, and reference from this conversation. Hover to trace connections, click to explore.

Hover Β· drag to explore
4 entities
Chapters2 moments

Key Moments

Transcript22 segments

Full Transcript

Topics11 themes

What’s Discussed

Go (Golang)LinuxInstall GoGolang InstallationGo PATHBashrcTerminal CommandsProgramming LanguageHello World Programtar.gzUser Local Directory
Smart Objects4 Β· 2 links
ConceptsΒ· 4