gitlab安装,备份,使用自建服务器,以及常见问题的解决方案。

参考
Gitlab Doc
install-and-configure-gitlab-on-centos-7

如果全新的安装会很容易,再已安装的机器上再次安装时,会有很多莫名奇妙的问题。这时可以通过安装时的提示,以及参考/var/log/gitlab下的日志来定位问题
安装前一定要清理完之前的版本(好多问题可以清理重新从头安装来解决)
使用yum info gitlab-ce确认,使用yum remove gitlab-ce移除
使用rpm -qa | grep gitlab确认,使用rpm -e gitlab-ce-13.7.1-ce.0.el7.x86_64移除

另外也要清理gitlab的目录,还有gitlab的存储目录,可以查看gitlab.rb中的配置。(如需要备份,请拷贝到其他地方)
```
/etc/gitlab
/opt/gitlab
/var/opt/gitlab
/var/log/gitlab
```

确认gitlab-runsvdir的服务是否再运行,如有使用`sudo systemctl stop gitlab-runsvdir`将之停止
sudo systemctl -a | grep gitlab
  gitlab-runsvdir.service                                                                                  loaded    active   running   GitLab Runit supervision process

安装时一定要是使用yum安装.(What’s the difference between rpm and yum? [closed]
)
postfix不用的话,可以不安装。依赖可以再缺少的时候安装。

安装步骤很简单(参考install-and-configure-gitlab-on-centos-7),但是过程中很容易出现问题(参考后面的问题列表)

添加rpm源,并安装。(安装指定版本,请往下看。文章末尾附有script.rpm.sh脚本)

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

根据需要修改/etc/gitlab/gitlab.rb中的external_url,git_data_dirs, gitlab_rails[‘backup_path’]的配置

载入配置

gitlab-ctl reconfigure
gitlab-ctl restart

备份与恢复,直接参考Gitlab Doc即可,需要强调下一下两点
a.使用已有的备份数据时,一定要使用相同版本的gitlab来导入数据。
b.恢复数据前一定设置好数据的存储目录


使用gitlab内嵌的nginx可以直接跳过这里

使用自建的nginx 替代 gitlab内置的nginx服务器处理请求(直接将gitlab运行再已有的nginx/apache服务器上会出现冲突,因此需要自建的服务器来替代gitlab内嵌的nginx)

a. 配置`/etc/gitlab/gitlab.rb`
	根据自己的情况修改 `web_server['external_users'] = ['nginx']`
	禁用内置nginx `nginx['enable'] = false`

	自建nginx链接gitlab可选tcp或者socket(默认方式)
		tcp方式需要配置:
		```
		gitlab_workhorse['listen_network'] = "tcp"
		gitlab_workhorse['listen_addr'] = "127.0.0.1:8021"
		```

		socket方式不需要修改,使用默认的配置即可

	`gitlab-ctl reconfigure`加载配置

b. 配置nginx(/etc/nginx/conf.d/gitlab.conf)

	tcp方式
		```
		server {
			listen       8021;
			server_name  localhost;

			location / {
				root  html;
				index index.html index.htm;
				proxy_pass http://127.0.0.1:8021; #与gitlab设置过的端口一致
			}
		}
		```
	socket方式
		```
		## GitLab 8.3+
		##
		## Lines starting with two hashes (##) are comments with information.
		## Lines starting with one hash (#) are configuration parameters that can be uncommented.
		##
		##################################
		##        CONTRIBUTING          ##
		##################################
		##
		## If you change this file in a Merge Request, please also create
		## a Merge Request on https://gitlab.com/gitlab-org/omnibus-gitlab/merge_requests
		##
		###################################
		##         configuration         ##
		###################################
		##
		## See installation.md#using-https for additional HTTPS configuration details.

		upstream gitlab-workhorse {
		  # On GitLab versions before 13.5
  • 1
    点赞
  • 2
    收藏
    觉得还不错? 一键收藏
  • 0
    评论
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值