GitLab搭建步骤:
1. Install and configure the necessary dependencies
(1)yum install curl openssh-server openssh-clients postfix cronie
(2)service postfix start
(3)chkconfig postfix on
2. Add the GitLab package server and install the package
(1)curl -sS https://packages.gitlab.com/install/repositories/gitlab/gitlab-ce/script.rpm.sh | sudo bash
(2)yum install gitlab-ce
安装指定版本的用命令:sudo yum install gitlab-ce-8.17.0-ce.0.el6.x86_64
如果不想通过脚本安装库,您可以在这里找到整个脚本,并选择和下载包手动和安装使用。
(1)curl -LJO https://packages.gitlab.com/gitlab/gitlab-ce/packages/el/6/gitlab-ce-XXX.rpm/download
(2)rpm -i gitlab-ce-XXX.rpm
3. Configure and start GitLab
(1)gitlab-ctl reconfigure
4.备份gitLab:新服务器上的Gitlab的版本必须与创建备份时的Gitlab版本号相同
gitlab-rake gitlab:backup:create RAILS_ENV=production
1)使用以上命令会在/var/opt/gitlab/backups目录下创建一个名称类似为1393513186_gitlab_backup.tar的压缩包, 这个压缩包就是Gitlab整个的完整部分, 其中开头的1393513186是备份创建的日期。
2)定时备份:Gitlab 自动备份:sudo su - ,crontab -e
加入以下, 实现每天凌晨2点进行一次自动备份:0 2 * * * /opt/gitlab/bin/gitlab-rake
5.还原备份:
# 停止相关数据连接服务
gitlab-ctl stop unicorn
gitlab-ctl stop sidekiq
# 从1393513186编号备份中恢复
gitlab-rake gitlab:backup:restore RAILS_ENV=PRODUCTION BACKUP=1393513186#
#启动Gitlab
sudo gitlab-ctl start
6.GitLab 卸载:必须在gitLab运行状态下才能卸载
sudo gitlab-ctl uninstall
#Debian/Ubuntu
sudo dpkg -r gitlab-ce
#CentOS/RedHat
sudo rpm -e gitlab-ce
7.当安装完成后,访问服务器端出现502的错误时,多数因为8080端口被占,修改方法如下:
# gitlab-ctl stop
# vi /etc/gitlab/gitlab.rb (change only these lines, uncomment if required)
unicorn['port'] = 8081
gitlab_git_http_server['auth_backend'] = "http://localhost:8081"
# gitlab-ctl reconfigure (to apply the changes)
# gitlab-ctl restart
# lsof -i:8081 (check whether unicorn has started properly)
8.查看git的详细信息:sudo gitlab-rake gitlab:env:info