Home > Article > Backend Development > How to install golang version 1.6 on Linux
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
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
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
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
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
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
Save the file and close it.
Use the following command to reload environment variables:
source ~/.bashrc
Use the following command to check whether golang 1.6 is installed successfully:
go version
If golang 1.6 is installed successfully, you will see the following output:
go version go1.6.16 linux/amd64
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!