Install Go locale on Ubuntu16

Version Information###

Operating system: Ubuntu 16.04.5 LTS (Server version, 64-bit)
Go version: 1.11

installation###

  1. Download the Go installation package, address: https://dl.google.com/go/go1.11.linux-amd64.tar.gz
  2. Copy the downloaded go1.11.linux-amd64.tar.gz file to Ubuntu's /usr/local directory, execute the decompression command tar -zxvf go1.11.linux-amd64.tar.gz, and find /usr/local There is a go directory under the directory, which is the decompressed folder;
  3. Support global commands: open the /etc/profile file with vi, add a line at the end, the content is export PATH=$PATH:/usr/local/go/bin;
  4. Make the configuration effective: source /etc/profile;
  5. Enter go version verification, you can see the content go version go1.11 linux/amd64, the installation is successful;

Set up workspace###

The go environment has been installed, and we will create multiple go application projects in the future. If these projects are only placed in the /usr/local/go directory, it is obviously inappropriate. How can they be placed in other directories and still compile normally? Run it? This is to set up the workspace, which is the GOPATH environment variable;

  1. Create the folder /usr/local/go_workspace, we use this folder as the workspace;
  2. Open the ~/.bash_profile file with vi and add a line at the end with the content export GOPATH=/usr/local/go_workspace;
  3. Make the global command effective: source ~/.bash_profile;

verification###

  1. Create the folder /usr/local/go_workspace/src/hello/;
  2. Create a hello.go file in the /usr/local/go_workspace/src/hello/ directory with the following content:
package main

import"fmt"

func main(){
  fmt.Printf("hello, world\n")}
  1. Verify direct operation: In the /usr/local/go_workspace/src/hello/ directory, execute the command go run hello.go, you can successfully execute:
root@docker:/usr/local/go_workspace/src/hello# go run hello.go
hello, world
  1. Verify the compilation and build: In the /usr/local/go_workspace/src/hello/ directory, execute the command go build, after the execution, there is an additional hello file in the current directory, as shown in the red box in the following figure:

Running this file has the same effect as go run hello.go;

  1. Verify install: In the /usr/local/go_workspace/src/hello/ directory, execute the command go install. After execution, there is an additional bin folder in the /usr/local/go_workspace/ directory, and there is a hello file in it, as shown in the figure below Show:

Running this file has the same effect as go run hello.go;

At this point, the Go language environment is set up under the Ubuntu16 environment, let's experience this popular language together!

Recommended Posts

Install Go locale on Ubuntu16
How to install Go on Ubuntu 20.04
How to install Go 1.6 on Ubuntu 16.04
How to install Go on Ubuntu 18.04
install vscode on ubuntu18
Install Redis on Ubuntu
Install R4 on ubuntu20
Install nvtop on Ubuntu 18.04
Install postgresql-10 on Ubuntu 18.04
Install docker on Ubuntu
Install Docker on ubuntu18.04
Install nodejs10 on Ubuntu16
Install Django on ubuntu
Install Pytorch+CUDA on Ubuntu 16.04
Install Python3 on Ubuntu 14.04
Install rJava on Ubuntu18
Install Python3 on Ubuntu 16.04
Install KDE on Ubuntu16.04.2
Install Docker on Ubuntu18
Install Python3.7 on Ubuntu
Install flashplayer on Ubuntu
Docker practice (1): install Docker on Ubuntu 16.04
Install ubuntu on virtual machine
Install OpenSSL 1.0.2 on Ubuntu Server 14.04
Install QQ robot on Ubuntu 16.04
Install Python 3.7 on Ubuntu 18.04 LTS
Install scrapy framework on ubuntu
Install Mysql offline on Ubuntu
Install Oracle Java8 on Ubuntu
Install Odoo 11 stack on Ubuntu 16.04
Install common software on Ubuntu 16.04
Install non-portable QQ on ubuntu
Install Docker on Ubuntu 18.04 offline
How to install Ruby on Ubuntu 20.04
How to install Memcached on Ubuntu 20.04
How to install Java on Ubuntu 20.04
How to install MySQL on Ubuntu 20.04
How to install VirtualBox on Ubuntu 20.04
How to install Elasticsearch on Ubuntu 20.04
Install Tenda u12 driver on Ubuntu
How to install Nginx on Ubuntu 20.04
How to install Apache on Ubuntu 20.04
How to install Git on Ubuntu 20.04
How to install Node.js on Ubuntu 16.04
How to install MySQL on Ubuntu 20.04
Install and configure MySQL on Ubuntu
How to install Vagrant on Ubuntu 20.04
How to install Go on CentOS 8
Install botan2 encryption library on ubuntu
How to install PostgreSQL on Ubuntu 16.04
How to install Git on Ubuntu 20.04
How to install Memcached on Ubuntu 18.04
How to install Jenkins on Ubuntu 16.04
Docker ubuntu: install python-PIL-image environment on 14.04
How to install MemSQL on Ubuntu 14.04
How to install MongoDB on Ubuntu 16.04
How to install Mailpile on Ubuntu 14.04
How to install Skype on Ubuntu 20.04
How to install Jenkins on Ubuntu 20.04
How to install Python 3.8 on Ubuntu 18.04
How to install KVM on Ubuntu 18.04