文章目录
-
-
- [1. 环境准备](#1. 环境准备)
- [2. GitLab 安装](#2. GitLab 安装)
- [3. 离线安装](#3. 离线安装)
-
1. 环境准备
2. GitLab 安装
参考:https://about.gitlab.com/install/#ubuntu
安装和配置必要的依赖项:
shell
$ sudo apt-get update
$ sudo apt-get install -y curl openssh-server ca-certificates tzdata perl
接下来,您需要添加GitLab软件包存储库。有一种简单的方法可以执行此操作,即通过运行以下命令:
//配置 repo
bash
$ curl -s https://packages.gitlab.com/install/repositories/gitlab/gitlab-ce/script.deb.sh | sudo bash
info\]尽管在这种情况下它是无害的,但是警惕直接从Internet运行shell脚本。
现在,您将要设置 GitLab 对外提供服务的 URL
地址或 IP
,如果使用 https 方式,GitLab 将自动使用Let's Encrypt
请求一个证书,这需要一个有效的外部域名。
bash
// 安装指定版本
#$ EXTERNAL_URL="http://gitlabtest.xiodi.cn" apt-get install gitlab-ce=17.2.2-ce.0
// 锁定版本以限制自动更新:
#$ sudo apt-mark hold gitlab-ce
// 显示保留的包:
#$ sudo apt-mark showhold
$ EXTERNAL_URL="http://gitlabtest.xiodi.cn" apt-get install gitlab-ce
安装完成后,可以查看一下后面的输出日志,会告诉你,默认用户密码:
shell
$ cat /etc/gitlab/initial_root_password
...
Password: 7jw56aJyF78ePVPVmN71m/3nPgP4Q3un1+XEnxhRrDE=
...
您可用使用 EXTERNAL_URL 地址访问 GitLab 并继续进行配置,默认用户名为 root ,请注意,它不是操作系统的 root。
注意:当第一次访问的时候,尽量不要开启 vpn 代理,有可能会根据当前所处地区,初始化语言,造成没有切换为中文语言选项,待考证是否这个原因,目前遇到过一次。
3. 离线安装
下载地址:https://packages.gitlab.com/gitlab/gitlab-ce
bash
$ wget --content-disposition https://packages.gitlab.com/gitlab/gitlab-ce/packages/ubuntu/noble/gitlab-ce_17.2.2-ce.0_amd64.deb/download.deb
$ EXTERNAL_URL="http://gitlabtest.xiodi.cn" dpkg -i gitlab-ce_17.2.2-ce.0_amd64.deb