# How to Install Go on Debian 12

Introduction

Go, or Golang, is a relatively new, open-source language created by Google. Its purpose is to streamline software development and enable users to create simple and reliable apps.

As a modern language, Go offers memory allocation, concurrency support, garbage collection, coordination avoidance, etc.

**This article explains how to install Go on Debian 12 in a few simple steps.**

<figure class="aligncenter size-full" id="bkmrk-">[![how-to-install-go-on-debian.webp](https://doc.vainsta.fr/uploads/images/gallery/2024-12/scaled-1680-/YDMOkWeG64yoomKt-how-to-install-go-on-debian.webp)](https://doc.vainsta.fr/uploads/images/gallery/2024-12/YDMOkWeG64yoomKt-how-to-install-go-on-debian.webp)

</figure>Prerequisites

- Debian system (this tutorial uses Debian 12).
- A sudo user.
- Access to the command line.

## How to Install Go on Debian 12

Before starting the installation, ensure the Debian server is up to date. Update the repository with the following:

```
sudo apt update -y
```

<div class="wp-block-image" id="bkmrk--1"><figure class="aligncenter size-full">[![sudo-apt-update-y-terminal-output.webp](https://doc.vainsta.fr/uploads/images/gallery/2024-12/scaled-1680-/vFHPe8oI1b4X8YOY-sudo-apt-update-y-terminal-output.webp)](https://doc.vainsta.fr/uploads/images/gallery/2024-12/vFHPe8oI1b4X8YOY-sudo-apt-update-y-terminal-output.webp)

</figure></div>### Step 1: Download Go

To start the installation process:

1\. Visit the Go downloads page.

2\. Click the Linux box under **Featured downloads** to start the download.

<div class="wp-block-image" id="bkmrk--2"><figure class="aligncenter size-full">[![download-go-from-the-website.webp](https://doc.vainsta.fr/uploads/images/gallery/2024-12/scaled-1680-/MA7tDlg1dyjU4dEA-download-go-from-the-website.webp)](https://doc.vainsta.fr/uploads/images/gallery/2024-12/MA7tDlg1dyjU4dEA-download-go-from-the-website.webp)

</figure></div><p class="callout info">**Note:** Use wget or curl to download Go without accessing the browser.</p>

### Step 2: Extract Files

Extract files to the */usr/local* directory. To do that, take the following steps:

1\. Navigate to **Downloads** using the cd command:

```
cd ~/Downloads
```

<figure class="aligncenter size-full" id="bkmrk--3">[![cd-downloads-terminal-output.webp](https://doc.vainsta.fr/uploads/images/gallery/2024-12/scaled-1680-/bjGGJZi0Iw2s5i4w-cd-downloads-terminal-output.webp)](https://doc.vainsta.fr/uploads/images/gallery/2024-12/bjGGJZi0Iw2s5i4w-cd-downloads-terminal-output.webp)

</figure>2\. Run the following command to extract files:

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

<figure class="aligncenter size-full" id="bkmrk--4">[![sudo-tar-terminal-output.webp](https://doc.vainsta.fr/uploads/images/gallery/2024-12/scaled-1680-/zbfYSX7dtiFCw9Gj-sudo-tar-terminal-output.webp)](https://doc.vainsta.fr/uploads/images/gallery/2024-12/zbfYSX7dtiFCw9Gj-sudo-tar-terminal-output.webp)

</figure>The command doesn't print any output. However, tar extracts the specified file (*go1.19.2.linux-amd64.tar.gz*) to the desired directory.

### Step 3: Set the Environment

To set the environment variable, add */usr/local/go/bin* to PATH.

Take the following steps:

1\. Access *.profile* in Vim or another text editor.

```
vim .profile
```

2\. At the end of the file, paste the following lines:

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

export GOPATH=$HOME/go

export PATH=$PATH:$GOPATH/bin
```

<div class="wp-block-image" id="bkmrk--5"><figure class="aligncenter size-full">[![vim-profile-terminal-output.webp](https://doc.vainsta.fr/uploads/images/gallery/2024-12/scaled-1680-/UsJyXbwmiEuuw1VD-vim-profile-terminal-output.webp)](https://doc.vainsta.fr/uploads/images/gallery/2024-12/UsJyXbwmiEuuw1VD-vim-profile-terminal-output.webp)

</figure></div>3\. Save and close the file.

4\. Reload your shell configuration to apply the changes with:

```
source ~/.profile
```

The command has no output.

<p class="callout info">**Note:** To install Go system-wide, edit */etc/profile*. To install it for the current user, access *$HOME/.profile*.</p>