1.先安装相关依赖


  1. yum -y install policycoreutils openssh-server openssh-clients postfix

2.启动postfix,并设置开机自启动


systemctl enable postfix && systemctl start postfix

3.下载并安装Gitlab社区版RPM包


wget --content-disposition https://packages.gitlab.com/gitlab/gitlab-ce/packages/el/7/gitlab-ce-10.5.2-ce.0.el7.x86_64.rpm/download.rpm  #下载

rpm -ivh gitlab-ce-10.5.2-ce.0.el7.x86_64.rpm      #安装

4.修改gitlab配置文件指定服务器ip和自定义端口,工作空间


mkdir -p /home/gitlab/worksapce

vim /etc/gitlab/gitlab.rb

external_url 'http://192.168.0.51:8001'

git_data_dir "/home/gitlab/worksapce"

5.重置并启动Gitlab

gitlab-ctl reconfigure #重置

gitlab-ctl restart  #重启



启用 Gitlab 开机自启动:
systemctl enable gitlab-runsvdir.service


禁止 Gitlab 开机自启动:
systemctl disable gitlab-runsvdir.service