下面给你一份**在 Debian 上部署 GitLab(社区版 CE)**的常用、可靠方案,适合自建服务器或云主机。
sudo apt update
sudo apt upgrade -y
sudo apt install -y curl openssh-server ca-certificates postfix
postfix:用于邮件通知curl https://packages.gitlab.com/install/repositories/gitlab/gitlab-ce/script.deb.sh | sudo bash
sudo EXTERNAL_URL="http://gitlab.example.com" apt install gitlab-ce
如果是 IP 访问:
sudo EXTERNAL_URL="http://192.168.1.100" apt install gitlab-ce
安装完成后会自动执行 gitlab-ctl reconfigure
sudo vim /etc/gitlab/gitlab.rb
常见修改:
external_url 'http://gitlab.example.com'
gitlab_rails['gitlab_shell_ssh_port'] = 22
sudo gitlab-ctl reconfigure
浏览器访问:
http://服务器IP
首次登录:
rootsudo cat /etc/gitlab/initial_root_password
sudo gitlab-ctl start # 启动
sudo gitlab-ctl stop # 停止
sudo gitlab-ctl restart # 重启
sudo gitlab-ctl status # 状态
sudo gitlab-ctl tail # 查看日志
sudo ufw allow 80
sudo ufw allow 22
external_url 'https://gitlab.example.com'
letsencrypt['enable'] = true
prometheus_monitoring['enable'] = false
gitlab-ctl statussudo gitlab-ctl tail nginx如果你需要:
告诉我你的使用场景,我可以给你更具体的方案。