How To Install Go (Golang) on Ubuntu 25.04

What is Go (Golang)?

Go, commonly known as Golang, is a modern, efficient programming language developed by Google.
It is famous for its clean syntax, fast compilation, concurrent programming with Goroutines, and strong cross-platform support.
Go is highly suitable for web development, cloud services, and system programming.

Steps to Install Go (Golang) on Ubuntu 25.04

Update System Packages

First, update the system package list:

apt update

Install Go

Ubuntu 25.04 includes a version of Go in its default repositories. Install it using:

apt install golang -y

This installs the default Go version available for Ubuntu 25.04.

Verify Go Installation

After installation, confirm Go is properly installed:

go version

Output:

root@server:~# go version
go version go1.24.2 linux/amd64

Set Up Your Go Workspace (Optional)

Go modules are now standard, but you can still set up a GOPATH workspace if you prefer.

Edit your shell profile (e.g., ~/.bashrc):

nano ~/.bashrc

Add these lines at the end:

export GOPATH=$HOME/go
export PATH=$PATH:$GOPATH/bin

Reload your profile to apply changes:

source ~/.bashrc

Test Go with a Simple Program

Create a new file called hello.go:

nano hello.go

Paste this simple Go program:

package main

import "fmt"

func main() {
    fmt.Println("Hello, Golang!")
}

Save and exit.

Run the program:

go run hello.go

Output:

root@ubuntu25:~# go run hello.go
Hello, Golang!

🎉 Congratulations! You have successfully installed and tested Go on Ubuntu 25.04.


CrownCloud - Get a SSD powered KVM VPS at $4.5/month!
Use the code WELCOME for 10% off!

1 GB RAM / 25 GB SSD / 1 CPU Core / 1 TB Bandwidth per month

Available Locations: LAX | MIA | ATL | FRA | AMS