gitlab升级、汉化、修改root密码

1.gitlab升级

# 查看当前版本
head -1 /opt/gitlab/version-manifest.txt
gitlab-ce 8.9.5
grep "^external_url" /etc/gitlab/gitlab.rb
external_url 'http://10.0.0.26'
wget https://mirrors.tuna.tsinghua.edu.cn/gitlab-ce/yum/el7/gitlab-ce-10.0.4-ce.0.el7.x86_64.rpm

# 关闭部分gitlab服务
gitlab-ctl stop unicorn
gitlab-ctl stop sidekiq
gitlab-ctl stop nginx
rpm -Uvh gitlab-ce-10.0.4-ce.0.el7.x86_64.rpm

报错,10.x以后开始依赖policycoreutils-python,之前在使用9.x时还没有依赖该项

policycoreutils-python is needed by gitlab-ce-10.0.4-ce.0.el7.x86_64
yum -y install policycoreutils-python

rpm -Uvh gitlab-ce-10.0.4-ce.0.el7.x86_64.rpm
gitlab preinstall: Your version of PostgreSQL is no longer supported. 
Please upgrade your PostgreSQL version

信息选自GIitLab官网:

从版本10.0开始,GitLab要求PostgreSQL的版本为9.6或更高;对于运行8.15以下版本的用户,这意味着他们必须首先升级到9.5,其中PostgreSQL将自动更新为9.6.

对于运行8.15以下版本的用户,这意味着他们必须首先升级到9.5,其中PostgreSQL将自动更新为9.6.
wget https://mirrors.tuna.tsinghua.edu.cn/gitlab-ce/yum/el7/gitlab-ce-9.5.9-ce.0.el7.x86_64.rpm
rpm -Uvh gitlab-ce-9.5.9-ce.0.el7.x86_64.rpm

gitlab-ctl reconfigure
gitlab-ctl restart
gitlab-ctl stop unicorn
gitlab-ctl stop sidekiq
gitlab-ctl stop nginx
# 注意:不能把服务全部关闭,尤其是pgsql,gitlab要去备份数据,得连上数据库,除非你跳过备份
touch /etc/gitlab/skip-auto-migration

# 接下来就可以开始正式安装了
rpm -Uvh gitlab-ce-10.0.4-ce.0.el7.x86_64.rpm
gitlab-ctl reconfigure
gitlab-ctl restart    # 等待30s访问网页

2.汉化

想下载老版本的汉化包,用这条命令:

git clone https://gitlab.com/xhang/gitlab.git -b v10.0.2-zh

# 克隆获取汉化版本库 
git clone https://gitlab.com/xhang/gitlab.git
cat gitlab/VERSION  # 但我的gitlab版本是10.0.4
11.5.7
gitlab-ctl stop
cd /root/gitlab
git diff v10.0.4 v10.0.4-zh > ../10.0.4-zh.diff
yum -y install patch
patch -d /opt/gitlab/embedded/service/gitlab-rails -p1 < 10.0.4-zh.diff
gitlab-ctl start  # 想第二次汉化时,比如生成了一个10.0.6-zh.diff,导入时会各种报错

界面:

3.忘记root密码

gitlab-rails console production
user = User.where(id: 1).first
user.password='yourpassword'  # 密码必须至少8个字符
user.save!  # 修改成功会返回true
quit        # 目前root密码是root-root123456789

关联LDAP可以去这个-大牙啊:http://blog.51cto.com/13520772/2133739

关联LDAP-粽先生:https://www.cnblogs.com/straycats/p/7487780.html#top

升级参考博文:https://www.ilanni.com/?p=13917

gitlab升级-粽先生:https://www.cnblogs.com/straycats/p/7707359.html

原文地址:https://www.cnblogs.com/fawaikuangtu123/p/10295914.html