关于golang:安装Go语言支持及Gogs版本管理工具

8次阅读

共计 1928 个字符,预计需要花费 5 分钟才能阅读完成。

装置 Go 语言反对及 Gogs 版本管理工具

1. GO 语言:

1.1 介绍

1.1.1 官网介绍:

The Go programming language is an open source project to make programmers more productive.

Go is expressive, concise, clean, and efficient. Its concurrency mechanisms make it easy to write programs that get the most out of multicore and networked machines, while its novel type system enables flexible and modular program construction. Go compiles quickly to machine code yet has the convenience of garbage collection and the power of run-time reflection. It’s a fast, statically typed, compiled language that feels like a dynamically typed, interpreted language.

1.1.2 简略说:

Go 是 Google 家的一门速度快,体验好的新语言。能够在不损失应用程序性能的状况下升高代码的复杂性。

因为专门针对多处理器零碎应用程序的编程进行了优化,Go 程序在速度上能够媲美 C 或 C++,而且平安、反对并行。

1.2 装置

1.2.1 下载:

官网

官网下载

官网文档

因为我的服务器是 Ubuntu 的,所以我抉择的是 go1.9.2.linux-amd64.tar.gz 这个包。

1.2.2 装置:

装置相当简略,间接下载到安装包后解压到 /usr/local/go 目录下就行了:

sudo tar -C /usr/local/ -zxvf go1.9.2.linux-amd64.tar.gz

文件到位后关上 /etc/profile 加点环境变量进去:

# /etc/profile

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

使配置失效:

source /etc/profile

接着间接在 shell 中打 go version 应该就能够看见输入的版本号了:

$ go version
go1.9.2 linux/amd64

到此,GO 语言的环境就装置好了。接下来是 Gogs.

2. Gogs

2.1 介绍

2.1.1 官网介绍

一款极易搭建的自助 Git 服务。

2.1.2 简略说:

Gogs 是个极轻的基于 Git 的版本控制工具,相似于 Github, Gitlab.

然而相比他们要轻量很多,用块 Raspberry Pi 甚至 NAS 主机都能跑。

所谓的:易装置 + 跨平台 + 轻量级

我的项目所有的源代码均通过 MIT 受权协定 托管在 GitHub 上。 收费应用!

到目前为止曾经 2w 多 Stars 了,可见一斑。

2.2 装置:

2.2.1 下载:

间接官网下载:(国人产品,是中文的官网)

中文官网

官网下载

在线体验

2.2.2 装置:

将下载好的 linux_amd64-gogs.zip 文件解压。并搁置到你想要放的中央,比如说 /www/gogs

而后依据你本人的需要,对它进行配置,默认配置文件 conf/app.ini 不要改它,在程序目录下创立新文件 custom/conf/app.ini 并批改相应的配置项就会主动笼罩掉默认的配置了。

付上 官网配置手册

程序自身提供了多种部署和启动的形式,这里咱们抉择最简略的:间接运行:

创立 run_gogs 脚本,写入以下内容:

nohup /www/gogs/gogs web &

而后运行 sh ./run_gogs 即可。

如果你须要也能够应用像 supervisor 去治理它:

官网参考配置

[program:gogs]
directory=/www/gogs/
command=/www/gogs/gogs web
autostart=true
autorestart=true
startsecs=10
stdout_logfile=/var/log/gogs/stdout.log
stdout_logfile_maxbytes=1MB
stdout_logfile_backups=10
stdout_capture_maxbytes=1MB
stderr_logfile=/var/log/gogs/stderr.log
stderr_logfile_maxbytes=1MB
stderr_logfile_backups=10
stderr_capture_maxbytes=1MB
user = git
environment = HOME="/home/git", USER="git"
正文完
 0