Announcement

Collapse
No announcement yet.

How to Install Go on Ubuntu 24.04

Collapse
X
Collapse
  •  

  • How to Install Go on Ubuntu 24.04


    Golang (Go) is a programming language provided by Google to help developers create scalable and secure systems. Its simplicity makes any developer want to learn the language and use it quickly.

    While Go is a go-to programming language for many developers, you must first install it on Ubuntu 24.04 before you begin using it for your development. We’ve covered three installation methods that anyone can use. Read on!

    Three Methods of Installing Go on Ubuntu 24.04

    The Go programming language has numerous applications, and as a Ubuntu user, you have three methods for installing Go. You can source it from the snap store or install it from the Ubuntu repository using APT. Still, you can download the Go tarball, extract it, and add its path to make it accessible on your system. All these methods are discussed below.

    Method 1: Install Go on Ubuntu 24.04 Via APT

    The first step in this method is to update the Ubuntu 24.04 repository. The Go version installed with this method is stable but not always the latest available version.

    Let’s first update the system.

    $ sudo apt update




    Next, use APT to install the Go package.

    $ sudo apt install golang-go




    Once the installation process is completed, view the installed Golang version.

    $ go version




    Method 2: Install Go Via Snap

    Even on Ubuntu 24.04 (Noble Numbat), you can access the Snap Store and install Snap packages. Go is available as a Snap package, and installing it via this approach will install even its dependencies.

    Here, you only need to execute the below command.

    $ sudo snap install go --classic




    Similarly, we can check the installed Go version.

    $ go version




    Notice how the two methods install the same Go version, which is the latest version when writing this post.

    Method 3: Install Go Via Its Official Repository

    The official way of installing Go on any Linux distribution is by sourcing its binary package. However, this is a long method as more steps are involved, but if you want the latest version or a specific Go version, this method is the best.

    The first step is to update the system.

    $ sudo apt update




    Next, visit the Go download page and find the version you want to install. Ensure you select the appropriate architecture for compatibility. We’ve chosen version 1.22.2 for this example.

    Once you’ve selected it, download the tarball using any utility. We’ve used wget for our example.

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




    Allow the download to complete. The next step involves extracting the archive file. We’ve extracted it to the /usr/local/ directory using the tar command below.

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

    $ ls /usr/local/go


    We’ve also run the ls command to confirm that the file was successfully unzipped and the new uncompressed Go folder containing all the required files exist.



    So far, we have the Go folder on our system, but we must add its binary to the path environment variable before we start using Go system-wide. Using a text editor, we will edit our bashrc to add the Go binary.

    Let’s open the file using the nano text editor.

    $ nano ~/.bashrc


    Next, paste the below line inside the file.

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




    Save the changes and exit the file. Also, source the file for the changes to apply.

    $ source ~/.bashrc




    Lastly, check the installed version.

    $ go version




    Test the Go Language

    Now that we’ve installed the Go programming language, we can use it for our development. Let’s create a simple ‘hello’ program to test that Go works correctly. Save it with a .go extension.



    Save the file and run it using the below syntax.

    $ go run program_name




    That’s it! The output confirms that Go is successfully installed on Ubuntu 24.04.

    Conclusion

    Go is a recent programming language developed by Google. Ubuntu supports Go and there are three ways you can install it. You can install it via APT or snap. Moreover, you can install it by downloading its official repository and adding its binary to your environment variable. Have fun using Go on Ubuntu 24.04.





    More...
      Posting comments is disabled.

    Categories

    Collapse

    Article Tags

    Collapse

    There are no tags yet.

    Latest Articles

    Collapse

    • Harnessing Quantum Potential: Quantum Computing and Qiskit on Ubuntu
      by Kasimba



      by George Whittaker


      Introduction

      Quantum computing, a revolutionary paradigm, promises to solve problems that are computationally infeasible for classical systems. By leveraging the peculiar principles of quantum mechanics—superposition, entanglement, and quantum interference—quantum computing has emerged as a transformative force across industries. From cryptography and drug discovery to optimization and...
      Today, 06:22 PM
    • Using MAXQDA for Qualitative Data Analysis on Linux
      by Kasimba



      by George Whittaker


      Introduction

      Qualitative data analysis (QDA) is a cornerstone of research across various fields, from social sciences to marketing. It involves uncovering patterns, themes, and meanings within non-numerical data such as interviews, focus groups, and textual narratives. In this era of digital tools, MAXQDA stands out as a premier software solution for QDA, empowering researchers to organize...
      11-21-2024, 11:31 PM
    • HAProxy on Ubuntu: Load Balancing and Failover for Resilient Infrastructure
      by Kasimba



      by german.suarez


      Introduction

      In today’s fast-paced digital landscape, ensuring the availability and performance of applications is paramount. Modern infrastructures require robust solutions to distribute traffic efficiently and maintain service availability even in the face of server failures. Enter HAProxy, the de facto standard for high-performance load balancing and failover.


      This article...
      11-21-2024, 03:00 PM
    • Providing a license for package sources
      by Kasimba
      Arch Linux hasn't had a license for any package sources (such as PKGBUILD files) in the past, which is potentially problematic. Providing a license will preempt that uncertainty.

      In RFC 40 we agreed to change all package sources to be licensed under the very liberal 0BSD license. This change will not limit what you can do with package sources. Check out the RFC for more on the rationale and prior discussion.

      Before we make this change, we will provide contributors with...
      11-19-2024, 09:21 AM
    • Linux Binary Analysis for Reverse Engineering and Vulnerability Discovery
      by Kasimba



      by George Whittaker


      Introduction

      In the world of cybersecurity and software development, binary analysis holds a unique place. It is the art of examining compiled programs to understand their functionality, identify vulnerabilities, or debug issues—without access to the original source code. For Linux, which dominates servers, embedded systems, and even personal computing, the skill of binary analysis is...
      11-18-2024, 07:10 PM
    • Ubuntu vs Debian: Linux Distributions Compared Deep Dive
      by Kasimba
      Debian and Ubuntu are two popular Linux distributions. In this deep dive we will guide you on the key differences between them from perspective of both corporate enterprise and personal productivity or pleasure usage. After reading this blog post you should be in a better position to decide to select Ubuntu or Debian.
      Stewardship, Licensing, Community and Cost

      Where as Debian is 100% fully committed to free software as defined by the Debian Free Software Guidelines, Ubuntu is created...
      11-17-2024, 08:30 PM
    Working...
    X