Installation on linux
1. Download the installation package
cd /usr/src
wget https://studygolang.com/dl/golang/go1.13.linux-amd64.tar.gz
2. Extract the installation package
Linux from https://golang.org/dl/
downloaded tar files, and unzip it to /usr/local
.
The / usr / local / go / bin to your PATH environment variable. It should be installed in linux.
sudo tar -xzf go1.13.linux-amd64.tar.gz -C /usr/local
cd /usr/local
ll
3. Install vim
There is no check on linux vim installed
if it is not installed vim yum
yum vim
4. go new folder under / home
cd home
mkdir go
5. Configuration GOROOT
The / usr / local / go / bin directory to environment variable configuration GOROOT
sodu vim /etc/profile
export GOROOT="/usr/local/go"
export GOPATH=$HOME/go
export GOBIN=$GOROOT/bin
export PATH=$PATH:$GOBIN
Press esc -> shift +; -> wq Enter to save and exit
source profile
go version
go env
If you still can not edit it properly added to the system variable in the following file
is added to user variables, a current user to log on will load
vim /home/work/.bashrc
# .bashrc
# Source global definitions
if [ -f /etc/bashrc ]; then
. /etc/bashrc
fi
# Uncomment the following line if you don't like systemctl's auto-paging feature:
# export SYSTEMD_PAGER=
# User specific aliases and functions
export GOPATH=/home/work/go
Save and exit
source /etc/profile
或者
source $HOME/.profile
Create the following three folders in the working directory:
bin / src / pkg