How to Install Go on Ubuntu 22.04

Hey! If you love Go and building Go apps as much as I do, let's connect on Twitter or LinkedIn. I talk about this stuff all the time!

Want to learn how to build better Go applications faster and easier? You can.

Check out my course on the Go Standard Library. You can check it out now for free.


In this article, we will guide you through the process of installing Go on your Ubuntu 22.04 system. This tutorial is designed for beginners who are new to Linux and want to learn how to install Go. We will cover all the necessary steps, including checking the system requirements, downloading the installer, and running the installation script.




Step 1: Check System Requirements

Before installing Go, make sure your system meets the following requirements:

  • Operating System: Ubuntu 22.04 (64-bit)
  • Processor: x86_64 or ARMv7 or ARMv8 processor
  • Memory: 1 GB of RAM (RAM may vary depending on the application you are building)
  • Storage: At least 5 GB of free disk space

Step 2: Download the Installer

Navigate to the official Go website and download the latest version of Go for your operating system. Make sure to choose the 64-bit installer, as this will ensure compatibility with most modern systems.

Once the download is complete, navigate to the directory where the installer was saved and run it using the command:

./go1.18.linux-amd64.tar.gz

This command will extract the files from the tarball and create a folder called go in your current directory.

Step 3: Add Go to Your PATH Environment Variable

To make sure that Go is available on your system, you need to add it to your PATH environment variable. Open the terminal and run the following command:

echo "export PATH=$PATH:/usr/local/go/bin" >> ~/.profile

This command will append the PATH environment variable with the path to the Go binary executable.

Step 4: Install Dependencies

Go requires a few dependencies to be installed on your system before you can start building applications. Run the following commands in your terminal to install these dependencies:

sudo apt-get update
sudo apt-get upgrade

These commands will update and upgrade your Ubuntu packages, including the dependencies required by Go.

Step 5: Start a New Terminal Session

After installing the dependencies, start a new terminal session to ensure that all changes are applied correctly.

Step 6: Verify Installation

To verify that Go has been installed successfully, run the following command in your terminal:

go version

This command will print out the version of Go you have installed on your system. If everything is working correctly, you should see a message similar to this:

go version go1.18 linux/amd64

Congratulations! You have successfully installed Go on Ubuntu 22.04. You can now start building your own applications using Go.

Conclusion

In this article, we have covered all the steps required to install Go on your Ubuntu 22.04 system. We have also provided a brief overview of the dependencies required by Go and how to verify that it has been installed correctly. We hope this tutorial has been helpful in installing Go on your system and getting started with building applications using Go.


Questions or comments? Reach out to me


Learn how to leverage the Go Standard Library like a PRO.

I just created a new course, The Go Standard Library, check it out!