Installing golang’s SDK in Debian system


Go (also known as “golang“) is the second open source programming language released by Google in 2009. Since its birth, it has several design principles: simplicity, safety and speed. The go language distribution has a variety of debugging, testing, tuning, and code review tools. Nowadays, go language and its tool chain are available in the basic repository of most Linux distributions, and can be installed with the default package manager. This paper mainly introduces how to install golang’s SDK in Debian system. Other distributions of Linux are similar to the operation here.

Software name:
Golang for windows (go language x86 MSI) 1.3.3 official free version
Software size:
Update time:
2014-10-27Download now

Software name:
Free installation of Chinese version of Debian operating system v8.2.0 AMD64 netinst
Software size:
Update time:
2016-01-18Download now

Install golang’s SDK in Debian system

1. Due to some reasons, you can’t visit golang’s official website. You can search Baidu for relevant download links

2. Choose the corresponding SDK to download according to your own needs and the version of the system. Because the demo is 64 bit Debian, choose go1.9.2.linux-amd64.0 tar.gz Download

3. After downloading, open the terminal, switch to the download directory of golang SDK, and switch to the root user (Su command)

tar -zxvf go1.9.2.linux-amd64.tar.gz -C /usr/local/

Unpack the compressed package

4. Next, open the terminal and enter the command:

gedit /etc/profile

If GEDIT is not installed, you can install it with apt get install GEDIT

Of course, you can also edit the / etc / profile file with the VI editor

vi /etc/profile

Add at the end of the file

export GOROOT=/usr/local/go

export GOPATH=/home/mingf/gopath

export PATH=$PATH:$GOROOT/bin

Configure the environment variables of go

Among them:

Go root refers to the installation directory of go

Gopath refers to the working directory of go, which can be divided by multiple colons

5. Run source / etc / profile

Enter go in the terminal to display the following interface, which means that your go SDK has been installed successfully

It can also run

Go version view the version of go

Go env view the configuration of go

6. In Debian / etc / profile, the configuration file is read as a login shell

So if you want to read every time you start, you need to modify the terminal configuration, as shown in the figure

You can also modify the. Bashrc in the user directory and add it at the end of the file

export GOROOT=/usr/local/go

export GOPATH=/home/mingf/gopath

export PATH=$PATH:$GOROOT/bin

The differences between the two methods are as follows:

Modifying the / etc / profile file will affect all users who log on to this computer

Modify ~ / bashrc file, only affect the current user

7. Restart the computer, and golang’s SDK has been installed

At the end of the tutorial, the above is all about installing golang in Debian system. I hope you can get something after reading it!

Related tutorial recommendations:

How does golang install third party packages? Installation of third party package tools in golang

How to install go language in Linux