20180408
~~~
yum -y install lsof wget net-tools vim
mv /etc/yum.repos.d /etc/yum.repos.d.backup.20180408
mkdir /etc/yum.repos.d
wget -O /etc/yum.repos.d/CentOS-Base.repo http://mirrors.aliyun.com/repo/Centos-7.repo
yum clean all
yum makecache
~~~
~~~
#!/usr/bin/bash
echo "=========uninstall "
gitlab-ctl stop
kill -9 $(ps -ef| grep "opt/gitlab*"|grep -v grep |grep runsvdir|awk '{print $2}')
rpm -e gitlab-ce
find / -path "/root" -prune -o -type f -name "*gitlab*" -print |xargs rm -rf
rm -rf /opt/gitlab
echo "==========install dependency"
yum install -y git
yum install -y curl openssh-server openssh-clients postfix cronie policycoreutils-python
cd
if [ ! -d install_gitlab ]; then
mkdir install_gitlab
fi
cd install_gitlab/
echo "==========clone path"
if [ ! -d gitlab ]; then
git clone https://gitlab.com/xhang/gitlab.git -b v10.6.2-zh
fi
echo "==========down rpm"
if [ ! -f gitlab-ce-10.6.2-ce.0.el7.x86_64.rpm ] ; then
wget https://mirrors.tuna.tsinghua.edu.cn/gitlab-ce/yum/el7/gitlab-ce-10.6.2-ce.0.el7.x86_64.rpm
fi
echo "==========install rpm"
rpm -i gitlab-ce-10.6.2-ce.0.el7.x86_64.rpm >> /root/install_gitlab/20180410.log
echo "==========replace url"
sed -i '13s/gitlab.example.com/192.168.1.201/' /etc/gitlab/gitlab.rb
#echo "==========config"
#gitlab-ctl reconfigure >> /root/install_gitlab/20180410.log
#gitlab-ctl restart
#gitlab-ctl stop
echo "==========git path"
yum install patch -y
cd /root/install_gitlab/gitlab
rm -rf ../10.6.2-zh.diff
git diff v10.6.2 v10.6.2-zh > ../10.6.2-zh.diff
echo "==========do path"
cd /root/install_gitlab
patch -d /opt/gitlab/embedded/service/gitlab-rails -p1 < 10.6.2-zh.diff
echo "==========start gitlab"
gitlab-ctl start
echo "==========config gitlab"
gitlab-ctl reconfigure >> /root/install_gitlab/20180410.log
echo "done"
~~~
~~~
systemctl stop firewalld.service #停止firewall
systemctl disable firewalld.service #禁止firewall开机启动
firewall-cmd --state #查看默认防火墙状态(关闭后显示notrunning,开启后显示running)
~~~