利用 Docker 快速搭建 git 仓库 Gitlab 与代码审阅 Gerrit 平台

大多数程序猿都用过全球最大的git托管平台Github,上面有丰富的开源项目。在Github上托管开源项目是免费的,但是私有项目需要收取管理费。对于拥有云服务器的开发者或者团队,可以使用本文介绍的Gitlab平台。 话不多说,我们来看看具体的步骤。

系统环境:腾讯云服务器,配置1核心2G内存,系统Centos7.2

Step1:初始化服务器环境

1、设置系统Swap。根据gitlab官方的介绍,硬件建议使用双核4G内存的配置。本文主要介绍安装和配置方法,选用的是单核2G内存的机器,为了提高系统的响应,设置2G大小的Swap。设置过程简略,参考连接 https://www.digitalocean.com/community/tutorials/how-to-add-swap-on-centos-6 设置完成后运行,可以看到swap设置成功。

<pre class="prism-token token language-javascript" style="box-sizing: border-box; list-style: inherit; margin: 24px 0px; font-style: normal; font-variant: normal; font-weight: 400; font-stretch: normal; font-size: 14px; font-family: Consolas, "Liberation Mono", Menlo, Courier, monospace; padding: 16px; overflow: auto; line-height: 1.45; background-color: rgb(247, 247, 247); border-radius: 3px; word-wrap: normal; text-align: left; white-space: pre; word-spacing: 0px; word-break: normal; tab-size: 2; hyphens: none; color: rgb(51, 51, 51); letter-spacing: normal; orphans: 2; text-indent: 0px; text-transform: none; widows: 2; -webkit-text-stroke-width: 0px; text-decoration-style: initial; text-decoration-color: initial;">[root@VM_26_11_centos ~]# free -m
total used free shared buff/cache available
Mem: 1840 88 83 8 1668 1589
Swap: 2047 0 2047
</pre>

2、安装Nginx 为了使所有流量走80端口,本文使用Nginx做反向代理。 Nginx在Centos官方的源中是没有这个软件包的,需要运行

<pre class="prism-token token language-javascript" style="box-sizing: border-box; list-style: inherit; margin: 24px 0px; font-style: normal; font-variant: normal; font-weight: 400; font-stretch: normal; font-size: 14px; font-family: Consolas, "Liberation Mono", Menlo, Courier, monospace; padding: 16px; overflow: auto; line-height: 1.45; background-color: rgb(247, 247, 247); border-radius: 3px; word-wrap: normal; text-align: left; white-space: pre; word-spacing: 0px; word-break: normal; tab-size: 2; hyphens: none; color: rgb(51, 51, 51); letter-spacing: normal; orphans: 2; text-indent: 0px; text-transform: none; widows: 2; -webkit-text-stroke-width: 0px; text-decoration-style: initial; text-decoration-color: initial;">yum install epel-release
</pre>

添加EPEL源,腾讯云的Centos上已经包含了EPEL源,直接运行

<pre class="prism-token token language-javascript" style="box-sizing: border-box; list-style: inherit; margin: 24px 0px; font-style: normal; font-variant: normal; font-weight: 400; font-stretch: normal; font-size: 14px; font-family: Consolas, "Liberation Mono", Menlo, Courier, monospace; padding: 16px; overflow: auto; line-height: 1.45; background-color: rgb(247, 247, 247); border-radius: 3px; word-wrap: normal; text-align: left; white-space: pre; word-spacing: 0px; word-break: normal; tab-size: 2; hyphens: none; color: rgb(51, 51, 51); letter-spacing: normal; orphans: 2; text-indent: 0px; text-transform: none; widows: 2; -webkit-text-stroke-width: 0px; text-decoration-style: initial; text-decoration-color: initial;">[root@VM_26_11_centos ~]# yum install nginx
</pre>

即可安装 这里需要注意的是腾讯云在云服务器的控制台这里配置了安全组策略,默认的linux安全策略组没有打开80端口,需要手动添加80端口的规则。

