在 CentOS 6 安装

使用国内镜像安装,新建 /etc/yum.repos.d/gitlab-ce.repo,添加以下内容

[gitlab-ce]
name=gitlab-ce
baseurl=http://mirrors.tuna.tsinghua.edu.cn/gitlab-ce/yum/el6
repo_gpgcheck=
gpgcheck=
enabled=
gpgkey=https://packages.gitlab.com/gpg.key

安装步骤:

# 安装依赖包
yum install curl openssh-server openssh-clients postfix cronie -y
# 启动 postfix 邮件服务
service postfix start
# 检查 postfix
chkconfig postfix on
# 安装 GitLab 社区版
yum install gitlab-ce -y
# 初始化 GitLab
gitlab-ctl reconfigure

修改 host

添加访问的 host,修改/etc/gitlab/gitlab.rbexternal_url

external_url 'http://git.home.com'

vi /etc/hosts,添加 host 映射

127.0.0.1 git.home.com

每次修改/etc/gitlab/gitlab.rb,都要运行以下命令,让配置生效

sudo gitlab-ctl reconfigure

配置本机的 host,如:192.168.113.59 git.home.com。最后,在浏览器打开网址http://git.home.com,登陆。默认管理员:

用户名: root
密码: 5iveL!fe

安装中文语言包(汉化)

以下汉化步骤参考此篇文章,首先确认当前安装版本

cat /opt/gitlab/embedded/service/gitlab-rails/VERSION

当前安装版本是8.5.7,因此中文补丁需要打8.5版本

克隆 GitLab 源码仓库:

# 克隆 GitLab.com 仓库
git clone https://gitlab.com/larryli/gitlab.git
#或 Gitcafe.com 镜像,速度更快
git clone https://gitcafe.com/larryli/gitlab.git

运行汉化补丁:

# 8.5 版本的汉化补丁(8-5-stable是英文稳定版,8-5-zh是中文版,两个 diff 结果便是汉化补丁)
sudo git diff origin/8-5-stable..8-5-zh > /tmp/8.5.diff
# 停止 gitlab
sudo gitlab-ctl stop
# 应用汉化补丁
cd /opt/gitlab/embedded/service/gitlab-rails
git apply /tmp/8.5.diff
# 启动gitlab
sudo gitlab-ctl start

至此,汉化完毕。打开地址http://git.home.com,便会看到中文版的GitLab。如下

安装完成。

备份

如果是生产环境,备份是必须的。需要备份的文件:配置文件和数据文件。

备份配置文件

配置文件含密码等敏感信息,不要和数据备份文件放在一起

sh -c 'umask 0077; tar -cf $(date "+etc-gitlab-%s.tar") -C /etc/gitlab'

备份数据文件

默认数据备份目录是/var/opt/gitlab/backups,手动创建备份文件:

# Omnibus 方式安装使用以下命令备份
sudo gitlab-rake gitlab:backup:create

日常备份,添加 crontab,运行crontab -e

# 每天2点执行备份
0 2 * * * /opt/gitlab/bin/gitlab-rake gitlab:backup:create CRON=1

如要修改备份周期和目录,在/etc/gitlab/gitlab.rb中修改以下两个选项

# 设置备份周期为7天 - 604800秒
gitlab_rails['backup_keep_time'] = 604800
# 备份目录
gitlab_rails['backup_path'] = '/mnt/backups'

恢复

恢复之前,确保备份文件所安装 GitLab 和当前要恢复的 GitLab 版本一致。首先,恢复配置文件:

sudo mv /etc/gitlab /etc/gitlab.$(date +%s)
# 将下面配置备份文件的时间戳改为你所备份的文件的时间戳
sudo tar -xf etc-gitlab-1399948539.tar -C /

恢复数据文件

# 将数据备份文件拷贝至备份目录
sudo cp 1393513186_gitlab_backup.tar /var/opt/gitlab/backups/ # 停止连接数据库的进程
sudo gitlab-ctl stop unicorn
sudo gitlab-ctl stop sidekiq # 恢复1393513186这个备份文件,将覆盖GitLab数据库!
sudo gitlab-rake gitlab:backup:restore BACKUP=1393513186 # 启动 GitLab
sudo gitlab-ctl start # 检查 GitLab
sudo gitlab-rake gitlab:check SANITIZE=true

#centos 6

wget https://mirror.tuna.tsinghua.edu.cn/gitlab-ce/yum/el6/gitlab-ce-9.2.2-ce.0.el6.x86_64.rpm

rpm -ivh gitlab-ce-9.2.2-ce.0.el6.x86_64.rpm

# centos 7
wget https://mirror.tuna.tsinghua.edu.cn/gitlab-ce/yum/el7/gitlab-ce-9.2.2-ce.0.el7.x86_64.rpm

