在 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

最新文章

  1. iOS开发之Core Animation
  2. C#中Thread与ThreadPool的比较
  3. ie7,8常见bug,共计257个bug汇总?如何解决ie的历史bug
  4. spring security remember me实现自动登录
  5. MyLinerLayout--推荐
  6. 第七届ACM趣味程序设计竞赛第四场(正式赛) 题解
  7. WPF非轮询方式更新数据库变化SqlDependency(数据库修改前台自动更新)
  8. 常见的DoDataExchange什么意思
  9. sql server 2008 设计时 不允许保存更改
  10. for for-in foreach 循环
  11. mysql revise
  12. Shell 有类型变量
  13. js对HTML字符转义与反转义
  14. Linux学习之RPM包管理-rpm命令管理(十六)
  15. 如何发布一个npm包(基于vue)
  16. 个人作业 - Week3 - 案例分析
  17. 5 款最新的 jQuery 图片裁剪插件
  18. 设计模式之Proxy(代理)(转)
  19. xadmin系列之单实例模式
  20. 关于Netty Pipeline中Handler的执行顺序问题

热门文章

  1. [洛谷P3743]kotori的设备
  2. CCmdUI
  3. [HEOI2015]最短不公共子串
  4. NOIP2010 codevs1069 洛谷P1525 关押罪犯
  5. 近期对于windows服务的理解
  6. 谈一谈深度学习之semantic Segmentation
  7. count(1)与count(*)
  8. jquery中的get和post、ajax有关返回值的问题描述
  9. C#三层中的分页
  10. IntelliJ IDEA2017 + Tomcat 设置热部署