1、 安装并配置必要的依赖关系
CentOS系统上,下面的命令将会打开系统防火墙HTTP和SSH的访问
sudo yum install -y curl policycoreutils-python openssh-server
sudo systemctl enable sshd
sudo systemctl start sshd
sudo firewall-cmd --permanent --add-service=http
sudo systemctl reload firewalld
2、 安装Postfix邮件服务器
sudo yum install postfix
sudo systemctl enable postfix
sudo systemctl start postfix
3、 添加 GitLab 镜像源
curl -sS https://packages.gitlab.com/install/repositories/gitlab/gitlab-ce/script.rpm.sh | sudo bash
4、 安装GitLab服务并配置访问域名
方式1(推荐):sudo EXTERNAL_URL="http://gitlab.mxboo.com" yum install -y gitlab-ce
方式2:sudo yum install gitlab-ce,安装完毕需要配置gitlab.yml文件的host为你的域名或ip
5、 配置并启动 GitLab
sudo gitlab-ctl reconfigure
6、 常用命令:查看状态、启动、停止、重启gitlab服务
# 查看Gitlab服务状态
sudo gitlab-ctl status
# 启动Gitlab所有组件
sudo gitlab-ctl start
# 停止Gitlab所有组件
sudo gitlab-ctl stop
# 重启Gitlab所有组件
sudo gitlab-ctl restart
7、 通过浏览器访问上一步配置的域名
第一次访问 GitLab,系统会重定向 url 到重置密码的页面,你需要输入初始化管理员账号不少于8位的密码,例如可以设置为:root1234,设置完成后,系统会重定向到登录界面,你就可以使用刚才输入的密码登录系统了。
系统默认的管理员账号为 root,登录系统后,你可以修改管理员账号为自己喜欢的账号。
8、 问题集锦:域名映射IP以后,项目的的域名没有改变
这个就是采用了第4条中方式2安装后的问题
答:修改/opt/gitlab/embedded/service/gitlab-rails/config/gitlab.yml文件,更改host为需要映射到的域名或ip
9、 GitLab创建完新用户,新用户可以Create Project,也可以clone项目到本地,但无法push代码到远端仓库
答:root用户创建完group、user以后,需要对新创建的用户授权分组的权限。以下是详细步骤截图
大家有什么问题可以私信我,看到后会及时给大家解答的