在 CentOS 上部署 GitLab,一般有三种常见选择,取决于你的用途、运维能力和服务器资源:
适合:绝大多数用户、生产环境
特点
适用系统
安装方式
# CentOS 7 示例
sudo yum install -y curl policycoreutils-python openssh-server
sudo systemctl enable sshd
sudo systemctl start sshd
curl https://packages.gitlab.com/install/repositories/gitlab/gitlab-ce/script.rpm.sh | sudo bash
sudo EXTERNAL_URL="http://gitlab.example.com" yum install -y gitlab-ce
优点
缺点
适合:已有 Docker、测试环境、快速部署
特点
示例
docker run --detach \
--hostname gitlab.example.com \
--publish 443:443 --publish 80:80 --publish 22:22 \
--name gitlab \
--restart always \
gitlab/gitlab-ce:latest
优点
缺点
适合:研究 GitLab 原理、定制开发
缺点
| 场景 | 建议 |
|---|---|
| 公司内网 | GitLab CE |
| 个人/小团队 | GitLab CE |
| 需要 CI/CD | GitLab CE(自带) |
| 需要高级权限管理 | GitLab EE(付费) |
| 用户量 | 内存 | CPU |
|---|---|---|
| 1–10人 | 4G | 2核 |
| 10–50人 | 8G | 4核 |
| 50+人 | 16G+ | 8核+ |
CentOS 上选 GitLab,优先用官方 Omnibus 包(gitlab-ce)
如果你愿意,我可以: