Network Security Internet Technology Development Database Servers Mobile Phone Android Software Apple Software Computer Software News IT Information

In addition to Weibo, there is also WeChat

Please pay attention

WeChat public account

Shulou

How to deploy and set up GO in CentOS7

2025-01-16 Update From: SLTechnology News&Howtos shulou NAV: SLTechnology News&Howtos > Servers >

Share

Shulou(Shulou.com)06/01 Report--

This article is about how to deploy and setup GO in CentOS 7. Xiaobian thinks it is quite practical, so share it with everyone for reference. Let's follow Xiaobian and have a look.

About gRPC

gRPC is a high-performance, open-source and generic RPC framework designed for mobile and HTTP/2. Currently available in C, Java and Go languages: grpc, grpc-java, grpc-go. The C version supports C, C++, Node.js, Python, Ruby, Objective-C, PHP and C#.

gRPC is designed based on the HTTP/2 standard and brings features such as bi-directional streaming, flow control, header compression, multiplexed requests over a single TCP connection, etc. These features make it perform better on mobile devices, saving more power and space.

Each process can call each other through gRPC, as shown below:

environmental information

Operating System: CentOS Linux release 7.9.2009

Go Version: 1.15.6

About account and permissions

In order to approach the production environment, the operation in this article does not use the root account, but a new account golang. When creating a new account, use the root account to operate. The steps are as follows:

The account and group name I use here is golang. Use the root account to perform the following operations:

groupadd golang && useradd -d /home/golang -g golang -m golang

Execute the command passwd golang to set the password for the golang account;

Also give the golang account sudo permissions, execute the following command, so that the configuration file can be written:

chmod 777 /etc/sudoers

Next edit/etc/sudoers, add the contents in the red box below, and save to exit:

Remove writeable permissions from configuration files:

chmod 440 /etc/sudoers

At this point, the new account golang has been created, and the following operations will use this account;

Rapid deployment and configuration golang

Download, decompress, set up, if you find these operations tedious, the following operations will let you worry about some:

Update application:

sudo yum update -y

Install apps you'll use later:

sudo yum install unzip tree wget -y

Execute the following command to complete all deployment work:

curl -o install-go.sh \https://raw.githubusercontent.com/zq2599/blog_demos/master/files/install-go.sh \&& chmod a+x ./ install-go.sh \&& ./ install-go.sh

After executing the above command, the console will output something similar to the following. It can be seen that the hello.go file can be successfully executed, indicating that the go environment is successfully deployed, and the output environment variables are also normal:

... 5. create go source filepackage mainimport "fmt"func main() { fmt.Println("Hello world! ")}6. run hello.goHello world! go1.15.6 install and check finished

The script install-go.sh in the above command mainly reads as follows:

Thank you for reading! About "how to deploy and set GO in CentOS7" this article is shared here, I hope the above content can be of some help to everyone, so that everyone can learn more knowledge, if you think the article is good, you can share it to let more people see it!

Welcome to subscribe "Shulou Technology Information " to get latest news, interesting things and hot topics in the IT industry, and controls the hottest and latest Internet news, technology news and IT industry trends.

Views: 0

*The comments in the above article only represent the author's personal views and do not represent the views and positions of this website. If you have more insights, please feel free to contribute and share.

Share To

Servers

Wechat

© 2024 shulou.com SLNews company. All rights reserved.

12
Report