surroundings:
- Ubuntu 18 installed in VMware 15.5.1
installation
-
Terminal execution command
sudo apt-get install golang
-
After the installation is complete, you can check the version number, here the latest version is installed by default
-
Configure environment variables, execute and
sudo gedit /etc/profile
add the following code to the end of the /etc/profile file (you can also add it to the ~/.bashrc file)export GOPATH=/home/GO_PATH //用于go的工作目录 export GOROOT=/usr/lib/go-1.10 //安装目录 PATH=$GOROOT/bin:$PATH
Each person's installation directory may be different, so change it appropriately.
Then take effectsource /etc/profile . /etc/profile
-
Whether the test is successful
go env