💎一站式轻松地调用各大LLM模型接口,支持GPT4、智谱、星火、月之暗面及文生图 广告
=============================================== https://www.cnblogs.com/roam/p/7677836.html https://blog.csdn.net/yulei_qq/article/details/53033381 =============================================== 作为公司层面使用gitlab,进行维护时一定要考虑升级、备份、迁移/恢复的事情,代码安全是研发部门的重心之一,故我也整理了下面的内容供维护人员参考。 升级:http://www.cnblogs.com/straycats/p/7707359.html 本地备份:http://www.cnblogs.com/straycats/p/7671204.html 远程备份:http://www.cnblogs.com/straycats/p/7672692.html 迁移/恢复:http://www.cnblogs.com/straycats/p/7702271.html 卸载 https://yq.aliyun.com/articles/114619 安装 ~~~ 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 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 >> /root/install_gitlab/20180410.log cd /root/install_gitlab patch -d /opt/gitlab/embedded/service/gitlab-rails -p1 < 10.6.2-zh.diff >> /root/install_gitlab/20180410.log cp /etc/gitlab/gitlab.rb /etc/gitlab/gitlab.rb.bak echo "==========replace url" sed -i '13s/gitlab.example.com/192.168.1.201/' /etc/gitlab/gitlab.rb echo "==========replace url" sed -i '13s/gitlab.example.com/192.168.1.201/' /etc/gitlab/gitlab.rb gitlab-ctl start gitlab-ctl reconfigure >> /root/install_gitlab/20180410.log echo "done" ~~~ 修改ip ~~~ gitlab-ctl stop sed -i '13s/gitlab.example.com/192.168.1.201/' /etc/gitlab/gitlab.rb gitlab-ctl start gitlab-ctl reconfigure ~~~ 卸载 ~~~ 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 ~~~ 检查 ~~~ head -n 15 /etc/gitlab/gitlab.rb ps -ef| grep "opt/gitlab*" grep '^[^#]' /etc/gitlab/gitlab.rb ~~~ 全量脚本 ~~~ #!/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 /run/gitlab rm -rf /etc/gitlab rm -rf /var/log/gitlab rm -rf /var/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.199/' /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" cat >> /etc/crontab <<EOF 0 0,3,6,9,12,15,18,21 * * * /opt/gitlab/bin/gitlab-rake gitlab:backup:create EOF ~~~ .