Gitlab安装、汉化及使用

环境:centos

关闭防火墙和selinux

[root@Gitlab ~]# setenforce  0
[root@Gitlab ~]# service iptables stop && chkconfig  iptables  off

安装Gitlab

安装方式分两种: RPM安装、YUM安装 <不演示YUM安装>

rpm安装:

[root@Gitlab ~]# wget   https://mirrors.tuna.tsinghua.edu.cn/gitlab-ce/yum/el6/gitlab-ce-11.1.4-ce.0.el6.x86_64.rpm

[root@Gitlab ~]# rpm   -ivh   gitlab-ce-11.1.4-ce.0.el6.x86_64.rpm       #默认安装在/opt目录,如果提示需要

GitLab常用命令

sudo gitlab-ctl start    # 启动所有 gitlab 组件;

sudo gitlab-ctl stop        # 停止所有 gitlab 组件;

sudo gitlab-ctl restart        # 重启所有 gitlab 组件;

sudo gitlab-ctl status        # 查看服务状态;

sudo gitlab-ctl reconfigure        # 启动服务;

sudo vim /etc/gitlab/gitlab.rb        # 修改默认的配置文件;

gitlab-rake gitlab:check SANITIZE=true --trace    # 检查gitlab;

sudo gitlab-ctl tail        # 查看日志

配置

[root@Gitlab ~]# vim  /etc/gitlab/gitlab.rb 

external_url 'http://192.168.1.111'       //写server的IP,绝对不能写默认的hostname!!!

//需要修改端口,设置端口前确认端口没有没占用
//使用 netstat -anp | grep 端口,如果查找为空可以使用该端口

unicorn['port'] = 8088        //为了防止汉化后502就改端口
 

汉化

[root@Gitlab ~]# gitlab-ctl  stop

[root@Gitlab ~]# git clone https://gitlab.com/xhang/gitlab.git     //汉化包

[root@Gitlab ~]# cd gitlab/

[root@Gitlab ~]# git diff v10.0.2 v10.0.2-zh > ../10.0.2-zh.diff    //没问题就没有提示

[root@Gitlab ~]#patch -d /opt/gitlab/embedded/service/gitlab-rails -p1 < /mnt/10.0.2-zh.diff//刚刚git克隆出来的diff文件,需要打绝对路径
******如果没有 patch命令需yum安装 命令为:yum install patch******
[root@Gitlab ~]# gitlab-ctl reconfigure //重新刷新配置 [root@Gitlab ~]# gitlab-ctl start
访问地址http://ip由于第一次登陆,需要设置密码
如果在这一步发现502,先stop掉Gitlab(gitlab-ctl stop)
[root@Gitlab ~]#vim  /etc/gitlab/gitlab.rb   //改unicorn['port'] 改端口,为的防止冲突

[root@Gitlab ~]# gitlab-ctl reconfigure

[root@Gitlab ~]# reboot                  //改完需要reboot

[root@Gitlab ~]# gitlab-ctl start

再次访问web就会发现熟悉的中文啦

 

猜你喜欢

转载自www.cnblogs.com/guanyf/p/10600932.html