自己在鼓捣GitLab时遇到很多坑,下面记录下过程,希望对需要的人有帮助。
参考:
Gitlab gitlab-ce-8.16.4-ce 安装文档
1.在root用户下执行
$: sudo yum installcurl openssh-serveropenssh-clients postfix cronie -y
$: sudo service postfixstart
这里可能会报错如下:
$: Job for postfix.service failed because the control process exited with error code. See "systemctl status postfix.service" and "journalctl -xe" for details.
解决方法:修改 /etc/postfix/main.cf的设置,然后重新执行上面的命令
inet_protocols = ipv4
inet_interfaces = all
$: sudo chkconfig postfixon
$: sudo lokkit -shttp-s ssh
这个错误
lokkit: command not found
$:yum -y install lokkit $:sudo lokkit -s http -s ssh
2.添加Gitlab仓库,并安装在服务器上
版本说明: 本文使用的是国内镜像下载安装方式,比国外网站下载速度快;
CentOS (内核6.x)https://mirrors.tuna.tsinghua.edu.cn/gitlab-ce/yum/el6
,选择需要的版本进行安装。
CentOS (内核7.x)https://mirrors.tuna.tsinghua.edu.cn/gitlab-ce/yum/el7,选择需要的版本进行安装。
$:cd /usr/local/src
$:wget https://mirrors.tuna.tsinghua.edu.cn/gitlab-ce/yum/el6/gitlab-ce-8.5.7-ce.0.el7.x86_64.rpm
$:rpm -ivh gitlab-ce-8.5.7-ce.0.el7.x86_64.rpm
3.gitlab-ce设置
新建/etc/yum.repos.d/gitlab-ce.repo
$:vim/etc/yum.repos.d/gitlab-ce.repo// 添加如下内容
[gitlab-ce]
name=Gitlab CE Repository
baseurl=https://mirrors.tuna.tsinghua.edu.cn/gitlab-ce/yum/el$releasever/
gpgcheck=0
enabled=1
$:sudo yum makecache
$:sudo yum install gitlab-ce
4.创建gitlab.rb配置文件
$:sudo mkdir -p/etc/gitlab
$:sudo touch /etc/gitlab/gitlab.rb
$:sudo chmod 600 /etc/gitlab/gitlab.rb
5.添加web访问的IP地址
$: vim /etc/gitlab/gitlab.rb// 添加以下内容
external_url 'http://XXX.XXX.XXX.XXX' # 部署Gitlab的主机IP
6.启动Gitlab
$: sudo gitlab-ctl reconfigure
注意:每次修改完配置文件,都需要重新生效,执行sudo gitlab-ctl reconfigure
相关命令(供安装人员参考使用):
$: sudo gitlab-ctl start # gitlab启动
$: sudo gitlab-ctl restart # gitlab重启
$: sudo gitlab-ctl stop # gitlab停止
$: sudo gitlab-ctl status # gitlab状态
7.安装中文语言包(汉化)
以下汉化步骤参考此篇文章,首先确认当前安装版本
$: cat /opt/gitlab/embedded/service/gitlab-rails/VERSION
克隆 GitLab 源码仓库:
$: git clone https://gitlab.com/larryli/gitlab.git
#或 Gitcafe.com 镜像,速度更快
$: git clone https://gitcafe.com/larryli/gitlab.git
切换到gitlab汉化包所在的目录
$: cd /root/gitlab
比较汉化标签和原标签,导出diff 文件到/root下
$: git diff v8.5.7 v8.5.7-zhl > ../8.5.7-zh.diff
4.4 回到/root目录
$: cd
停止 gitlab
$: sudo gitlab-ctl stop
应用汉化补丁
$: cd /opt/gitlab/embedded/service/gitlab-rails
$: git apply /tmp/8.5.diff
启动gitlab
$: sudo gitlab-ctl start
至此,汉化完毕。
网友评论