在CentOS上通过Docker容器化部署GitLab是一个相对简单且高效的方法。以下是详细的步骤指南:
docker pull gitlab/gitlab-ce
docker run --detach \
--hostname gitlab.example.com \
--publish 443:443 \
--publish 80:80 \
--publish 22:22 \
--name gitlab \
--restart always \
-v /path/to/gitlab/config:/etc/gitlab \
-v /path/to/gitlab/logs:/var/log/gitlab \
-v /path/to/gitlab/data:/var/opt/gitlab \
gitlab/gitlab-ce:latest
/path/to/gitlab
是你希望用于挂载GitLab配置、日志和数据卷的本地目录。http://<your-server-ip>:80
来登录GitLab管理界面。首次访问时,系统会提示你设置新的管理员密码。Settings
-> General
,修改External URL
为你的服务器IP地址或域名。sudo firewall-cmd --permanent --add-service=http
sudo firewall-cmd --permanent --add-service=https
sudo firewall-cmd --permanent --add-service=ssh
sudo firewall-cmd --reload
通过以上步骤,你应该能够在CentOS上成功部署并运行GitLab容器化应用。如果在部署过程中遇到任何问题,可以参考GitLab的官方文档或寻求社区帮助。