码迷,mamicode.com
首页 > 其他好文 > 详细

gitlab搭建

时间:2016-03-18 02:01:02      阅读:261      评论:0      收藏:0      [点我收藏+]

标签:gitlab

1、gitlab的搭建

  • 安装基础包

     yum -y install curl policycoreutils openssh-server openssh-clients

  • 启动sshd

    systemctl enable sshd

    systemctl start sshd

  • 安装postfix

    yum -y install postfix

    systemctl enable postfix

    systemctl start postfix

  • 添加防火墙规则

    firewall-cmd --permanent --add-service=http

    systemctl reload firewalld

  • 下载并安装软件包(软件包下载较慢)

    curl -sS https://packages.gitlab.com/install/repositories/gitlab/gitlab-ce/script.rpm.sh | sudo bash

    yum install gitlab-ce

    默认安装的是最新的gitlab-ce的包,如果需要特定的版本可以在官网去下载特定的版本 
    地址:https://packages.gitlab.com/gitlab/gitlab-ce/

  • 配置并启动gitlab

    gitlab-ctl reconfigure

  • 默认账户密码是

    Username: root

    Password: 5iveL!fe

2、 gitlab的备份

  • 备份命令

    gitlab-rake gitlab:backup:create

    默认的备份目录为: /var/opt/gitlab/backups

    备份文件名类似: 1393513186_gitlab_backup.tar 

  • 备份目录的修改

    vi /etc/gitlab/gitlab.rb

    gitlab_rails[‘backup_path‘] = ‘/mnt/gitlab_backups‘

3、gitlab数据的恢复或还原

提示:gitlab数据的恢复或者迁移成功的前提——两台服务器的gitlab的版本必须相同,若不相同则可能迁移或者恢复失败

  • 将备份文件放在gitlab的默认备份目录

比如/var/opt/gitlab/backups下的1458217074_gitlab_backup.tar

  • 恢复或者还原

停服务

gitlab-ctl stop unicorn

gitlab-ctl stop sidekiq

恢复数据

gitlab-rake gitlab:backup:restore BACKUP=1458213020

BACKUP后面跟的是备份文件的时间戳,比如恢复备份文件1458217074_gitlab_backup.tar

gitlab-rake gitlab:backup:restore BACKUP=1458217074

回复完启动服务

gitlab-ctl start



   

本文出自 “zhanguo1110” 博客,请务必保留此出处http://zhanguo1110.blog.51cto.com/5750817/1752349

gitlab搭建

标签:gitlab

原文地址:http://zhanguo1110.blog.51cto.com/5750817/1752349

(0)
(0)
   
举报
评论 一句话评论(0
登录后才能评论!
© 2014 mamicode.com 版权所有  联系我们:gaon5@hotmail.com
迷上了代码!