Table of Contents
What you will read?
Go (Golang) is a modern, open-source programming language developed by Google. It is designed for building fast, efficient, and reliable applications, particularly in web development, cloud services, and system tools. Installing Go on Debian 13 Trixie allows developers to write, compile, and run Go programs directly on a stable Linux environment.
Step 1: Update the System
Updating your system ensures that all packages and repositories are current, preventing dependency issues during installation.
sudo apt update
sudo apt upgrade -y
Step 2: Download the Latest Go Version
To get the official Go distribution, download the latest version directly from the Go website to ensure you have all the newest features and security updates.
wget https://golang.org/dl/go1.xx.linux-amd64.tar.gz
Step 3: Extract the Go Tarball
To install Go globally, extract the downloaded tarball to /usr/local, which is the recommended location for system-wide binaries.
sudo tar -C /usr/local -xzf go1.xx.linux-amd64.tar.gz
Step 4: Set Environment Variables
To run Go commands from any terminal, add the Go binary directory to your system PATH and apply the changes for immediate use.
echo "export PATH=$PATH:/usr/local/go/bin" >> ~/.profile
source ~/.profile
Step 5: Verify Go Installation
To ensure Go is installed correctly and ready for development, check the installed version using the command line.
go version
Step 6: Test Your First Go Program
To confirm that your Go environment works properly, create and run a simple “Hello, Go!” program.
echo 'package main; import "fmt"; func main() { fmt.Println("Hello, Go!") }' > hello.go
Execute the file to verify it runs correctly.
go run hello.go
Step 7: Key Features of Go
Go offers powerful features that make it efficient, fast, and ideal for building modern applications across platforms.
go env
Step 8: Keep Go Updated
To maintain the latest features and security updates, download the newest Go tarball and repeat the extraction steps.
wget https://golang.org/dl/go1.yy.linux-amd64.tar.gz
sudo tar -C /usr/local -xzf go1.yy.linux-amd64.tar.gz
