xiuxuan 发表于 2018-1-11 11:46:07

Gitlab的安装汉化及问题解决

  Gitlab的安装汉化及问题解决(2017/12/14目前版本为10.2.4)
  一、前言
  Gitlab需要安装的包太TM多了,源码安装能愁死个人,一直出错,后来发现几行命令就装的真是遇到的新大陆一样... ...
  装完之后感觉太简单,加了汉化补丁,因为要用于线上环境顺手关了注册登录,保存发现关错了...作死今天上午才弄好,详情见下文
  二、安装
  可以rpm安装下载地址:清华开源网站镜像站
  或者看下图...还用写么... ...centos6版
https://images2017.cnblogs.com/blog/997850/201712/997850-20171214143313232-1028757987.png
  截图不好复制,我来插入一下
  

#sudo是获取root权限的,用root用户搭就不用了  

yum install -y curl policycoreutils-python openssh-server cronie  
lokkit
-s http -s ssh  

  

  
yum install postfix
  
service postfix start
  
chkconfig postfix on
  

  

  
curl https:
//packages.gitlab.com/install/repositories/gitlab/gitlab-ee/script.rpm.sh | bash  

  

  
EXTERNAL_URL="http://gitlab.example.com" yum -y install gitlab-ee
  

  官网还有ubuntu,docker等的安装方式,地址为:

https://images.cnblogs.com/OutliningIndicators/ContractedBlock.gifhttps://images.cnblogs.com/OutliningIndicators/ExpandedBlockStart.gif  

https://about.gitlab.com/installation/#centos-6  


官网地址  写完上面那些就安装完成了,再来更新下配置
  

#先修改个域名,改成自己的域名解析的地址,没有先不改也可以,我开始没改也没错。  
#有说改成自己本机ip的,然后出错的话在external_url和ip直接加等号(没试,用的域名)
  
vim
/etc/gitlab/gitlab.rb  
external_url
'http://gitlab.****.com'  
#更新配置
  
gitlab
-ctl reconfigure  
#查看状态
  
gitlab
-ctl status  
#重启
  
gitlab
-ctl restart  
ok: run: gitaly: (pid
24115) 0s  
ok: run: gitlab
-monitor: (pid 24131) 1s  
ok: run: gitlab
-workhorse: (pid 24147) 0s  
ok: run: logrotate: (pid
24165) 1s  
ok: run: nginx: (pid
24171) 0s  
ok: run: node
-exporter: (pid 24180) 1s  
ok: run: postgres
-exporter: (pid 24192) 0s  
ok: run: postgresql: (pid
24211) 0s  
ok: run: prometheus: (pid
24227) 1s  
ok: run: redis: (pid
24279) 0s  
ok: run: redis
-exporter: (pid 24283) 1s  
ok: run: sidekiq: (pid
24298) 0s  
ok: run: unicorn: (pid
24303) 1s  
#关闭
  
gitlab
-ctl stop  
#启动
  
gitlab
-ctl start  
#监控
  
gitlab
-ctl tail unicorn 监控unicorn日志  
gitlab
-ctl tail  

  

  

  起来之后访问自己的网站地址或者ip,首先让输入的是密码,这个是administrator管理员用户的密码,下面是我搭好的的首页,汉化了,去掉了自动注册,在下面说
https://images2017.cnblogs.com/blog/997850/201712/997850-20171214150003060-2061067944.png
  三、汉化
  Gitlab汉化需要看一下版本号
  cat /opt/gitlab/embedded/service/gitlab-rails/VERSION
  10.2.4-ee
  

#这里也是多方总结  
git clone https:
//gitlab.com/xhang/gitlab.git  
cd gitlab/
  
git fetch
  

  
gitlab
-ctl stop  

  
git
diff origin/10-2-stable origin/10-2-stable-zh > /tmp/10.2.diff  
cd
/opt/gitlab/embedded/service/gitlab-rails  
git apply
/tmp/10.2.diff  
patch -d/opt/gitlab/embedded/service/gitlab-rails -p1 < 10.2.diff
  

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

  四、Gitlab关闭自主注册
  这步要擦亮眼睛擦亮擦亮,关错了就懵逼了,比如说我,关了sign-in,关了登录功能,这功能都可以关闭也是没谁了,给个提醒啊,想改回去时候发现不能登录。。。
  继续上图:
https://images2017.cnblogs.com/blog/997850/201712/997850-20171214154043576-1198463488.png
  慢慢往下找,看到这个了吗,这个勾没了就没有登录了,不能登录,听说重装都不能登录哦
https://images2017.cnblogs.com/blog/997850/201712/997850-20171214154137732-2137591973.png
  这个上面一点,sign-up这个才是要关掉的,第一次关没注意,下面说下怎么解决的
https://images2017.cnblogs.com/blog/997850/201712/997850-20171214154341310-40393807.png
  勾选之后到最后有个save保存生效
  如果不幸勾选错误No authentication methods configured.如图所示:
https://images2017.cnblogs.com/blog/997850/201712/997850-20171214155232545-78192410.png
  旧版解决方法:
  

gitlab-psql gitlabhq_production  
could not change directory to
"/root": Permission denied  
psql (
9.6.5)  
Type
"help" for help.  

  
update application_settings SET signin_enabled
=true;  

  
UPDATE
1  
gitlabhq_production
=# \q  
gitlab
-ctl restart  

  如果出现下面错误用新版的
  ERROR:column "signin_enabled" of>  LINE 1: update application_settings SET signin_enabled=true;
  因为这个版本还有 signup_enabled可以在数据库关掉自主注册,但是没有 signin_enabled这个了,有这个东西sign_in_text_html,可以在首页左中空白位置写内容
  新版解决方法:

https://images.cnblogs.com/OutliningIndicators/ContractedBlock.gifhttps://images.cnblogs.com/OutliningIndicators/ExpandedBlockStart.gif
  

gitlab-psql gitlabhq_production  
could not change directory to
"/root": Permission denied  
psql (
9.6.5)  
Type
"help" for help.  

  
gitlabhq_production
=# update application_settings set password_authentication_enabled = true;  
UPDATE
1  
gitlabhq_production
=# \q  
gitlab
-ctl restart  


折叠方法  gitlab-psql gitlabhq_production
  could not change directory to "/root": Permission denied
  psql (9.6.5)
  Type "help" for help.
  gitlabhq_production=# update application_settings set password_authentication_enabled = true;
  UPDATE 1
  gitlabhq_production=# \q
  gitlab-ctl restart
  五、总结
  安装gitlab除了自己眼瘸了一下没有遇到其他的错误,看有的错误是因为安装过程中端口被占用
  yum install -y lsof
  lsof -i:80
  lsof -i:8080
  

gitlab-ctl tail unicorn这个监控命令也很好用  
页: [1]
查看完整版本: Gitlab的安装汉化及问题解决