在Linux系统上配置GitLab涉及多个关键步骤,以下是一个详细的指南:
sudo apt-get update sudo apt-get install -y curl openssh-server ca-certificates tzdata sudo yum install -y curl openssh-server postfix # 在Ubuntu上 curl -s https://packages.gitlab.com/install/repositories/gitlab/gitlab-ce/script.deb.sh | sudo bash sudo apt-get install gitlab-ce # 在CentOS上 curl -s https://packages.gitlab.com/install/repositories/gitlab/gitlab-ce/script.rpm.sh | sudo bash sudo yum install gitlab-ce 配置外部URL:
sudo vim /etc/gitlab/gitlab.rb 找到并修改 external_url 'http://your_server_ip'。
配置数据库(默认使用PostgreSQL):
sudo -u postgres psql -c "CREATE DATABASE gitlab;" sudo -u postgres psql -c "CREATE USER gitlab WITH PASSWORD 'your_password';" sudo -u postgres psql -c "ALTER ROLE gitlab SET client_encoding TO 'utf8';" sudo -u postgres psql -c "ALTER ROLE gitlab SET default_transaction_isolation TO 'read committed';" sudo -u postgres psql -c "ALTER ROLE gitlab SET timezone TO 'UTC';" 重新配置GitLab:
sudo gitlab-ctl reconfigure sudo gitlab-ctl start 在浏览器中输入你的服务器IP或域名,按照提示完成初始设置。
sudo ufw allow 'Nginx Full' sudo ufw allow 'OpenSSH' sudo ufw enable sudo systemctl enable gitlab-ce sudo systemctl start gitlab-ce /etc/gitlab/gitlab.rb 文件,然后运行 gitlab-ctl reconfigure 命令。/var/opt/gitlab/backups 目录下。以上步骤涵盖了在Linux系统上配置GitLab的基本流程,具体操作可能会因Linux发行版和版本的不同而有所差异。建议参考GitLab官方文档以获取更详细的指导。