转载

使用Gogs轻松搭建可能比GitLab更好用的Git服务平台

使用Gogs轻松搭建可能比GitLab更好用的Git服务平台

前言

GitHub已经成为首选的代码托管平台,因为它又很多很棒的功能,操作简单,几乎所有的开发者都喜欢它。但是搭建GitLab过程并没有想象中的简单,利用Bitnami当然也是一种偷懒的好选择。Gogs (Go Git Service) 是一款极易搭建的自助 Git 服务,Gogs 的目标是打造一个最简单、最快速和最轻松的方式搭建自助 Git 服务。使用 Go 语言开发使得 Gogs 能够通过独立的二进制分发,并且支持 Go 语言支持的 所有平台,包括 Linux、Mac OS X、Windows 以及 ARM 平台。

Gogs可能是比GitLab更好的选择

更新记录

2016年03月31日 - 初稿

阅读原文 - http://wsgzao.github.io/post/gogs/

扩展阅读

Gogs - https://gogs.io/

GitLab - https://about.gitlab.com/

Bitnami GitLab Stack - https://bitnami.com/stack/gitlab

Bitnami GitLab Stack

Bitnami GitLab Stack ships with the following software versions

  • GitLab 8.5.7
  • Apache 2.4.18
  • ImageMagick 6.7.5
  • PostgreSQL 9.4.6
  • Git 2.7.4
  • Ruby 2.1.8
  • Rails 4.2.5.1
  • RubyGems 1.8.12

Btinami GitLab Stack 安装真心简单,爽

chmod 755 bitnami-gitlab-8.5.7-0-linux.run

https://bitnami.com/stack/gitlab/README.txt

Gogs环境要求

我以rhel6.3为例,已经属于生命周期边缘了

#安装git
yum install -y git
git --version
git version 1.7.1

#安装mysql-server
yum install -y mysql-server
mysql --version
mysql Ver 14.14 Distrib 5.1.73, for redhat-linux-gnu (x86_64) using readline 5.1

#启动数据库
service mysqld start
chkconfig mysqld on

#创建gogs数据库
cd /home/git/gogs/scripts
#mysql -u root -p < mysql.sql
mysql -u root -p
# (输入密码,无密码直接跳过)
set global storage_engine = 'InnoDB';
create database gogs character set utf8 collate utf8_bin;
create user 'gogs'@'localhost' identified by 'gogs';
grant all privileges on gogs.* to 'gogs'@'localhost';
flush privileges;
exit;

部署Gogs

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

https://gogs.io/docs

#创建git用户
sudo adduser git
su - git

#解压gogs
cd /home/git
unzip gogs_v0.9.13_linux_amd64.zip
ls /home/git/gogs/
gogs LICENSE public README.md README_ZH.md scripts templates

#启动gogs
cd /home/git/gogs
./gogs web

2016/03/31 16:23:53 [W] Custom config '/home/git/gogs/custom/conf/app.ini' not found, ignore this if you're running first time
2016/03/31 16:23:53 [T] Custom path: /home/git/gogs/custom
2016/03/31 16:23:53 [T] Log path: /home/git/gogs/log
2016/03/31 16:23:53 [I] Gogs: Go Git Service 0.9.13.0318
2016/03/31 16:23:53 [I] Log Mode: Console(Trace)
2016/03/31 16:23:53 [I] Cache Service Enabled
2016/03/31 16:23:53 [I] Session Service Enabled
2016/03/31 16:23:53 [I] SQLite3 Supported
2016/03/31 16:23:53 [I] Run Mode: Development
2016/03/31 16:23:54 [I] Listen: http://0.0.0.0:3000

#后台运行
nohup ./gogs web &
tail -f nohup.out

app.ini配置文件

注意DOMAIN和ROOT_URL这两个参数

https://gogs.io/docs/advanced/configuration_cheat_sheet

#首次安装可以打开浏览器完成剩余配置
http://ip:3000/install

#通过修改app.ini也可以
vi /home/git/gogs/custom/conf/app.ini

APP_NAME = Gogs: Go Git Service
RUN_USER = git
RUN_MODE = prod

[database]
DB_TYPE = mysql
HOST = 127.0.0.1:3306
NAME = gogs
USER = gogs
PASSWD = gogs
SSL_MODE = disable
PATH = data/gogs.db

[repository]
ROOT = /home/git/gogs-repositories

[server]
DOMAIN = 172.28.70.134
HTTP_PORT = 3000
ROOT_URL = http://172.28.70.134:3000/
DISABLE_SSH = false
SSH_PORT = 22
OFFLINE_MODE = false

[mailer]
ENABLED = false

[service]
REGISTER_EMAIL_CONFIRM = false
ENABLE_NOTIFY_MAIL = false
DISABLE_REGISTRATION = false
ENABLE_CAPTCHA = true
REQUIRE_SIGNIN_VIEW = false

[picture]
DISABLE_GRAVATAR = false

[session]
PROVIDER = file

[log]
MODE = file
LEVEL = Info
ROOT_PATH = /home/git/gogs/log

[security]
INSTALL_LOCK = true
SECRET_KEY = i4B7R55aRaFdw8j
原文  http://wsgzao.github.io/post/gogs/
正文到此结束
Loading...