1.安装必要软件包
1
2
3
4
5
6
7
8
9
|
sudo apt update
sudo apt upgrade
sudo apt install build-essential curl file git ca-certificates
|
2.下载GitLab软件包并安装
1
2
3
4
5
6
|
wget --content-disposition https://packages.gitlab.com/gitlab/gitlab-ce/packages/ubuntu/bionic/gitlab-ce_14.1.2-ce.0_amd64.deb/download.deb
sudo dpkg -i gitlab-ce_14.1.2-ce.0_amd64.deb
|
3.启动GitLab实例
1
2
3
4
5
6
7
8
9
|
sudo gitlab-ctl reconfigure
sudo gitlab-ctl start
sudo gitlab-ctl status
|
4.配置防火墙
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
|
sudo ufw allow https
sudo ufw allow http
sudo ufw allow ssh
sudo ufw enable
sudo ufw status
|
5.访问GitLab Web界面
打开Web浏览器,访问http://Your-IP-address
6.查看GitLab默认root初始密码(尽快修改root密码)
1
2
3
|
sudo cat /etc/gitlab/initial_root_password
|
7.GitLab项目域名或IP设置及修改
7.1 编辑gitlab.yml配置文件,修改host
1
2
3
|
sudo vim /opt/gitlab/embedded/service/gitlab-rails/config/gitlab.yml
|
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
|
## GitLab settings
gitlab:
## Web server settings (note: host is the FQDN, do not include http://)
host: 127.0.0.1
port: 80
https: false
|
7.2 编辑gitlab.rb文件,修改external_url
1
2
3
|
sudo vim /etc/gitlab/gitlab.rb
|
1
2
3
4
5
6
7
8
9
10
11
12
|
## Url on which GitLab will be reachable.
## For more details on configuring external_url see:
## https://gitlab.com/gitlab-org/omnibus-gitlab/blob/master/doc/settings/configuration.md#configuring-the-external-url-for-gitlab
external_url 'http://127.0.0.1'
|
7.3 重启GitLab服务
1
2
3
|
sudo gitlab-ctl restart
|
8.设置GitLab开机自启
1
2
3
|
systemctl enable gitlab-runsvdir.service
|
9.设置GitLab Web界面中文显示