Home >Backend Development >Golang >How to deploy golang project to linux server

How to deploy golang project to linux server

王林
王林Original
2020-02-15 17:50:005130browse

How to deploy golang project to linux server

Install go and configure GOPATH.

The specific method is as follows:

1. Configure the server to the same local environment, including the packages that the project depends on;

2. Copy the project source code to the server. Compile on the server

go build main.go

After compilation, the executable file main will be generated in the same directory.

3. Finally execute ./main.

If you want the project to execute in the background: execute nohup ./main &, so that the program can run in the background.

Recommended related articles and tutorials: golang tutorial

The above is the detailed content of How to deploy golang project to linux server. 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:golang installation stepsNext article:golang installation steps