rpm -ivh gitlab-ce-9.2.2-ce.0.el7.x86_64.rpm

gitlab-ctl reconfigure

gitlab-ctl status

安装配置GitLab的更多相关文章

  1. Centos7安装配置gitlab

    Centos7安装配置gitlab 这篇文字我会介绍在Centos7上安装gitlab,配置gitlab的smtp,并且创建项目demo. sudo yum install openssh-serve ...

  2. docker安装配置gitlab详细过程

    docker安装配置gitlab详细过程   获取镜像 1.方法一 1 docker pull beginor/gitlab-ce:11.0.1-ce.0 2.方法二如果服务器网路不好或者pull不下 ...

  3. ubuntu 简单安装配置gitlab

    安装 gitlab-ce 社区版 依赖 sudo apt-get install curl openssh-server ca-certificates postfix 添加gitlab包服务并安装 ...

  4. CentOS 7 安装配置 Gitlab

    centos:http://www.centos.org/download/ download:https://about.gitlab.com/downloads/ update:https://g ...

  5. centos7安装配置gitlab详细教程

    一. 安装并配置必要的依赖关系在CentOS系统上安装所需的依赖:ssh,防火墙,postfix(用于邮件通知) ,wget,以下这些命令也会打开系统防火墙中的HTTP和SSH端口访问. 1.安装ss ...

  6. CentOS7.5环境下安装配置GitLab

    1. 安装依赖软件 yum -y install policycoreutils openssh-server openssh-clients postfix 2.设置postfix开机自启,并启动, ...

  7. gitlab centos 安装配置运维笔记

    写在前面 如果你需要一个git服务器,为企业或自己的团队托管代码而又不希望将代码仓库存储到第三方.你可以在自己的服务器上搭建一个gitlab. 本文为我在最初安装配置gitlab服务器的时候留存的笔记 ...

  8. CentOS7安装Puppet+GitLab+Bind

    添加Puppet官方源 rpm -Uvh https://yum.puppetlabs.com/puppetlabs-release-el-7.noarch.rpm 安装Puppet yum -y i ...

  9. GitLab 安装配置笔记(转)

    GitLab的安装方式 GitLab的两种安装方法: 编译安装 优点:可定制性强.数据库既可以选择MySQL,也可以选择PostgreSQL;服务器既可以选择Apache,也可以选择Nginx. 缺点 ...

随机推荐

  1. DPDK 网卡RSS(receive side scaling)简介

    网卡RSS(receive side scaling)简介 RSS是一种网卡驱动技术,能让多核系统中跨多个处理器的网络收包处理能力高效能分配.注意:由于同一个核的处理器超线程共享同一个执行引擎,这个效 ...

  2. C++中getline()函数简介

    有时我们希望能在最终得到的字符中保留输入时的空白符,这时应该用getline()函数代替原来的>>运算符. 下面是使用getline读取一整行的示例代码: #include<iost ...

  3. [剑指Offer] 22.从上往下打印二叉树

    [思路]广度优先遍历,队列实现 class Solution { public: vector<int> PrintFromTopToBottom(TreeNode* root) { qu ...

  4. cdh版本的zookeeper安装以及配置(伪分布式模式)

    需要的软件包:zookeeper-3.4.5-cdh5.3.6.tar.gz  1.将软件包上传到Linux系统指定目录下: /opt/softwares/cdh 2.解压到指定的目录:/opt/mo ...

  5. [Leetcode] 3sum-closest 给定值,最为相近的3数之和

    Given an array S of n integers, find three integers in S such that the sum is closest to a given num ...

  6. 深入探讨Android异步精髓Handler

    探索Android软键盘的疑难杂症 深入探讨Android异步精髓Handler 详解Android主流框架不可或缺的基石 站在源码的肩膀上全解Scroller工作机制 Android多分辨率适配框架 ...

  7. Website Collection

    前一百个卡特兰数 Candy?的博弈论总结 杜教筛资料 线性基资料 (ex)BSGS资料 斐波那契数列前300项 斯特林数 STL标准库-容器-unordered_set C++ unordered_ ...

  8. 如何解析Json返回的数据

    Json在Web开发的用处非常广泛,作为数据传递的载体,如何解析Json返回的数据是非常常用的.下面介绍下四种解析Json的方式: Part 1 var list1 = [1,3,4]; alert( ...

  9. Android 对Layout_weight属性完全解析以及使用ListView来实现表格

    用在linearlayout 如果我们想要按照权重比例来分配LinearLayout,我们需要将其宽度设置为0dip http://blog.csdn.net/xiaanming/article/de ...

  10. Cannot load project: com.intellij.ide.plugins.PluginManager$StartupAbortedException

    今天电脑突然蓝屏,idea异常关闭,开机重启后,打开idea,点击项目出现 Cannot load project: com.intellij.ide.plugins.PluginManager$St ...