私有gitlab部署

1.安装部署gitlab

官网:https://about.gitlab.com/    https://www.sourcetreeapp.com/

# 安装依赖软件
yum install curl openssh-server openssh-clients postfix cronie
/etc/init.d/postfix start
chkconfig postfix on

# 下载安装
cd /usr/local/src
wget https://packages.gitlab.com/gitlab/gitlab-ce/packages/el/6/gitlab-ce-8.11.5-ce.0.el6.x86_64.rpm/download
rpm -ivh gitlab-ce-8.11.5-ce.0.el6.x86_64.rpm
gitlab-ctl reconfigure 

2.查看状态,管理备份

gitlab-ctl status
gitlab-ctl start/stop/restart
gitlab-ctl tail nginx   # 查看日志
gitlab-ctl tail postgresql 

# 备份gitlab数据
/usr/bin/gitlab-rake gitlab:backup:create        # 备份目录在:/var/opt/gitlab/backups,需要修改修改配置文件:gitlab_rails['backup_path']

# 加入到crotob定时备份
0 2 * * * /usr/bin/gitlab-rake gitlab:backup:create

# 查看备份文件
ls /var/opt/gitlab/backups/
1473317720_gitlab_backup.tar

# 恢复gitlab数据,需要先停止unicorn 和 sidekiq,保证没有新数据写入
gitlab-ctl stop unicorn
gitlab-ctl stop sidekiq

#1406691018为时间戳
gitlab-rake gitlab:backup:restore BACKUP=1406691018
gitlab-ctl start unicorn
gitlab-ctl start sidekiq

3.配置访问路径

vim /etc/gitlab/gitlab.rb          
 11 # external_url 'http://gitlab.example.com' 
 12 external_url 'http://192.168.1.62'            # 替换成你的服务器IP或域名
gitlab-ctl reconfigure                   # 每次修改了都要执行,让它生效

4.安装汉化包

git clone https://github.com/larryli/gitlabhq.git        # 下载汉化包
gitlab-ctl stop                                          # 停止
cat /opt/gitlab/embedded/service/gitlab-rails/VERSION    # 查询版本
8.8.5
cp -r /opt/gitlab/embedded/service/gitlab-rails{,.bak}  # 备份
\cp -rf /usr/local/src/gitlabhq/* /opt/gitlab/embedded/service/gitlab-rails/  # 复制文件
gitlab-ctl start                                         # 启动

5.数据迁移

gitlab-ctl stop

# 注意前一个地址不需要/,后一个地址需要/,且只需要迁移repositories目录即可
rsync -av /var/opt/gitlab/git-data/repositories /path/to/git-data/

gitlab-ctl reconfigure
gitlab-ctl start

6.gitlab安装目录

cd /opt/gitlab/etc/
cp gitlab.rb.template gitlab.rb
gitlab-ctl restart

 

 

 参考文档:

http://www.jianshu.com/p/7a0d6917e009?mType=Group

http://blog.sina.com.cn/s/blog_70bb32080102vlkj.html

http://www.linuser.com/thread-1900-1-1.html

posted @ 2016-09-07 01:05  sunmmi  阅读(1282)  评论(0)    收藏  举报