建站服务

1、先安装GitLab:

1.1 安装gitlab的依赖项

yum install -y curl openssh-server openssh-clients cronie policycoreutils-python

1.2 安装并启动postfix,并设置为开机启动

yum install postfix
service postfix start
chkconfig postfix on

systemctl start postfix   #centos7.x
systemctl enable postfix  #centos7.x

1.3 设置或关闭防火墙

chkconfig iptables off #centos6.x

firewall-cmd --add-service=http --permanent
firewall-cmd --reload  #centos7.x
systemctl stop firewalld.service #centos7.x
systemctl disable firewalld.service

1.4 禁用selinux安全

vi /etc/selinux/config 

#SELINUX=enforcing
SELINUX=disabled

先安装Git:

yum install -y git

1.5 获取gitlab的rpm包(10.2.8社区免费版)

建站服务

通过清华开源镜像站:

wget https://mirrors.tuna.tsinghua.edu.cn/gitlab-ce/yum/el6/gitlab-ce-10.2.8-ce.0.el6.x86_64.rpm # CentOS6.X
wget https://mirrors.tuna.tsinghua.edu.cn/gitlab-ce/yum/el7/gitlab-ce-10.5.6-ce.0.el7.x86_64.rpm # CentOS7.X

1.6 安装rpm包

rpm -i gitlab-ce-10.2.8-ce.0.el6.x86_64.rpm # CentOS6.X rpm -i gitlab-ce-10.5.6-ce.0.el7.x86_64.rpm # CentOS7.X

1.7 修改配置文件gitlab.rb

vi /etc/gitlab/gitlab.rb

#将external_url变量的地址修改为gitlab所在centos的ip地址

1.8 重新加载配置内容

gitlab-ctl reconfigure

gitlab-ctl restart

1.9 安装汉化包

#yum install -y git
git clone https://gitlab.com/xhang/gitlab.git -b v10.5.6-zh
cat gitlab/VERSION
cd gitlab/
git fetch

gitlab-ctl stop
# 生成补丁包
git diff origin/10-5-stable origin/10-5-stable-zh > /tmp/10.5.diff
cd /opt/gitlab/embedded/service/gitlab-rails
git apply /tmp/10.5.diff
patch -d /opt/gitlab/embedded/service/gitlab-rails -p1 < /tmp/10.5.diff

#这步好像可以不用,我直接打上了
gitlab-ctl reconfigure
#启动
gitlab-ctl start
建站服务