Home > Backend Development > Golang > How to install golang version 1.6 on Linux

How to install golang version 1.6 on Linux

PHPz
Release: 2023-04-18 09:37:36
Original
716 people have browsed it

Over the past few years, Go has become a popular programming language, praised for its simplicity, speed of execution, and concurrency. The latest version of the Go language is 1.16. In this article, we will discuss how to install golang version 1.6 on Linux.

Preparation

Before starting the installation, we need to make sure we are using a 64-bit version of Linux system. We can check the bitness of our system with the following command:

uname -m
Copy after login

If the result is "x86_64", it means we are on a 64-bit system. If the result is "i386" or "i686", it means we are on a 32-bit system and golang 1.6 cannot be installed.

Install golang 1.6

  1. Download golang 1.6

You can download any version of golang from golang’s official website. We will download the Linux (64-bit) zip file of golang 1.6.16.

Use the following command to download golang 1.6:

wget https://storage.googleapis.com/golang/go1.6.16.linux-amd64.tar.gz
Copy after login
  1. Install golang 1.6

After the download is completed, we need to install golang 1.6 into the system. We install it in the /usr/local directory for global use.

Use the following command to create a directory named go, and then extract the downloaded golang 1.6 into the directory:

sudo mkdir /usr/local/go
sudo tar -xvf go1.6.16.linux-amd64.tar.gz -C /usr/local/go
Copy after login
  1. Configure environment variables

We need to set the two environment variables GOROOT and GOPATH so that the operating system can find golang 1.6.

Open the ~/.bashrc file using the following command:

sudo nano ~/.bashrc
Copy after login

Add the following line at the end of the file:

export GOROOT=/usr/local/go
export GOPATH=$HOME/go
export PATH=$GOPATH/bin:$GOROOT/bin:$PATH
Copy after login

Save the file and close it.

  1. Reload environment variables

Use the following command to reload environment variables:

source ~/.bashrc
Copy after login
  1. Check golang 1.6

Use the following command to check whether golang 1.6 is installed successfully:

go version
Copy after login

If golang 1.6 is installed successfully, you will see the following output:

go version go1.6.16 linux/amd64
Copy after login

Conclusion

Now we have succeeded Installed golang 1.6. You can start developing projects using golang 1.6 and enjoy the performance and concurrency benefits it brings.

The above is the detailed content of How to install golang version 1.6 on Linux. For more information, please follow other related articles on the PHP Chinese website!

Statement of this Website
The content of this article is voluntarily contributed by netizens, and the copyright belongs to the original author. This site does not assume corresponding legal responsibility. If you find any content suspected of plagiarism or infringement, please contact admin@php.cn
Popular Tutorials
More>
Latest Downloads
More>
Web Effects
Website Source Code
Website Materials
Front End Template