<figure style="box-sizing: border-box; list-style: inherit; margin: 20px 0px; display: block; text-align: center; color: rgb(51, 51, 51); font-family: PingFangSC-Light, "hiragino sans gb", "helvetica neue", "microsoft yahei ui", "microsoft yahei", simsun, arial, sans-serif; font-size: 16px; font-style: normal; font-variant-ligatures: normal; font-variant-caps: normal; font-weight: 400; letter-spacing: normal; orphans: 2; text-indent: 0px; text-transform: none; white-space: pre-wrap; widows: 2; word-spacing: 0px; -webkit-text-stroke-width: 0px; text-decoration-style: initial; text-decoration-color: initial;">

image

</figure>

2、安装docker centos7安装docker非常方便,直接运行

<pre class="prism-token token language-javascript" style="box-sizing: border-box; list-style: inherit; margin: 24px 0px; font-style: normal; font-variant: normal; font-weight: 400; font-stretch: normal; font-size: 14px; font-family: Consolas, "Liberation Mono", Menlo, Courier, monospace; padding: 16px; overflow: auto; line-height: 1.45; background-color: rgb(247, 247, 247); border-radius: 3px; word-wrap: normal; text-align: left; white-space: pre; word-spacing: 0px; word-break: normal; tab-size: 2; hyphens: none; color: rgb(51, 51, 51); letter-spacing: normal; orphans: 2; text-indent: 0px; text-transform: none; widows: 2; -webkit-text-stroke-width: 0px; text-decoration-style: initial; text-decoration-color: initial;">[root@VM_26_11_centos ~]# yum install docker -y
</pre>

3、启动docker

<pre class="prism-token token language-javascript" style="box-sizing: border-box; list-style: inherit; margin: 24px 0px; font-style: normal; font-variant: normal; font-weight: 400; font-stretch: normal; font-size: 14px; font-family: Consolas, "Liberation Mono", Menlo, Courier, monospace; padding: 16px; overflow: auto; line-height: 1.45; background-color: rgb(247, 247, 247); border-radius: 3px; word-wrap: normal; text-align: left; white-space: pre; word-spacing: 0px; word-break: normal; tab-size: 2; hyphens: none; color: rgb(51, 51, 51); letter-spacing: normal; orphans: 2; text-indent: 0px; text-transform: none; widows: 2; -webkit-text-stroke-width: 0px; text-decoration-style: initial; text-decoration-color: initial;">[root@VM_26_11_centos ~]# systemctl start docker.service
[root@VM_26_11_centos ~]# docker ps -a
CONTAINER ID IMAGE COMMAND CREATED STATUS PORTS NAMES
</pre>

目前docker服务还没有任何容器 4、更新docker镜像源 由于docker的镜像服务器在国外,直接拉取镜像的时候速度非常慢。有很多国内的docker镜像,本文以daocloud.io为例,在daocloud注册后,会得到一个更新镜像源的命令:

<pre class="prism-token token language-javascript" style="box-sizing: border-box; list-style: inherit; margin: 24px 0px; font-style: normal; font-variant: normal; font-weight: 400; font-stretch: normal; font-size: 14px; font-family: Consolas, "Liberation Mono", Menlo, Courier, monospace; padding: 16px; overflow: auto; line-height: 1.45; background-color: rgb(247, 247, 247); border-radius: 3px; word-wrap: normal; text-align: left; white-space: pre; word-spacing: 0px; word-break: normal; tab-size: 2; hyphens: none; color: rgb(51, 51, 51); letter-spacing: normal; orphans: 2; text-indent: 0px; text-transform: none; widows: 2; -webkit-text-stroke-width: 0px; text-decoration-style: initial; text-decoration-color: initial;">[root@VM_26_11_centos ~]# curl -sSL https://get.daocloud.io/daotools/set_mirror.sh | sh -s http://b3d8b7d9.m.daocloud.io
docker version >= 1.12
{"registry-mirrors": ["http://b3d8b7d9.m.daocloud.io"],
"live-restore": true
}
Success.
You need to restart docker to take effect: sudo systemctl restart docker
[root@VM_26_11_centos ~]# systemctl restart docker
</pre>

