1.安装必要软件包
sudo apt update
sudo apt upgrade
sudo apt install build-essential curl file git ca-certificates
2.下载GitLab软件包并安装
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实例
sudo gitlab-ctl reconfigure
sudo gitlab-ctl start
sudo gitlab-ctl status
4.配置防火墙
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密码)
sudo cat /etc/gitlab/initial_root_password
7.GitLab项目域名或IP设置及修改
7.1 编辑gitlab.yml配置文件,修改host
sudo vim /opt/gitlab/embedded/service/gitlab-rails/config/gitlab.yml
## 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
sudo vim /etc/gitlab/gitlab.rb
## 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服务
sudo gitlab-ctl restart
8.设置GitLab开机自启
systemctl enable gitlab-runsvdir.service