在Debian上安装和配置GitLab涉及几个步骤,以下是一个详细的教程,帮助你完成整个过程:
更新系统:
sudo apt update
sudo apt upgrade
安装必要的依赖项:
sudo apt install curl openssh-server ca-certificates postfix
在安装Postfix期间,请确保邮件配置选项为“Internet Site”。
添加GitLab官方存储库:
curl -sS https://packages.gitlab.com/install/repositories/gitlab/gitlab-ce/script.deb.sh | sudo bash
安装GitLab CE:
sudo apt install gitlab-ce
在安装过程中,系统会提示你设置管理员密码和域名,请按照提示进行操作。
重新配置GitLab:
sudo gitlab-ctl reconfigure
配置防火墙:
sudo ufw status
sudo ufw enable
sudo ufw allow 80/tcp
启动GitLab服务:
sudo gitlab-ctl start
或者设置GitLab开机自启:
sudo systemctl enable gitlab
浏览器访问: 在浏览器中输入你的GitLab服务器的IP地址或域名,首次访问时会提示你输入root账户的初始密码。
修改初始密码: 使用以下命令查看初始密码:
sudo cat /etc/gitlab/initial_root_password
创建项目:
邀请成员:
管理仓库:
启用Let’s Encrypt:
编辑/etc/gitlab/gitlab.rb
文件,设置以下参数:
letsencrypt['enable'] = true
letsencrypt['auto_renew'] = true
letsencrypt['contact_emails'] = ['admin@example.com']
重新配置并重启GitLab:
sudo gitlab-ctl reconfigure
sudo gitlab-ctl restart
通过以上步骤,你就可以在Debian系统上成功安装和配置GitLab。更多详细信息和高级配置,请参考[GitLab官方文档](https://docs.gitlab.com/ee/install/。