Ubuntu 安装 Golang

surroundings:

  • Ubuntu 18 installed in VMware 15.5.1

installation

  • Terminal execution command

    sudo apt-get install golang
    

    Insert picture description here

  • After the installation is complete, you can check the version number, here the latest version is installed by default
    Insert picture description here

  • Configure environment variables, execute and sudo gedit /etc/profileadd 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.
    ![Insert picture description here](https://img-blog.csdnimg.cn/20200520102653700.png
    Insert picture description here
    Then take effect

    source /etc/profile
    . /etc/profile
    
  • Whether the test is successful

    go env
    

    Insert picture description here

Guess you like

Origin blog.csdn.net/weixin_41822224/article/details/106229627