一、简介

GitLab是一个利用 Ruby on Rails 开发的开源应用程序,实现一个自托管的Git项目仓库,可通过Web界面进行访问公开的或者私人项目。
GitLab拥有与Github类似的功能,能够浏览源代码,管理缺陷和注释。可以管理团队对仓库的访问,它非常易于浏览提交过的版本并提供一个文件历史库。它还提供一个代码片段收集功能可以轻松实现代码复用,便于日后有需要的时候进行查找。

二、基础环境准备  

2.1 安装依赖包

如想使用Postfix来发送邮件,在安装期间请选择’Internet Site’. 您也可以用sendmai或者 配置SMTP服务 并 使用SMTP发送邮件.在 Centos 6 系统上, 下面的命令将在系统防火墙里面开放HTTP和SSH端口.
[root@db01 ~]# yum install curl policycoreutils openssh-server openssh-clients postfix
[root@db01 ~]# /etc/init.d/postfix start

2.2 添加GitLab仓库  

[root@ db01 ~]# curl -sS https://packages.gitlab.com/install/repositories/gitlab/gitlab-ce/script.rpm.sh | sudo bash
[root@ db01 ~]# yum install -y gitlab-ce

2.3 可更换国内源

[root@linux-node2 ~]# vim /etc/yum.repos.d/gitlab-ce.repo
[gitlab-ce]
name=gitlab-ce
baseurl=http://mirrors.tuna.tsinghua.e ... m/el7
repo_gpgcheck=0
gpgcheck=0
enabled=1
gpgkey=https://packages.gitlab.com/gpg.key
[root@linux-node2 ~]# yum makecache
[root@linux-node2 ~]# yum install gitlab-ce

2.4配置并启动gitlab-ce

#注意:在配置gitlab之前保证80端口没有被占用
[root@db01 ~]# gitlab-ctl reconfigure

2.5 检查状态

[root@db01 src]# gitlab-ctl status
run: gitaly: (pid 23978) 37s; run: log: (pid 23342) 134s
run: gitlab-monitor: (pid 23998) 37s; run: log: (pid 23576) 122s
run: gitlab-workhorse: (pid 23958) 38s; run: log: (pid 23067) 152s
run: logrotate: (pid 23245) 140s; run: log: (pid 23244) 140s
run: nginx: (pid 23156) 146s; run: log: (pid 23155) 146s
run: node-exporter: (pid 23518) 128s; run: log: (pid 23517) 128s
run: postgres-exporter: (pid 24042) 34s; run: log: (pid 23757) 104s
run: postgresql: (pid 22636) 220s; run: log: (pid 22635) 220s
run: prometheus: (pid 24021) 35s; run: log: (pid 23688) 110s
run: redis: (pid 22503) 226s; run: log: (pid 22502) 226s
run: redis-exporter: (pid 23632) 116s; run: log: (pid 23631) 116s
run: sidekiq: (pid 22998) 158s; run: log: (pid 22997) 158s
run: unicorn: (pid 22930) 164s; run: log: (pid 22929) 164s
[root@db01 src]#

gitlab-ctl status

2.6 管理gitlab

 ifconfig eth0|awk -F '[ :]+' 'NR==2{print $4}'
# 获取网卡地址

三、安装汉化包

3.1 准备环境

[root@db01 ~]# cd /data/src/
[root@db01 src]# git clone https://gitlab.com/xhang/gitlab.git
-bash: git: command not found
[root@db01 src]# yum -y install git
[root@db01 src]# git clone https://gitlab.com/xhang/gitlab.git

3.2 停止gitlab

[root@db01 ~]# gitlab-ctl stop

3.3  汉化操作

# 查看改汉化补丁版本
[root@db01 src]# cat gitlab/VERSION
10.7.3

3.4 获取gitlab汉化包

[root@db01 src]# cd gitlab/
[root@db01 gitlab]# git diff origin/10-7-stable origin/10-7-stable-zh > /tmp/10.7.diff
[root@db01 gitlab]#

3.5 更新补丁到gitlab中

[root@db01 gitlab]# yum -y install patch
[root@db01 gitlab]# cd /tmp/
[root@db01 tmp]# patch -d/opt/gitlab/embedded/service/gitlab-rails -p1 < 10.7.diff

3.6 重新配置gitlab

[root@db01 tmp]# gitlab-ctl reconfigure
[root@db01 tmp]# gitlab-ctl start

四、gitlal管理设置

4.1 设置管理密码

4.2 创建gitlab群组

4.3 给群组创建项目

创建完成之后它提示我们可以创建一个key对它进行管理

我们点击上面的README然后我们随便在里面写点东西

4.4 添加密钥

