Installing Go 1.23.2 on WSL 2 Ubuntu in Windows 11

Programmer TeloProgrammer Telo
2 min read

Introduction

Go (also known as Golang) is a powerful, statically typed, compiled programming language designed for simplicity and efficiency. This article will guide you through the steps to install Go version 1.23.2 on WSL 2 (Windows Subsystem for Linux) using Ubuntu on Windows 11.

Prerequisites

  1. WSL 2 Installed: Ensure you have WSL 2 installed on your Windows 11 machine. If you haven't set it up yet, follow the steps outlined in this YouTube video to install WSL 2 and configure Ubuntu.

  2. Basic Linux Commands: Familiarity with basic terminal commands will be helpful.

Steps to Install Go 1.23.2

1. Open WSL Terminal

Launch your WSL 2 Ubuntu terminal from the Start menu or by searching for "Ubuntu" in the Windows search bar.

2. Download Go 1.23.2

Use the wget command to download the Go 1.23.2 binary for Linux AMD 64 architecture. You can find the official downloads at golang.org/dl. Run the following command in your terminal:

wget https://go.dev/dl/go1.23.2.linux-amd64.tar.gz

3. Extract the Downloaded Archive

Once the download is complete, extract the tarball using the following command:

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

This will extract Go into the /usr/local directory.

4. Set Up Environment Variables

To make Go accessible from any terminal session, you'll need to set up your environment variables. Open your .bashrc file in a text editor:

nano ~/.bashrc

Add the following lines at the end of the file:

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

Save the file and exit (in nano, you can save and exit by pressing CTRL + X, then Y, and then Enter).

5. Apply the Changes

To apply the changes made to the .bashrc file, run the following command:

source ~/.bashrc

6. Verify the Installation

To ensure Go is installed correctly, check the version by running:

go version

You should see an output similar to:

go version go1.23.2 linux/arm64

Conclusion

You have successfully installed Go 1.23.2 on WSL 2 Ubuntu in Windows 11! You can now start building Go applications on your machine. For further resources and documentation, visit the official Go documentation.

References

0
Subscribe to my newsletter

Read articles from Programmer Telo directly inside your inbox. Subscribe to the newsletter, and don't miss out.

Written by

Programmer Telo
Programmer Telo