在Linux上安装GitLab服务器可以通过以下两种主要方式进行:使用Omnibus包安装和基于Docker的安装。以下是详细的步骤:
sudo apt update
sudo apt upgrade
sudo apt install -y curl openssh-server ca-certificates tzdata perl
sudo yum install -y curl policycoreutils-python openssh-server postfix
sudo systemctl enable openssh-server
sudo systemctl start openssh-server
sudo systemctl enable postfix
sudo systemctl start postfix
sudo ufw allow 22/tcp
sudo ufw allow 80/tcp
sudo ufw allow 443/tcp
sudo ufw enable
sudo systemctl stop firewalld
sudo systemctl disable firewalld
sudo systemctl mask firewalld
sudo systemctl start firewalld
curl https://packages.gitlab.com/install/repositories/gitlab/gitlab-ce/script.deb.sh | sudo bash
curl -fsSL https://packages.gitlab.com/install/repositories/gitlab/gitlab-ce/script.rpm.sh | sudo bash
sudo apt get install gitlab-ce
sudo yum install gitlab-ce
/etc/gitlab/gitlab.rb 文件,设置外部URL:sudo vi /etc/gitlab/gitlab.rb
find external_url 'http://your_server_ip',修改为你的服务器IP地址或域名。
sudo gitlab-ctl reconfigure
sudo gitlab-ctl restart
确保你的系统已经安装了Docker。如果没有安装,可以参考Docker官方文档进行安装。Docker安装指南
sudo docker run --detach \
--hostname gitlab.example.com \
--publish 443:443 --publish 80:80 --publish 22:22 \
--name gitlab \
--restart always \
--volume $GITLAB_HOME/config:/etc/gitlab \
--volume $GITLAB_HOME/logs:/var/log/gitlab \
--volume $GITLAB_HOME/data:/var/opt/gitlab \
--shm-size 256m \
registry.gitlab.cn/omnibus/gitlab-ce:latest
--hostname 的值为本机IP,$GITLAB_HOME 处改为自己GitLab的挂载位置。Docker安装文档以上步骤应该能够帮助你在Linux系统上成功安装和配置GitLab。如果在安装过程中遇到任何问题,可以参考GitLab的官方文档或社区论坛寻求帮助。