gitlab分为gitlab-ce和gitlab-ee,gitlab-ce可以免费使用,因此此处用的是gitlab-ce。

    安装gitlab有三种方法:源码编译安装、获取gitlab的apt镜像源然后使用apt-get安装、下载安装包后使用dpkg安装。

    其中源码编译官方也不推荐,并且使用官方提供好的安装包也比较简单方便,这里不对源码编译安装做说明。

1、获取gitlab的apt镜像源然后使用apt-get安装:

1
2
3
4
5
6
7
8
apt-get install curl openssh-server ca-certificates postfix -y
curl -s https://packages.gitlab.com/install/repositories/gitlab/gitlab-ce/script.deb.sh | sudo bash
apt-get update
apt-get install -y gitlab-ce     安装最新的gitlab-ce版本  或
apt-get install -y gitlab-ce==8.11.3   安装8.11.3版本的gitlab-ce
安装完成后安装提示进行配置、启动就行了。
gitlab-ctl reconfigure
gitlab-ctl start


2、下载安装包后使用dpkg安装:

https://packages.gitlab.com/gitlab/gitlab-ce 从此处下载所需要的gitlab包,下载完成后直接使用下面命令安装即可:

1
2
3
4
5
apt-get install curl openssh-server ca-certificates postfix -y
dpkg -i gitlab-ce-XXX.deb
安装完成后安装提示进行配置、启动就行了。
gitlab-ctl reconfigure
gitlab-ctl start


至于,需要对gitlab进行个性化配置,请参考官方文档。

https://docs.gitlab.com/omnibus/README.html