#!/bin/bash
kk=`ip a|grep ens|grep inet|awk -F ' ' '{print $2}'|awk -F '/' '{print $1}'`
echo "[gitlab-ce]" >> /etc/yum.repos.d/gitlab-ce.repo
echo "name=Gitlab CE Repository" >> /etc/yum.repos.d/gitlab-ce.repo
echo "baseurl=https://mirrors.tuna.tsinghua.edu.cn/gitlab-ce/yum/el$releasever/" >> /etc/yum.repos.d/gitlab-ce.repo
echo "gpgcheck=0" >> /etc/yum.repos.d/gitlab-ce.repo
echo "enabled=1" >> /etc/yum.repos.d/gitlab-ce.repo
yum makecache
yum -y install gitlab-ce
sed -i "/external_url 'http://gitlab.example.com'/aexternal_url 'http://$kk'" /etc/gitlab/gitlab.rb
sed "/# unicorn['port'] = 8080/aunicorn['port'] = 9999" /etc/gitlab/gitlab.rb //修改端口,不然很可能网页出现505的错误
gitlab-ctl reconfigure
gitlab-ctl restart