1. 更新系统包
首先,确保你的Debian系统是最新的:
sudo apt update sudo apt upgrade -y
2. 安装必要的依赖
gitLab需要一些基本的依赖包:
sudo apt install -y curl openssh-server ca-certificates tzdata perl
3. 添加gitlab仓库
添加GitLab的官方APT仓库:
curl https://packages.gitlab.com/install/repositories/gitlab/gitlab-ce/script.deb.sh | sudo bash
4. 安装GitLab CE(社区版)
安装GitLab社区版:
sudo EXTERNAL_URL="http://your-gitlab-domain.com" apt install gitlab-ce
将http://your-gitlab-domain.com替换为你希望GitLab访问的域名。
5. 配置GitLab
安装完成后,GitLab会自动启动并进行配置。你可以通过浏览器访问http://your-gitlab-domain.com来配置GitLab。
6. 配置防火墙
如果你使用的是UFW(Uncomplicated Firewall),确保开放HTTP和SSH端口:
sudo ufw allow http sudo ufw allow ssh
7. 配置ssl(可选但推荐)
为了安全起见,建议为GitLab配置SSL证书。你可以使用Let’s Encrypt来获取免费的SSL证书:
按照提示完成SSL证书的安装和配置。
8. 验证安装
访问https://your-gitlab-domain.com,你应该能够看到GitLab的登录页面。使用默认的用户名和密码登录:
- 用户名:root
- 密码:在安装过程中会显示
9. 重置密码
首次登录后,建议立即重置root用户的密码:
sudo passwd root
10. 配置GitLab
根据你的需求,你可能需要进一步配置GitLab,例如设置用户、项目、CI/CD管道等。你可以参考GitLab官方文档进行详细配置。
通过以上步骤,你应该能够在Debian系统上成功安装和配置GitLab。