关于debian:如何在-Debian-10-系统上安装-GitLab

1次阅读

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

GitLab 是一个收费的开源前端 Git 存储库,具备 Wiki 和问题跟踪性能。它容许你在本人的服务器上托管 Git 存储库,并设置 DevOps 平台。

在本指南中,咱们将在 Debian 10 (Buster) 零碎上装置 GitLab CE (Community Edition)。

必备条件

  • An instance of Debian 10 server with SSH access.
  • Minimum of 8 GB RAM
  • 20GB of hard disk space
  • A valid domain name pointed to the IP address of the server.
  • User with sudo rights

(1) 更新零碎

应用 SSH 拜访您的 Debian 服务器,更新零碎上的包列表

$ sudo apt update

(2) 装置 GitLab 依赖

更新实现后,装置所需的依赖,如下所示

$ sudo apt install ca-certificates curl openssh-server postfix

对于 Postfix 邮件服务器,请确保邮件配置选项为 Internet Site

接下来,提供零碎邮件名称,如图所示,并按 ENTER 键

之后,零碎将主动实现所有软件包及其依赖项的装置

(3) 装置 Gitlab CE

如图所示,首先将存储库脚本从 GitLab 下载到 /tmp 目录

$ cd /tmp
$ wget https://packages.gitlab.com/install/repositories/gitlab/gitlab-ce/script.deb.sh

下载实现后,您须要执行脚本,如下所示

$ sudo bash script.deb.sh

这将设置 GitLab 存储库,为装置 GitLab 做好筹备

实现存储库的设置后,执行命令装置 GitLab CE,如下所示

$ sudo apt install gitlab-ce

当呈现提醒时,按 Y 并按 ENTER 持续装置

在装置过程中,您将收到 GitLab 尚未配置以及尚未配置无效主机名的告诉

咱们将进一步进行必要的配置

(4) 配置 Gitlab

To tune our GitLab installation, you need to edit the github.rb file. Here we will use the vim editor to open the file.

要优化 GitLab 装置,须要编辑 github.rb 文件,咱们将应用 vim 编辑器关上文件

$ sudo vim /etc/gitlab/gitlab.rb

Search and locate the external_url parameter. Update the field to correspond to your domain as follows:

搜寻并定位 external_url 参数,更新字段以对应于您的域名,如下所示

external_url‘http://domain.com’

在本例中,应用咱们的测试域名,如下所示

external_url 'http://crazytechgeek.info'

接下来,找到 letsencrypt[‘contact_emails’] 参数,填入本人的邮箱,该邮箱将用于接管 Let s Encrypt SSL 证书到期揭示。

letsencrypt['contact_emails'] = ['admin@linuxtechi.com']

最初,保留文件并重新配置 GitLab 装置,如下所示

$ sudo gitlab-ctl reconfigure

重新配置大概须要 5 分钟,配置实现后,你应该看到 GitLab Reconfigured! 的输入

(5) 拜访 Gitlab

从 web 浏览器拜访您的域名,如下所示

http://domain.com

首次拜访时,将向您提供上面的登录页面。应用 root 用户凭据登录。

零碎会要求您更改明码

实现后,单击更改明码选项并按 ENTER。而后疏导您进入 GitLab 仪表板,如图所示

(6) 应用 Let’s Encrypt SSL 平安证书

Let’s Encrypt is a free security certificate by Lets Encrypt
authority that allows you to secure your website. GitLab configuration
supports Let’s Encrypt and, in this step, we will configure our Gitlab
instance to use Let’s Encrypt SSL for secure connections.

Let ‘ s Encrypt 是一个收费的平安证书,由 Let ‘ s Encrypt 受权,能够加密您的网站。GitLab 配置反对 Let s Encrypt,在这一步中,咱们将配置咱们的 GitLab 实例应用 Let s Encrypt SSL 进行平安连贯。

编辑 gitlab.rb 文件

$ sudo vim /etc/gitlab/gitlab.rb

编辑如下参数:

letsencrypt['enable'] = true
letsencrypt['auto_renew'] = true

第一行容许配置 Let s Encrypt,第二行设置自动更新证书

除此之外,您还能够定义每月的主动续订工夫和日期,如下所示

letsencrypt['auto_renew_hour'] = 5
letsencrypt['auto_renew_day_of_month'] = "*/6"

将 URL 设置为 HTTPS 协定而不是 HTTP 协定

external_url 'https://crazytechgeek.info'

保留批改并退出配置文件,再次运行以下命令

$ sudo gitlab-ctl reconfigure

要验证所有都按计划进行,请调用该命令

$ sudo gitlab-rake gitlab:check

从新加载浏览器,能够看到 Let ‘ s Encrypt SSL 证书曾经失效。

我的开源我的项目

  • course-tencent-cloud(酷瓜云课堂 – gitee 仓库)
  • course-tencent-cloud(酷瓜云课堂 – github 仓库)
正文完
 0