在 Ubuntu 上安装 GitLab 通常有 两种方式:
下面我先讲最常用、最稳定的官方包安装方式。
sudo apt update
sudo apt upgrade -y
sudo apt install -y curl openssh-server ca-certificates tzdata perl
curl https://packages.gitlab.com/install/repositories/gitlab/gitlab-ee/script.deb.sh | sudo bash
如果你想用 CE(社区版,免费),把
gitlab-ee换成gitlab-ce:
curl https://packages.gitlab.com/install/repositories/gitlab/gitlab-ce/script.deb.sh | sudo bash
sudo EXTERNAL_URL="http://你的服务器IP" apt install gitlab-ee
例如:
sudo EXTERNAL_URL="http://192.168.1.100" apt install gitlab-ee
如果你想用域名:
sudo EXTERNAL_URL="https://gitlab.example.com" apt install gitlab-ee
sudo gitlab-ctl reconfigure
浏览器打开:
http://服务器IP
首次登录账号:
rootsudo cat /etc/gitlab/initial_root_password
sudo gitlab-ctl status # 查看状态
sudo gitlab-ctl stop # 停止
sudo gitlab-ctl start # 启动
sudo gitlab-ctl restart # 重启
如果你更习惯 Docker:
docker run -d \
--hostname gitlab.example.com \
-p 443:443 -p 80:80 -p 22:22 \
--name gitlab \
gitlab/gitlab-ee
如果你告诉我:
我可以给你更精确的一步到位配置。