你问的“GitLab Linux 怎么配”,通常有两种理解:
我分别给你说明,你可以看哪一部分对你有用。
# 更新系统
sudo apt update && sudo apt upgrade -y
# 安装依赖
sudo apt install -y curl openssh-server ca-certificates tzdata
# 添加 GitLab 源
curl -fsSL https://packages.gitlab.com/install/repositories/gitlab/gitlab-ce/setup.sh | sudo bash
# 安装 GitLab(替换为你自己的域名或 IP)
sudo EXTERNAL_URL="http://gitlab.example.com" apt install gitlab-ce
安装完成后:
sudo gitlab-ctl reconfigure
访问:
http://你的IP
默认账号:root
密码在:
sudo cat /etc/gitlab/initial_root_password
sudo yum install -y curl policycoreutils-python openssh-server
sudo systemctl enable sshd
sudo systemctl start sshd
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
sudo gitlab-ctl status
sudo gitlab-ctl restart
sudo gitlab-ctl stop
sudo gitlab-ctl tail
# 修改配置文件
sudo vim /etc/gitlab/gitlab.rb
external_url 'https://gitlab.example.com'
sudo gitlab-ctl reconfigure
可用 Let’s Encrypt:
letsencrypt['enable'] = true
# Ubuntu
sudo apt install git
# CentOS
sudo yum install git
git config --global user.name "你的名字"
git config --global user.email "你的邮箱"
ssh-keygen -t ed25519 -C "your_email@example.com"
cat ~/.ssh/id_ed25519.pub
把公钥复制到:
GitLab → Settings → SSH Keys
git clone git@gitlab.com:用户名/项目名.git
或 HTTPS:
git clone https://gitlab.com/用户名/项目名.git
修改:
external_url 'http://ip:8080'
nginx['listen_port'] = 8080
关闭一些服务:
prometheus['enable'] = false
如果你愿意,可以告诉我:
我可以直接给你一份“照抄可用”的配置。