Gitlab Documentation: https://about.gitlab.com/install/#centos-7

下面是和官网不一样的教程

前提概要

本来之前用的是Github但因为在国外速度太慢了,为了更好的分享自己的开源不得不更换成Gitee。刚开始还不错知道今天突然发现之前开源的40个左右的项目全部都被锁了需要重新提交审核。不得已才想到搭建自己的Git版本控制

准备工具

1、Linux服务器一台,这里我使用的是腾讯云的Centos

2、确保安装了Nginx环境,可以看博主的其他文章快速搭建环境

进入正题

查看自己的服务器的版本信息

Last login: Wed May 18 22:24:22 2022 from 113.118.82.119
(base) [ ~]# uname -a
Linux VM-16-13-centos 3.10.0-1160.11.1.el7.x86_64 #1 SMP Fri Dec 18 16:34:56 UTC 2020 x86_64 x86_64 x86_64 GNU/Linux

从上面可以得是64位的服务器,前往镜像站找到对应的版本右键复制链接。复制链接后又两种方式可以 下载,一种是用linux服务器的wget命令下载,另一种是用idm等下载工具下载后上传到服务器中

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
#下载rpm包
(base) [ ~]# wget https://mirrors.tuna.tsinghua.edu.cn/gitlab-ce/yum/el7/gitlab-ce-14.9.4-ce.0.el7.x86_64.rpm
--2022-05-19 10:36:46-- https://mirrors.tuna.tsinghua.edu.cn/gitlab-ce/yum/el7/gitlab-ce-14.9.4-ce.0.el7.x86_64.rpm
Resolving mirrors.tuna.tsinghua.edu.cn (mirrors.tuna.tsinghua.edu.cn)... 101.6.15.130, 2402:f000:1:400::2
Connecting to mirrors.tuna.tsinghua.edu.cn (mirrors.tuna.tsinghua.edu.cn)101.6.15.130:443... connected.
ERROR: cannot verify mirrors.tuna.tsinghua.edu.cn's certificate, issued by ‘/C=US/O=Let's Encrypt/CN=R3’:
Issued certificate has expired.
To connect to mirrors.tuna.tsinghua.edu.cn insecurely, use `--no-check-certificate'.
(base) [ ~]# wget https://mirrors.tuna.tsinghua.edu.cn/gitlab-ce/yum/el7/gitlab-ce-14.9.4-ce.0.el7.x86_64.rpm --no-check-certificate
--2022-05-19 10:36:58-- https://mirrors.tuna.tsinghua.edu.cn/gitlab-ce/yum/el7/gitlab-ce-14.9.4-ce.0.el7.x86_64.rpm
Resolving mirrors.tuna.tsinghua.edu.cn (mirrors.tuna.tsinghua.edu.cn)... 101.6.15.130, 2402:f000:1:400::2
Connecting to mirrors.tuna.tsinghua.edu.cn (mirrors.tuna.tsinghua.edu.cn)101.6.15.130:443... connected.
WARNING: cannot verify mirrors.tuna.tsinghua.edu.cn's certificate, issued by ‘/C=US/O=Let's Encrypt/CN=R3’:
Issued certificate has expired.
HTTP request sent, awaiting response... 200 OK
Length: 1026503472 (979M) [application/x-redhat-package-manager]
Saving to: ‘gitlab-ce-14.9.4-ce.0.el7.x86_64.rpm’

100%[===============================================================================================================================================>] 1,026,503,472 3.33MB/s in 5m 28s

2022-05-19 10:42:26 (2.98 MB/s) - ‘gitlab-ce-14.9.4-ce.0.el7.x86_64.rpm’ saved [1026503472/1026503472]





#开始安装rpm包
rpm -i gitlab-ce-14.9.4-ce.0.el7.x86_64.rpm

看到如下信息说明安装成功了

安装好后还需对服务器进行简单的配置,使用vim命令打开文件找到图中 对应的地方修改成自己的域名。

1
2
3
4
5
#进行配置
vim /etc/gitlab/gitlab.rb

#配置
gitlab-ctl reconfigure