gitlab搭建
建议4G内存
- 安装并配置必须的依赖
sudo yum install -y curl policycoreutils-python openssh-server
sudo systemctl enable sshd
sudo systemctl start sshd
sudo firewall-cmd --permanent --add-service=http
sudo systemctl reload firewalld
- 安装Postfix以发送通知电子邮件。如果要使用其他解决方案发送电子邮件,请跳过此步骤并在安装GitLab后配置外部SMTP服务器。
sudo yum install postfix
sudo systemctl enable postfix
sudo systemctl start postfix
如果启动报错,修改 /etc/postfix/main.cf的设置
inet_protocols = ipv4
inet_interfaces = all
- 添加社区版仓库并安装
curl https://packages.gitlab.com/install/repositories/gitlab/gitlab-ce/script.rpm.sh | sudo bash
sudo EXTERNAL_URL="http://gitlab.example.com" yum install -y gitlab-ce
- 配置gitlib
编辑vim /etc/gitlab/gitlab.rb
external_url 'http://47.98.163.84:10000'
按照推荐自动配置,并启动
gitlab-ctl reconfigure
后面修改端口需要修改下面的文件
/var/opt/gitlab/gitlab-rails/etc/gitlab.yml
/var/opt/gitlab/nginx/conf/gitlab-http.conf
- 关闭与启动
- 关闭 gitlab-ctl stop
- 启动 gitlab-ctl start
- 备份与恢复
- 备份 需要在启动状态下,备份目录:/var/opt/gitlab/backups/
gitlab-rake gitlab:backup:create
- 恢复:
gitlab-ctl stop unicon
gitlab-ctl stop sideiq
gitlab-rake gitlab:backup:restore BACKUP=1531674119_2018_07_16_11.0.3
gitlab-ctl start