[root@db01 ~]# ssh-keygen -t rsa
Generating public/private rsa key pair.
Enter file in which to save the key (/root/.ssh/id_rsa):
Created directory '/root/.ssh'.
Enter passphrase (empty for no passphrase):
Enter same passphrase again:
Your identification has been saved in /root/.ssh/id_rsa.
Your public key has been saved in /root/.ssh/id_rsa.pub.
The key fingerprint is:
f7:66:6d:4c:74:38:70:8b:47:df:78:5c:4c:bd:2a:ed root@db01
The key's randomart image is:
+--[ RSA 2048]----+
| . oo+|
| = *=|
| . B B|
| o = |
| S . . o |
| . o * |
| * + |
| o E |
| |
+-----------------+
[root@db01 ~]#

查看公共密钥

[root@db01 ~]# cat .ssh/id_rsa.pub
ssh-rsa AAAAB3NzaC1yc2EAAAABIwAAAQEAqgVmWXspLgcvmhKfXk83Hj14n5EXE1GHzIc7FD747jH2wTGgRUCcaHIJ4QAwmAqta312SM2vlZQiuNaaZYDa01QBlnpZbimxcQolbvcFISH3HB/O5iPX/Hri4nEKnfSL72N9QTQMDTVJhCDuv6rP1ptusuNGliXyQRvaypWqUlfBkFIUc3gB8fhhXLrxNxeYdmLfCB7ZqyJSpELTxunDtUo68taA3bJADVYbhRzY+85YT1BW3ggtVlzyYBqsWboO+QNGGNUmJ/tvVh9tFez5zgqJSMlTqGLbfrv+rCKIDZVpGotooxMzMDsDZnW26NcfRJeDV6E7C4hOODg6l3XQ4Q== root@db01
[root@db01 ~]#

cat .ssh/id_rsa.pub

4.5 添加免密验证

4.6 拉取代码

1. 创建代码目录

[root@db01 ~]# mkdir /data/code -p
[root@db01 ~]# cd /data/code/
[root@db01 code]#

2. git拉取代码

没有安装git直接yum
yum -y install git

[root@db01 code]# git clone git@gitlab.example.com:web/web-demo.git
Initialized empty Git repository in /data/code/web-demo/.git/
The authenticity of host 'gitlab.example.com (2x7.xxx.3x.xxx)' can't be established.
RSA key fingerprint is 58:61:9a:f3:c9:b0:cf:xx:16:7e:d3:8c:xx:d9:aa:xx.
Are you sure you want to continue connecting (yes/no)? yes
Warning: Permanently added 'gitlab.example.com,2x7.xxx.xx.xxx' (RSA) to the list of known hosts.
warning: You appear to have cloned an empty repository.
[root@db01 code]# ll
total 4
drwxr-xr-x. 3 root root 4096 May 15 13:21 web-demo
[root@db01 code]#

3. 先hosts修改制定一下域名,后续修改成地址

[root@db01 code]# tail -1 /etc/hosts
2xx.xxx.xx.xxx gitlab.example.com
[root@db01 code]# ping gitlab.example.com
PING gitlab.example.com (xx.xxx.xx.xxx) 56(84) bytes of data.
64 bytes from gitlab.example.com (2xx.xxx.xx.xxx): icmp_seq=1 ttl=64 time=0.012 ms

4.7 提交代码

4.7.1 新建文件

[root@db01 code]# cat web-demo/index.html
hello word 创建第一个index.html文件
由于测试提交代码
[root@db01 code]#git add .
[root@db01 code]#git commit -m 'add index.html'

4.7.2 添加别名

[root@db01 web-demo]# git remote add origin git@gitlab.example.com:web/web-demo.git
fatal: remote origin already exists.
[root@db01 web-demo]# git pull origin master
fatal: Couldn't find remote ref master
fatal: The remote end hung up unexpectedly
[root@db01 web-demo]# git push origin master
Counting objects: 3, done.
Delta compression using up to 8 threads.
Compressing objects: 100% (2/2), done.
Writing objects: 100% (3/3), 281 bytes, done.
Total 3 (delta 0), reused 0 (delta 0)
To git@gitlab.example.com:web/web-demo.git
* [new branch] master -> master
[root@db01 web-demo]#

add origin

4.8 修改gitlab主机名

#改成相应的IP地址或者域名即可
[root@db01 web-demo]# cat -n /etc/gitlab/gitlab.rb |grep '222'
13 external_url 'http://2xx.xxx.xx.xxx'
[root@db01 web-demo]#gitlab-ctl reconfigure
#提示:修改完需要从新配置才会生效

附录:总结及服务器配置

1. gitlab由于是java开发的所以比较占内存;
2. 如果内存比较小的话建议修改配置文件
unicorn['worker_processes'] = 1 #默认为2,1不能在线创建文件或修改
3. 配置
CPU:8核
内存:8G
磁盘:500G
系统:CentOS6.5

