Home >Backend Development >Golang >golang1.12 installation

golang1.12 installation

王林
王林Original
2023-05-09 21:41:39598browse

Golang is an open source programming language from Google. It is influenced by the C language, but it also adopts some features of modern programming languages. Golang has been developing particularly rapidly in recent years, and its application scope is becoming more and more extensive. In this article, we will introduce how to install Golang 1.12 in Ubuntu system.

Step 1: Install Golang 1.12

First, we need to download the binary package of Golang 1.12. You can download the latest version of the binary package from the Golang official website. We recommend using the latest version of Golang provided by the official website, because the version provided by the official website is stable and reliable.

After the download is completed, we need to extract the compressed package to our system. You can enter the following command in the terminal:

sudo tar -C /usr/local -xzf go1.12.linux-amd64.tar.gz

This command will install Golang to the /usr/local directory.

Step 2: Configure environment variables

Configuring environment variables is one of the important steps in Golang 1.12 installation. Please enter the following command in the terminal window:

sudo nano /etc/profile

A text editor will open. Add the following content at the end of the file:

export PATH=$PATH:/usr/local/go/bin

This will add the Golang 1.12 executable file path to the system environment variables.

Step 3: Update system environment variables

We need to use the following command to reload the system environment variables:

source /etc/profile

If we want to modify the environment variables without logging out or restarting the system , then you can also use the following command:

echo 'export PATH="/usr/local/go/bin:$PATH"' >> ~/.profile

Step 4: Test whether the installation is successful

Now, we have completed the installation and configuration of Golang 1.12. We can enter the following command to verify whether it has been successfully installed:

go version

This command will output the Golang version number installed in the current system:

go version go1.12 linux/amd64

This indicates that we have successfully installed and configured That’s it Golang 1.12. congratulations!

Summary:

Enter the following command in the terminal and follow the above steps to install and configure Golang1.12:

  1. Download the Golang binary package;
  2. Extract the binary package to the /usr/local directory;
  3. Add the environment variable path at the end of the /etc/profile file;
  4. Reload the system environment variables.

I hope this article is detailed enough for beginners and provides you with some help in successfully installing Golang 1.12.

The above is the detailed content of golang1.12 installation. For more information, please follow other related articles on the PHP Chinese website!

Statement:
The content of this article is voluntarily contributed by netizens, and the copyright belongs to the original author. This site does not assume corresponding legal responsibility. If you find any content suspected of plagiarism or infringement, please contact admin@php.cn
Previous article:Does golang support xp?Next article:Does golang support xp?