到这里就已经初始化好了运行的环境

Step2:安装Gitlab

1、镜像选择 Gitlab官方在DockerHub上有镜像,一些第三方开发者也上传了自己的Gitlab镜像,通过运行搜索命令可以看到可用的docker镜像:

<pre class="prism-token token language-javascript" style="box-sizing: border-box; list-style: inherit; margin: 24px 0px; font-style: normal; font-variant: normal; font-weight: 400; font-stretch: normal; font-size: 14px; font-family: Consolas, "Liberation Mono", Menlo, Courier, monospace; padding: 16px; overflow: auto; line-height: 1.45; background-color: rgb(247, 247, 247); border-radius: 3px; word-wrap: normal; text-align: left; white-space: pre; word-spacing: 0px; word-break: normal; tab-size: 2; hyphens: none; color: rgb(51, 51, 51); letter-spacing: normal; orphans: 2; text-indent: 0px; text-transform: none; widows: 2; -webkit-text-stroke-width: 0px; text-decoration-style: initial; text-decoration-color: initial;">[root@VM_26_11_centos ~]# docker search gitlab
INDEX NAME DESCRIPTION STARS OFFICIAL AUTOMATED
docker.io docker.io/gitlab/gitlab-ce GitLab Community Edition docker image base... 1105 [OK]
docker.io docker.io/sameersbn/gitlab Dockerized gitlab web server 873 [OK]
docker.io docker.io/gitlab/gitlab-runner 177 [OK]
docker.io docker.io/gitlab/gitlab-ee GitLab Enterprise Edition docker image bas... 57
docker.io docker.io/twang2218/gitlab-ce-zh 这是汉化的 GitLab 社区版 Docker Image 30 [OK]
docker.io docker.io/anapsix/gitlab-ci GitLab-CI Continuous Integration in Docker... 28 [OK]
docker.io docker.io/centurylink/gitlab This image uses the image from sameersbn /... 24 [OK]
docker.io docker.io/genezys/gitlab Dockerized GitLab using the official omnib... 15 [OK]
</pre>

