安装 Gitlab Ce

安装 Gitlab-CE #

本文介绍,在UNRAID 6.11.1 下安装 Gitlab-CE 应用。并且配置域名和https证书

一、在应用商店搜索 Gitlab-CE 进行安装 #

在应用商店搜索 Gitlab-CE 进行安装 在应用商店搜索 Gitlab-CE 进行安装2

配置参考如下

docker配置

二、阿里云域名解析 #

gitlab.kazmodan.com -> 10.10.10.241

三、阿里云申请免费 https 证书 #

使用域名 gitlab.kazmodan.com 申请免费 https 证书,并且下载到本地

四、解压并且上传 https 证书到指定目录 #

证书目录

五、修改 gitlab 配置文件 gitlab.rb #

vi /mnt/disk1/appdata/gitlab-ce/config/gitlab.rb

修改内容如下:

...
external_url 'https://gitlab.kazmodan.com'
...
nginx['redirect_http_to_https'] = true
...
nginx['ssl_certificate'] = "/etc/gitlab/ssl/8677448_gitlab.kazmodan.com.pem"
nginx['ssl_certificate_key'] = "/etc/gitlab/ssl/8677448_gitlab.kazmodan.com.key"
...
nginx['proxy_set_headers'] = {
  "X-Forwarded-Proto" => "https",
  "X-Forwarded-Ssl" => "on"
}

修改完成后,重启容器

六、获取初始化 root 密码 #

cat /mnt/disk1/appdata/gitlab-ce/config/initial_root_password

结果参考

# WARNING: This value is valid only in the following conditions
#          1. If provided manually (either via `GITLAB_ROOT_PASSWORD` environment variable or via `gitlab_rails['initial_root_password']` setting in `gitlab.rb`, it was provided before database was seeded for the first time (usually, the first reconfigure run).
#          2. Password hasn't been changed manually, either via UI or via command line.
#
#          If the password shown here doesn't work, you must reset the admin password following https://docs.gitlab.com/ee/security/reset_user_password.html#reset-your-root-password.

Password: sU4qiDA5dIrsnSEnZSofcd8hIm2aUeIA/npJ93JJ7Dg=

# NOTE: This file will be automatically deleted in the first reconfigure run after 24 hours.

通过该密码登录 https://gitlab.kazmodan.com/

七、初始化设置 #

1、切换中文 #

User Settings -> Preferences -> Localization -> 简体中文

2、修改密码 #

用户设置 -> 密码

3、创建用户 #

管理中心 -> 概览 -> 用户 -> 新用户

4、常用用户添加 SSH Key #

用户设置 -> SSH密钥