一、修改默认源

先安装 vim

sudo apt-get update
sudo apt-get install vim -y

将源修改为aliyun提供的源

sudo vim /etc/apt/sources.list
//注释掉原来的源
//然后添加以下源
deb http://mirrors.aliyun.com/raspbian/raspbian/ stretch main non-free contrib rpi
deb-src http://mirrors.aliyun.com/raspbian/raspbian/ stretch main non-free contrib rpi

:wq保存

#deb http://raspbian.raspberrypi.org/raspbian/ buster main contrib non-free rpi
# Uncomment line below then 'apt-get update' to enable 'apt-get source'
#deb-src http://raspbian.raspberrypi.org/raspbian/ buster main contrib non-free rpi
deb http://mirrors.aliyun.com/raspbian/raspbian/ stretch main non-free contrib rpi
deb-src http://mirrors.aliyun.com/raspbian/raspbian/ stretch main non-free contrib rpi

保存过后就可以直接更新了

sudo apt-get upgrade -y

二、下载arm版本的二进制包

三、GO语言的安装

下载好了之后就可以进行安装,跳到下载目录。

sudo tar -C /usr/local -zvxf go1.14.6.linux-armv6l.tar.gz

然后修改下环境变量,这里我就偷懒直接修改系统的

sudo vim /etc/profile
//在文件末尾添加如下内容
export PATH=$PATH:/usr/local/go/bin

然后重启树莓派

sudo reboot
//不重启也行,使用source 命令应用修改
source /etc/profile

到这里GO就安装好了。