GitLab CE安装
安装比较简单,rpm直接在不同平台安装
<code>https:</code><code>//about</code><code>.gitlab.com</code><code>/installation/</code>
直接下载源包地址
<a href="https://about.gitlab.com/downloads/archives/" target="_blank">https://about.gitlab.com/downloads/archives/</a>
<code>安装</code>
<code>#yum install curl openssh-server openssh-clients postfix cronie</code>
<code>#service postfix start</code>
<code>#chkconfig postfix on</code>
<code>#lokkit -s http -s ssh</code>
<code>#rpm -i gitlab-ce-XXX.rpm</code>
GitLab加载配置与启动
<code>#gitlab-ctl reconfigure</code>
<code>#gitlab-ctl start/restart</code>
GitLab日志查看
<code>#gitlab-ctl tail nginx </code>
<code>#gitlab-ctl tail unicorn</code>
GitLab CE 备份与恢复
备份
<code>gitlab-rake gitlab:backup:create</code>
<code>可设置自动备份任务</code>
<code>0 2 * * * </code><code>/opt/gitlab/bin/gitlab-rake</code> <code>gitlab:backup:creat</code>
更改默认路径,可以在 <code>/etc/gitlab/gitlab.rb</code> 文件的 <code>gitlab_rails['backup_path']</code> 项中进行设置,默认为 <code>/var/opt/gitlab/backups</code>。
恢复
<code># 停止需要连接数据库的服务</code>
<code>#gitlab-ctl stop unicorn</code>
<code>#gitlab-ctl stop sidekiq</code>
<code># 恢复备份的数据,重写数据库内容</code>
<code># GitLab 8.15 版本以前所用的时间戳格式为 EPOCH (1393513186)</code>
<code>#gitlab-rake gitlab:backup:restore BACKUP=1459620009</code>
<code># 或# GitLab 8.15 版本以后所用的时间戳格式为 EPOCH_YYYY_MM_DD (1491415349_2017_04_06)</code>
<code># gitlab-rake gitlab:backup:restore BACKUP=1491415349_2017_04_06</code>
<code># 启动 GitLabsudo gitlab-ctl start</code>
<code># 检查 GitLab 是否正常运行</code>
<code>#gitlab-rake gitlab:check SANITIZE=true</code>
GitLab CE迁移与升级
迁移可参考备份与恢复,需要注意的是:版本号一定要一致
升级
跨版本升级在这里不过多介绍,如大版本9,升级过程下载相关安装包进行安装,自动会完成升级
GitLab CE 使用小节
1、项目地址为localhost
#vi /var/opt/gitlab/gitlab-rails/etc/gitlab.yml
<code> </code><code>## GitLab settings</code>
<code> </code><code>gitlab:</code>
<code> </code><code>## Web server settings (note: host is the FQDN, do not include http://)</code>
<code> </code><code>host: localhost</code>
<code> </code><code>port: 80</code>
<code> </code><code>https: </code><code>false</code>
2、merge 、chekout 出现以下错误:
GitLab: The project you were looking for could not be found.
此类错误多出现在git-data挂载软链接导致
如我的挂载 /var/opt/gitlab -> /data/gitlab, 修改参照以下
<code># /etc/gitlab/gitlab.rb </code>
<code>......</code>
<code> </code><code>git_data_dirs({ </code><code>"default"</code> <code>=> { </code><code>"path"</code> <code>=> </code><code>"</data/gitlab/git-data>"</code><code>, </code><code>'gitaly_address'</code> <code>=> </code><code>'unix:/var/opt/gitlab/gitaly/gitaly.socket'</code> <code>} })</code>
本文转自 jackjiaxiong 51CTO博客,原文链接:http://blog.51cto.com/xiangcun168/1951028