Gitlab部署及汉化操作的更多相关文章

  1. centos 7 gitlab部署 以及汉化

    =============================================== 2018-04-26   08:56:48 ============================== ...

  2. gitlab部署步骤+汉化

    系统环境centos7 下载gitlab安装包 https://packages.gitlab.com/gitlab/gitlab-ce 我下载的版本是 gitlab-ce-11.1.4-ce.0.e ...

  3. gitlab部署及汉化

    目录 Git 简介 部署 1. 配置yum源(推荐) 2. 安装 配置GitLab 1.加载配置 2.修改git默认访问端口 gitlab.rb unicorn.rb gitlab-http.conf ...

  4. Centos7安装部署搭建gitlab平台、汉化

    Centos7安装部署搭建gitlab平台.汉化 安装环境要求:内存不要小于4G,否则后期web界面可能会报错 一.准备工作 1.1 查看系统版本 首先查询系统版本,下载Gitlab的对应版本 [ro ...

  5. Gitlab安装以及汉化

    Gitlab安装以及汉化 系统环境: CentOS 7.5 IP:192.168.1.2 关闭selinux.firewalld gitlab-ce-10.8.4 rpm包:下载地址 一.下载并安装g ...

  6. TestLink汉化操作

    实验环境版本 xampp-windows-x64-7.3.2-0-VC15-installer + testlink-1.9.19 汉化操作如下 打开testlink的配置文件F:\xampp\htd ...

  7. Gitlab的安装汉化及问题解决

    Gitlab的安装汉化及问题解决(2017/12/14目前版本为10.2.4) 一.前言 Gitlab需要安装的包太TM多了,源码安装能愁死个人,一直出错,后来发现几行命令就装的真是遇到的新大陆一样. ...

  8. Centos下的GitLab的安装汉化和数据备份以及管理员密码重置

    前言: 安装版本:gitlab-ce-8.8.5-ce.1.el7.x86_64.rpm 下载地址: https://mirrors.tuna.tsinghua.edu.cn/gitlab-ce/yu ...

  9. centos7搭建gitlab服务器、汉化

    1.下载rpm安装包 https://mirrors.tuna.tsinghua.edu.cn/gitlab-ce/yum/el7/gitlab-ce-8.8.5-ce.1.el7.x86_64.rp ...

随机推荐

  1. Unity3D for VR 学习(6): 再次温故知新-3D数学

    一年前,系统学习过3D数学,并记录了一篇博客<C#程序员整理的Unity 3D笔记(十):Unity3D的位移.旋转的3D数学模型>. 一年后,再次温习之. 坐标系:Unity3D使用左手 ...

  2. NOIP2015运输计划题解报告

    这题在洛谷上可以找到提交 P2680运输计划 题目背景 公元 2044 年,人类进入了宇宙纪元. 题目描述 L 国有 n 个星球,还有 n-1 条双向航道,每条航道建立在两个星球之间,这 n-1 条航 ...

  3. git push要输入密码问题

    git push突然每次都要输入密码了,这个问题困扰了两天,要无密码push,要保证两点. 1.  git clone的url一定得是git开头的,不能是https开头的,这个容易被忽略,github ...

  4. phpstorm 自定义属性没语法提示的问题

    在右侧Options勾选上Custom HTML tag attributes,并且在下面的输入框输入自定义属性列表,逗号分隔.

  5. python常用序列list、tuples及矩阵库numpy的使用

    近期开始学习python机器学习的相关知识,为了使后续学习中避免编程遇到的基础问题,对python数组以及矩阵库numpy的使用进行总结,以此来加深和巩固自己以前所学的知识. Section One: ...

  6. STM32自动生成精美图案

    http://note.youdao.com/noteshare?id=65f237225624d22fe18f4aaaeec8db07

  7. bzoj 3209 bzoj1799 数位dp

    3209: 花神的数论题 Time Limit: 10 Sec  Memory Limit: 128 MBSubmit: 2267  Solved: 1040[Submit][Status][Disc ...

  8. 760A 水

    LINK 第一天单独一行 其余7天一行 问某月有多少行 ...... /** @Date : 2017-04-02-21.35 * @Author : Lweleth (SoungEarlf@gmai ...

  9. [洛谷P1709] [USACO5.5]隐藏口令Hidden Password

    洛谷题目链接:[USACO5.5]隐藏口令Hidden Password 题目描述 有时候程序员有很奇怪的方法来隐藏他们的口令.Binny会选择一个字符串S(由N个小写字母组成,5<=N< ...

  10. jQuery.fill 数据填充插件

    博客园的伙伴们,大家好,I'm here,前段时间特别的忙,只有零星分散的时间碎片,有时仰望天空,有时发呆,有时写代码,正如下面给大家介绍的这个jQuery.fill插件,正是在这样的状态下写出来的. ...