" command to install the specific version."/> " command to install the specific version.">

Home  >  Article  >  Backend Development  >  How to install golang on ubuntu

How to install golang on ubuntu

小老鼠
小老鼠Original
2023-12-19 13:21:501770browse

Installation steps: 1. Open the terminal (Ctrl Alt T); 2. Add the official repository of Go; 3. Update the package list; 4. Install Go; 5. Enter the "go version" command to verify the installation. It depends on whether it is successful or not. Detailed introduction: 1. If you want to install a specific version of Go, use the "apt show golang-go" command to view the available versions, and then use the "sudo apt install golang-go=" command to install the specific version. .

How to install golang on ubuntu

To install Go (Golang) on ​​Ubuntu, you can follow the steps below:

1. Open the terminal (Ctrl Alt T ).

2. Add Go’s official repository. Enter the following command in the terminal and press Enter:

sudo add-apt-repository ppa:longsleep/golang-backports

3. Update the package list:

sudo apt update

4. Install Go:

sudo apt install golang-go

5. Verify whether the installation is successful . Enter the following command:

go version

If the installation is successful, you will see the version information of Go.

Please note that the above steps will install the default version of Go. If you want to install a specific version of Go, use the apt show golang-go command to view the available versions, then use the following command to install the specific version:

sudo apt install golang-go=<版本号>

Replace with the one you want to install Specific version number.

After the installation is complete, you can also set Go's working environment variables. You can add the following to your ~/.bashrc or ~/.zshrc file:

export PATH=$PATH:/usr/lib/go-<版本号>/bin
export GOPATH=$HOME/go
export PATH=$PATH:$GOPATH/bin

Please replace with the Go version number you have installed.

The above is the detailed content of How to install golang on ubuntu. 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