依赖
先安装软件依赖包
1 2 3
| sudo apt update sudo apt install curl openssh-server ca-certificates sudo apt install postfix
|
信任Gitlab的公钥
1
| curl https://packages.gitlab.com/gpg.key 2> /dev/null | sudo apt-key add - &>/dev/null
|
配置Gitlab的清华源
可以到清华 Gitlab-ce
清华源提供的Ubuntu地址为
1
| deb https://mirrors.tuna.tsinghua.edu.cn/gitlab-ce/ubuntu focal main
|
清华提供了bionic/focal/xenial,是Ubuntu 16.04/18.04/20.04 LTS
可以查看软件包大小

一个软件包接近1G,不加速得下到猴年马月
向文件/etc/apt/sources.list.d/gitlab-ce.list
添加清华提供的地址。
安装
1 2
| sudo apt update sudo apt install gitlab-ce
|
在线配置
1
| sudo gitlab-ctl reconfigure
|

配置完成,耗时五分钟。

启动
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16
| $ sudo gitlab-ctl start ok: run: alertmanager: (pid 2476028) 257s ok: run: gitaly: (pid 2476063) 254s ok: run: gitlab-exporter: (pid 2475997) 261s ok: run: gitlab-kas: (pid 2475976) 262s ok: run: gitlab-workhorse: (pid 2475984) 262s ok: run: logrotate: (pid 2474315) 491s ok: run: nginx: (pid 2477512) 2s ok: run: node-exporter: (pid 2475991) 262s ok: run: postgres-exporter: (pid 2476039) 257s ok: run: postgresql: (pid 2474501) 468s ok: run: prometheus: (pid 2476006) 260s ok: run: puma: (pid 2475070) 396s ok: run: redis: (pid 2474376) 485s ok: run: redis-exporter: (pid 2475999) 260s ok: run: sidekiq: (pid 2475119) 385s
|
修改配置
root密码
1 2 3 4
| sudo gitlab-rails console -e production user = User.where(username:"root").first user.password = "your password" user.save
|

地址
修改/etc/gitlab/gitlab.rb
中的external_url字段
1
| external_url="https://127.0.0.1:8080"
|
文件位置
修改/etc/gitlab/gitlab.rb
中的external_url字段
1 2 3 4 5
| git_data_dirs({ "default" => { "path" => "xxx" } })
|
修改后要重新配置,耗时一分钟

查看日志
查看版本
1
| cat /opt/gitlab/embedded/service/gitlab-rails/VERSION
|
测试
登录

默认主页

资源占用
