" command to install the specific version."> How to install golang on ubuntu_How to install golang on ubuntu-Golang-php.cn

How to install golang on ubuntu

小老鼠
Release: 2023-12-19 13:21:50
Original
1644 people have browsed it

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
Copy after login

3. Update the package list:

sudo apt update
Copy after login

4. Install Go:

sudo apt install golang-go
Copy after login

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

go version
Copy after login

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=<版本号>
Copy after login

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
Copy after login

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!

Related labels:
source:php.cn
Statement of this Website
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
Latest Downloads
More>
Web Effects
Website Source Code
Website Materials
Front End Template
About us Disclaimer Sitemap
php.cn:Public welfare online PHP training,Help PHP learners grow quickly!