我们可以根据自己的喜好选择docker镜像。本文使用的是一个sameersbn/gitlab的镜像(有关这个镜像的详细说明参考 https://github.com/sameersbn/docker-gitlab) 2、拉取镜像 根据镜像的说明,还需要使用数据库和Redis,也可使用Docker镜像,如https://github.com/sameersbn/docker-gitlab 中介绍的docker镜像。本文使用的是已建好的Mysql和Redis资源,

<pre class="prism-token token language-javascript" style="box-sizing: border-box; list-style: inherit; margin: 24px 0px; font-style: normal; font-variant: normal; font-weight: 400; font-stretch: normal; font-size: 14px; font-family: Consolas, "Liberation Mono", Menlo, Courier, monospace; padding: 16px; overflow: auto; line-height: 1.45; background-color: rgb(247, 247, 247); border-radius: 3px; word-wrap: normal; text-align: left; white-space: pre; word-spacing: 0px; word-break: normal; tab-size: 2; hyphens: none; color: rgb(51, 51, 51); letter-spacing: normal; orphans: 2; text-indent: 0px; text-transform: none; widows: 2; -webkit-text-stroke-width: 0px; text-decoration-style: initial; text-decoration-color: initial;">[root@VM_26_11_centos ~]# docker pull docker.io/sameersbn/gitlab
[root@VM_26_11_centos ~]# docker images
REPOSITORY TAG IMAGE ID CREATED SIZE
docker.io/sameersbn/gitlab latest c7cd44692430 30 hours ago 1.083 GB
</pre>

由于我们之前设置了docker镜像源,拉取镜像的过程只需要两分钟就完成了。 3、创建容器

<pre class="prism-token token language-javascript" style="box-sizing: border-box; list-style: inherit; margin: 24px 0px; font-style: normal; font-variant: normal; font-weight: 400; font-stretch: normal; font-size: 14px; font-family: Consolas, "Liberation Mono", Menlo, Courier, monospace; padding: 16px; overflow: auto; line-height: 1.45; background-color: rgb(247, 247, 247); border-radius: 3px; word-wrap: normal; text-align: left; white-space: pre; word-spacing: 0px; word-break: normal; tab-size: 2; hyphens: none; color: rgb(51, 51, 51); letter-spacing: normal; orphans: 2; text-indent: 0px; text-transform: none; widows: 2; -webkit-text-stroke-width: 0px; text-decoration-style: initial; text-decoration-color: initial;">[root@VM_26_11_centos ~]# docker run --name gitlab -d
-p 127.0.0.1:10443:443 -p 127.0.0.1:10022:22 -p 127.0.0.1:10080:80
--env 'REDIS_HOST=redis.fin.red' --env 'REDIS_PORT=6379'
--env 'DB_ADAPTER=mysql2' --env 'DB_HOST=mysql.fin.red'
--env 'DB_NAME=gitlabhq_production_demo'
--env 'DB_USER=root' --env 'DB_PASS=2017123456' --env 'DB_PORT=3306'
--env 'GITLAB_HOST=gitlab.fin.red' --env 'GITLAB_ROOT_EMAIL=709729863@qq.com'
--env 'GITLAB_SECRETS_DB_KEY_BASE=long-and-random-alpha-numeric-string'
--env 'GITLAB_SECRETS_SECRET_KEY_BASE=long-and-random-alpha-numeric-string'
--env 'GITLAB_SECRETS_OTP_KEY_BASE=long-and-random-alpha-numeric-string'
--env 'GITLAB_MAX_OBJECT_SIZE=125829120'
--volume /var/www/Docker/gitlab:/home/git/data
docker.io/sameersbn/gitlab
</pre>

检查容器运行情况

<pre class="prism-token token language-javascript" style="box-sizing: border-box; list-style: inherit; margin: 24px 0px; font-style: normal; font-variant: normal; font-weight: 400; font-stretch: normal; font-size: 14px; font-family: Consolas, "Liberation Mono", Menlo, Courier, monospace; padding: 16px; overflow: auto; line-height: 1.45; background-color: rgb(247, 247, 247); border-radius: 3px; word-wrap: normal; text-align: left; white-space: pre; word-spacing: 0px; word-break: normal; tab-size: 2; hyphens: none; color: rgb(51, 51, 51); letter-spacing: normal; orphans: 2; text-indent: 0px; text-transform: none; widows: 2; -webkit-text-stroke-width: 0px; text-decoration-style: initial; text-decoration-color: initial;">[root@VM_26_11_centos ~]# docker ps -a
CONTAINER ID IMAGE COMMAND CREATED STATUS PORTS NAMES
8e6bca607900 docker.io/sameersbn/gitlab "/sbin/entrypoint.sh " 51 seconds ago Up 50 seconds 0.0.0.0:10022->22/tcp, 0.0.0.0:10080->80/tcp, 0.0.0.0:10443->443/tcp gitlab
[root@VM_26_11_centos ~]# netstat -nptl
Active Internet connections (only servers)
Proto Recv-Q Send-Q Local Address Foreign Address State PID/Program name
tcp 0 0 127.0.0.1:10443 0.0.0.0:* LISTEN 5378/docker-proxy-c
tcp 0 0 0.0.0.0:80 0.0.0.0:* LISTEN 24029/nginx: master
tcp 0 0 0.0.0.0:22 0.0.0.0:* LISTEN 700/sshd
tcp 0 0 127.0.0.1:10080 0.0.0.0:* LISTEN 5385/docker-proxy-c
tcp 0 0 127.0.0.1:10022 0.0.0.0:* LISTEN 5392/docker-proxy-c
tcp6 0 0 :::22 :::* LISTEN 700/sshd
</pre>

说明gitlab的docker容器已经正常运行起来了。

Step3:安装Gerrit

1、镜像选择 类似Gitlab,先搜索gerrit镜像

<pre class="prism-token token language-javascript" style="box-sizing: border-box; list-style: inherit; margin: 24px 0px; font-style: normal; font-variant: normal; font-weight: 400; font-stretch: normal; font-size: 14px; font-family: Consolas, "Liberation Mono", Menlo, Courier, monospace; padding: 16px; overflow: auto; line-height: 1.45; background-color: rgb(247, 247, 247); border-radius: 3px; word-wrap: normal; text-align: left; white-space: pre; word-spacing: 0px; word-break: normal; tab-size: 2; hyphens: none; color: rgb(51, 51, 51); letter-spacing: normal; orphans: 2; text-indent: 0px; text-transform: none; widows: 2; -webkit-text-stroke-width: 0px; text-decoration-style: initial; text-decoration-color: initial;">[root@VM_26_11_centos ~]# docker search gerrit
INDEX NAME DESCRIPTION STARS OFFICIAL AUTOMATED
docker.io docker.io/openfrontier/gerrit The Gerrit docker support PostgreSQL MySQL... 45 [OK]
docker.io docker.io/larrycai/gerrit The Gerrit code review system based on ubuntu 17 [OK]
docker.io docker.io/gerritforge/gerrit-centos7 Gerrit Code Review on CentOS 7 13
docker.io docker.io/gerritforge/gerrit-ubuntu15.04 Gerrit Code Review on Ubuntu 15.04 12
docker.io docker.io/accenture/adop-gerrit ADOP Gerrit 5 [OK]
docker.io docker.io/fabric8/gerrit 5 [OK]
</pre>

Gerrit官方没有提供镜像,本文选择openfrontier/gerrit镜像

<pre class="prism-token token language-javascript" style="box-sizing: border-box; list-style: inherit; margin: 24px 0px; font-style: normal; font-variant: normal; font-weight: 400; font-stretch: normal; font-size: 14px; font-family: Consolas, "Liberation Mono", Menlo, Courier, monospace; padding: 16px; overflow: auto; line-height: 1.45; background-color: rgb(247, 247, 247); border-radius: 3px; word-wrap: normal; text-align: left; white-space: pre; word-spacing: 0px; word-break: normal; tab-size: 2; hyphens: none; color: rgb(51, 51, 51); letter-spacing: normal; orphans: 2; text-indent: 0px; text-transform: none; widows: 2; -webkit-text-stroke-width: 0px; text-decoration-style: initial; text-decoration-color: initial;">[root@VM_26_11_centos ~]# docker pull docker.io/openfrontier/gerrit
</pre>

2、创建容器 本文采用github的Oauth登录方式,需要在Github先注册一个Oauth账号,注册内容如下

<figure style="box-sizing: border-box; list-style: inherit; margin: 20px 0px; display: block; text-align: center; color: rgb(51, 51, 51); font-family: PingFangSC-Light, "hiragino sans gb", "helvetica neue", "microsoft yahei ui", "microsoft yahei", simsun, arial, sans-serif; font-size: 16px; font-style: normal; font-variant-ligatures: normal; font-variant-caps: normal; font-weight: 400; letter-spacing: normal; orphans: 2; text-indent: 0px; text-transform: none; white-space: pre-wrap; widows: 2; word-spacing: 0px; -webkit-text-stroke-width: 0px; text-decoration-style: initial; text-decoration-color: initial;">

image

</figure>

<pre class="prism-token token language-javascript" style="box-sizing: border-box; list-style: inherit; margin: 24px 0px; font-style: normal; font-variant: normal; font-weight: 400; font-stretch: normal; font-size: 14px; font-family: Consolas, "Liberation Mono", Menlo, Courier, monospace; padding: 16px; overflow: auto; line-height: 1.45; background-color: rgb(247, 247, 247); border-radius: 3px; word-wrap: normal; text-align: left; white-space: pre; word-spacing: 0px; word-break: normal; tab-size: 2; hyphens: none; color: rgb(51, 51, 51); letter-spacing: normal; orphans: 2; text-indent: 0px; text-transform: none; widows: 2; -webkit-text-stroke-width: 0px; text-decoration-style: initial; text-decoration-color: initial;">[root@VM_26_11_centos ~]# docker run
--name gerrit
-p 127.0.0.1:9418:8080
-p 127.0.0.1:19418:29418
-e WEBURL=http://gerrit.fin.red
-e USER_NAME=gerrit
-e USER_EMAIL=709729863@qq.com
-e AUTH_TYPE=OAUTH
-e OAUTH_ALLOW_EDIT_FULL_NAME=true
-e OAUTH_ALLOW_REGISTER_NEW_EMAIL=true
-e OAUTH_GITHUB_CLIENT_ID=4c70bd6eb7c87395ea69
-e OAUTH_GITHUB_CLIENT_SECRET=1bb740e97d47d4b5af0b842702beaf818c6b980a
-v /var/www/Docker/gerrit:/var/gerrit/review_site
-d docker.io/openfrontier/gerrit
[root@VM_26_11_centos ~]# docker ps -a
CONTAINER ID IMAGE COMMAND CREATED STATUS PORTS NAMES
0f261556de08 openfrontier/gerrit "/gerrit-entrypoint.s" 5 minutes ago Up 5 minutes 127.0.0.1:9418->8080/tcp, 127.0.0.1:19418->29418/tcp gerrit
75b4f71615a2 docker.io/sameersbn/gitlab "/sbin/entrypoint.sh " 9 days ago Up 2 minutes 127.0.0.1:10022->22/tcp, 127.0.0.1:10080->80/tcp, 127.0.0.1:10443->443/tcp gitlab
[root@VM_26_11_centos ~]# netstat -nptl
Active Internet connections (only servers)
Proto Recv-Q Send-Q Local Address Foreign Address State PID/Program name
tcp 0 0 127.0.0.1:9418 0.0.0.0:* LISTEN 2752/docker-proxy-c
tcp 0 0 127.0.0.1:10443 0.0.0.0:* LISTEN 3230/docker-proxy-c
tcp 0 0 0.0.0.0:80 0.0.0.0:* LISTEN 3204/nginx: master
tcp 0 0 0.0.0.0:22 0.0.0.0:* LISTEN 699/sshd
tcp 0 0 127.0.0.1:19418 0.0.0.0:* LISTEN 2745/docker-proxy-c
tcp 0 0 127.0.0.1:10080 0.0.0.0:* LISTEN 3237/docker-proxy-c
tcp 0 0 127.0.0.1:10022 0.0.0.0:* LISTEN 3244/docker-proxy-c
tcp6 0 0 :::22 :::* LISTEN 699/sshd
</pre>

说明gerrit的容器已经正常运行起来了

Step4:Gerrit与Gitlab配置及使用

由于我们的服务器安全组只开了80端口,而Gerrit与Gitlab都不是工作在80端口,因此考虑使用Nginx做反向代理。 Nginx的反向代理很简单,在/etc/nginx/conf.d/目录下新建

<pre class="prism-token token language-javascript" style="box-sizing: border-box; list-style: inherit; margin: 24px 0px; font-style: normal; font-variant: normal; font-weight: 400; font-stretch: normal; font-size: 14px; font-family: Consolas, "Liberation Mono", Menlo, Courier, monospace; padding: 16px; overflow: auto; line-height: 1.45; background-color: rgb(247, 247, 247); border-radius: 3px; word-wrap: normal; text-align: left; white-space: pre; word-spacing: 0px; word-break: normal; tab-size: 2; hyphens: none; color: rgb(51, 51, 51); letter-spacing: normal; orphans: 2; text-indent: 0px; text-transform: none; widows: 2; -webkit-text-stroke-width: 0px; text-decoration-style: initial; text-decoration-color: initial;">[root@VM_26_11_centos ~]# cd /etc/nginx/conf.d/
[root@VM_26_11_centos conf.d]# vi virtual.conf
</pre>

输入以下内容并保存

<pre class="prism-token token language-javascript" style="box-sizing: border-box; list-style: inherit; margin: 24px 0px; font-style: normal; font-variant: normal; font-weight: 400; font-stretch: normal; font-size: 14px; font-family: Consolas, "Liberation Mono", Menlo, Courier, monospace; padding: 16px; overflow: auto; line-height: 1.45; background-color: rgb(247, 247, 247); border-radius: 3px; word-wrap: normal; text-align: left; white-space: pre; word-spacing: 0px; word-break: normal; tab-size: 2; hyphens: none; color: rgb(51, 51, 51); letter-spacing: normal; orphans: 2; text-indent: 0px; text-transform: none; widows: 2; -webkit-text-stroke-width: 0px; text-decoration-style: initial; text-decoration-color: initial;">#gitlab server
server
{
listen 80;
server_name gitlab.fin.red;
location / {
proxy_redirect off;
proxy_set_header Host $host;
proxy_set_header X-Real-IP $remote_addr;
proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for;
proxy_pass http://0.0.0.0:10080;
}
}

gerrit server

server
{
listen 80;
server_name gerrit.fin.red;
location / {
proxy_redirect off;
proxy_set_header Host $host;
proxy_set_header X-Real-IP $remote_addr;
proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for;
proxy_pass http://0.0.0.0:9418;
}
}
</pre>

测试配置文件有无错误并给ngixn发送reload指令

<pre class="prism-token token language-javascript" style="box-sizing: border-box; list-style: inherit; margin: 24px 0px; font-style: normal; font-variant: normal; font-weight: 400; font-stretch: normal; font-size: 14px; font-family: Consolas, "Liberation Mono", Menlo, Courier, monospace; padding: 16px; overflow: auto; line-height: 1.45; background-color: rgb(247, 247, 247); border-radius: 3px; word-wrap: normal; text-align: left; white-space: pre; word-spacing: 0px; word-break: normal; tab-size: 2; hyphens: none; color: rgb(51, 51, 51); letter-spacing: normal; orphans: 2; text-indent: 0px; text-transform: none; widows: 2; -webkit-text-stroke-width: 0px; text-decoration-style: initial; text-decoration-color: initial;">[root@VM_26_11_centos conf.d]# nginx -t
nginx: the configuration file /etc/nginx/nginx.conf syntax is ok
nginx: configuration file /etc/nginx/nginx.conf test is successful
[root@VM_26_11_centos conf.d]# nginx -s reload
</pre>

在浏览器中分别输入 gitlab.fin.red以及gerrit.fin.red

<figure style="box-sizing: border-box; list-style: inherit; margin: 20px 0px; display: block; text-align: center; color: rgb(51, 51, 51); font-family: PingFangSC-Light, "hiragino sans gb", "helvetica neue", "microsoft yahei ui", "microsoft yahei", simsun, arial, sans-serif; font-size: 16px; font-style: normal; font-variant-ligatures: normal; font-variant-caps: normal; font-weight: 400; letter-spacing: normal; orphans: 2; text-indent: 0px; text-transform: none; white-space: pre-wrap; widows: 2; word-spacing: 0px; -webkit-text-stroke-width: 0px; text-decoration-style: initial; text-decoration-color: initial;">

image

</figure>

<figure style="box-sizing: border-box; list-style: inherit; margin: 20px 0px; display: block; text-align: center; color: rgb(51, 51, 51); font-family: PingFangSC-Light, "hiragino sans gb", "helvetica neue", "microsoft yahei ui", "microsoft yahei", simsun, arial, sans-serif; font-size: 16px; font-style: normal; font-variant-ligatures: normal; font-variant-caps: normal; font-weight: 400; letter-spacing: normal; orphans: 2; text-indent: 0px; text-transform: none; white-space: pre-wrap; widows: 2; word-spacing: 0px; -webkit-text-stroke-width: 0px; text-decoration-style: initial; text-decoration-color: initial;">

image

</figure>

到这里就完成了Gitlab与Gerrit的安装安装

©著作权归作者所有,转载或内容合作请联系作者
  • 序言:七十年代末,一起剥皮案震惊了整个滨河市,随后出现的几起案子,更是在滨河造成了极大的恐慌,老刑警刘岩,带你破解...
    沈念sama阅读 194,242评论 5 459
  • 序言:滨河连续发生了三起死亡事件,死亡现场离奇诡异,居然都是意外死亡,警方通过查阅死者的电脑和手机,发现死者居然都...
    沈念sama阅读 81,769评论 2 371
  • 文/潘晓璐 我一进店门,熙熙楼的掌柜王于贵愁眉苦脸地迎上来,“玉大人,你说我怎么就摊上这事。” “怎么了?”我有些...
    开封第一讲书人阅读 141,484评论 0 319
  • 文/不坏的土叔 我叫张陵,是天一观的道长。 经常有香客问我,道长,这世上最难降的妖魔是什么? 我笑而不...
    开封第一讲书人阅读 52,133评论 1 263
  • 正文 为了忘掉前任,我火速办了婚礼,结果婚礼上,老公的妹妹穿的比我还像新娘。我一直安慰自己,他们只是感情好,可当我...
    茶点故事阅读 61,007评论 4 355
  • 文/花漫 我一把揭开白布。 她就那样静静地躺着,像睡着了一般。 火红的嫁衣衬着肌肤如雪。 梳的纹丝不乱的头发上,一...
    开封第一讲书人阅读 46,080评论 1 272
  • 那天,我揣着相机与录音,去河边找鬼。 笑死,一个胖子当着我的面吹牛,可吹牛的内容都是我干的。 我是一名探鬼主播,决...
    沈念sama阅读 36,496评论 3 381
  • 文/苍兰香墨 我猛地睁开眼,长吁一口气:“原来是场噩梦啊……” “哼!你这毒妇竟也来了?” 一声冷哼从身侧响起,我...
    开封第一讲书人阅读 35,190评论 0 253
  • 序言:老挝万荣一对情侣失踪,失踪者是张志新(化名)和其女友刘颖,没想到半个月后,有当地人在树林里发现了一具尸体,经...
    沈念sama阅读 39,464评论 1 290
  • 正文 独居荒郊野岭守林人离奇死亡,尸身上长有42处带血的脓包…… 初始之章·张勋 以下内容为张勋视角 年9月15日...
    茶点故事阅读 34,549评论 2 309
  • 正文 我和宋清朗相恋三年,在试婚纱的时候发现自己被绿了。 大学时的朋友给我发了我未婚夫和他白月光在一起吃饭的照片。...
    茶点故事阅读 36,330评论 1 326
  • 序言:一个原本活蹦乱跳的男人离奇死亡,死状恐怖,灵堂内的尸体忽然破棺而出,到底是诈尸还是另有隐情,我是刑警宁泽,带...
    沈念sama阅读 32,205评论 3 312
  • 正文 年R本政府宣布,位于F岛的核电站,受9级特大地震影响,放射性物质发生泄漏。R本人自食恶果不足惜,却给世界环境...
    茶点故事阅读 37,567评论 3 298
  • 文/蒙蒙 一、第九天 我趴在偏房一处隐蔽的房顶上张望。 院中可真热闹,春花似锦、人声如沸。这庄子的主人今日做“春日...
    开封第一讲书人阅读 28,889评论 0 17
  • 文/苍兰香墨 我抬头看了看天上的太阳。三九已至,却和暖如春,着一层夹袄步出监牢的瞬间,已是汗流浃背。 一阵脚步声响...
    开封第一讲书人阅读 30,160评论 1 250
  • 我被黑心中介骗来泰国打工, 没想到刚下飞机就差点儿被人妖公主榨干…… 1. 我叫王不留,地道东北人。 一个月前我还...
    沈念sama阅读 41,475评论 2 341
  • 正文 我出身青楼,却偏偏与公主长得像,于是被迫代替她去往敌国和亲。 传闻我的和亲对象是个残疾皇子,可洞房花烛夜当晚...
    茶点故事阅读 40,650评论 2 335

推荐阅读更多精彩内容