下面给你一份在 Linux 上安装 GitLab(社区版 CE)的常用方法,以 Ubuntu / Debian 和 CentOS / RHEL 为例,最推荐的是 Omnibus 包安装(官方一体包,最简单)。
sudo 或 root 权限80(HTTP)、443(HTTPS)、22(SSH,可选)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
把
gitlab.example.com改成你的域名或 IP
浏览器打开:
http://服务器IP
首次登录用户名:root
密码在:
cat /etc/gitlab/initial_root_password
sudo yum install -y curl policycoreutils openssh-server postfix
sudo systemctl enable --now sshd postfix
sudo firewall-cmd --permanent --add-service=http
sudo firewall-cmd --reload
curl -fsSL https://packages.gitlab.com/install/repositories/gitlab/gitlab-ce/setup.sh | sudo bash
sudo EXTERNAL_URL="http://gitlab.example.com" yum install -y gitlab-ce
sudo gitlab-ctl reconfigure # 修改配置后执行
sudo gitlab-ctl restart
sudo gitlab-ctl status
sudo gitlab-ctl stop
编辑:
sudo vim /etc/gitlab/gitlab.rb
例如:
external_url 'http://192.168.1.100'
然后:
sudo gitlab-ctl reconfigure
docker run -d \
--hostname gitlab.example.com \
-p 80:80 -p 443:443 -p 22:22 \
--name gitlab \
gitlab/gitlab-ce
如果你告诉我:
我可以直接给你精确一条龙命令。