下面给你一份**在 Linux 上部署 GitLab(CE 社区版)**的常用、稳妥方案,适合大多数场景(Ubuntu / CentOS 均适用)。
常见三种:
下面以 Omnibus 安装 为主。
sudo apt update
sudo apt install -y curl openssh-server ca-certificates postfix
postfix 选 Internet Site 即可
curl -fsSL https://packages.gitlab.com/install/repositories/gitlab/gitlab-ce/setup.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
sudo gitlab-ctl reconfigure
sudo gitlab-ctl start
浏览器访问:
http://服务器IP
首次登录:
rootsudo cat /etc/gitlab/initial_root_password
sudo yum install -y curl policycoreutils openssh-server postfix
sudo systemctl enable sshd postfix
sudo systemctl start sshd postfix
curl -fsSL https://packages.gitlab.com/install/repositories/gitlab/gitlab-ce/setup.sh | sudo bash
sudo EXTERNAL_URL="http://gitlab.example.com" yum install gitlab-ce
sudo gitlab-ctl reconfigure
gitlab-ctl status # 查看状态
gitlab-ctl start # 启动
gitlab-ctl stop # 停止
gitlab-ctl restart # 重启
gitlab-ctl tail # 查看日志
配置文件:
/etc/gitlab/gitlab.rb
修改后执行:
sudo gitlab-ctl reconfigure
例如修改端口:
external_url 'http://192.168.1.100:8080'
docker run -d \
--hostname gitlab.example.com \
-p 443:443 -p 80:80 -p 22:22 \
--name gitlab \
gitlab/gitlab-ce
修改 gitlab.rb 中 nginx['listen_port']
sudo gitlab-rake "gitlab:password:reset[root]"
如果你愿意,可以告诉我:
我可以直接给你一套定制部署方案。