Ubuntu安装GitLab
2022-08-06 本文已影响0人
炎鸿
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
1 ## GitLab settings
2 gitlab:
3 ## Web server settings (note: host is the FQDN, do not include http://)
4 host: 127.0.0.1
5 port: 80
6 https: false
7.2 编辑gitlab.rb文件,修改external_url
sudo vim /etc/gitlab/gitlab.rb
1 ## Url on which GitLab will be reachable.
2 ## For more details on configuring external_url see:
3 ## https://gitlab.com/gitlab-org/omnibus-gitlab/blob/master/doc/settings/configuration.md#configuring-the-external-url-for-gitlab
4 external_url 'http://127.0.0.1'
7.3 重启GitLab服务
sudo gitlab-ctl restart
8.设置GitLab开机自启
systemctl enable gitlab-runsvdir.service