在 Ubuntu 上安装 GitLab 的步骤如下:
更新系统包列表
sudo apt update
安装必要的依赖包
sudo apt install -y curl openssh-server ca-certificates tzdata perl
添加 GitLab 官方仓库
curl https://packages.gitlab.com/install/repositories/gitlab/gitlab-ce/script.deb.sh | sudo bash
安装 GitLab Community Edition (CE)
sudo apt install gitlab-ce
配置 GitLab
/etc/gitlab/gitlab.rb
文件,根据需要调整配置。external_url 'http://your-gitlab-url'
sudo gitlab-ctl reconfigure
访问 GitLab
打开浏览器并访问 http://your-gitlab-url
,按照屏幕上的指示完成初始设置。
如果你更喜欢使用 Docker,可以按照以下步骤操作:
安装 Docker
sudo apt update
sudo apt install -y docker.io
添加 GitLab 官方 Docker 镜像仓库
curl https://packages.gitlab.com/install/repositories/gitlab/gitlab-ce/script.deb.sh | sudo bash
安装 GitLab Docker 镜像
sudo EXTERNAL_URL="http://your-gitlab-url" apt install gitlab-ce
启动并启用 GitLab 服务
sudo gitlab-ctl start
sudo gitlab-ctl enable
访问 GitLab
打开浏览器并访问 http://your-gitlab-url
,按照屏幕上的指示完成初始设置。
通过以上步骤,你应该能够在 Ubuntu 上成功安装 GitLab。如果有任何问题,请参考 GitLab 官方文档 获取更多帮助。