ubuntu18搭建Gitlab服务

安装sudo apt-get install -y postfix #选择 Internet Sitesudo apt-get install curlcurl -s https://packages.gitlab.com/install/repositories/gitlab/gitlab-ce/script.deb.sh|sudo bashsudo apt-get install g...
摘要由CSDN通过智能技术生成

安装

参考:https://docs.gitlab.com/omnibus/settings/configuration.html
官方:https://about.gitlab.com/install/#ubuntu

sudo apt-get install -y curl openssh-server ca-certificates
sudo apt-get install -y postfix  #选择 Internet Site
curl https://packages.gitlab.com/install/repositories/gitlab/gitlab-ce/script.deb.sh | sudo bash

sudo systemctl enable postfix
sudo systemctl start postfix

sudo apt-get install gitlab-ce #安装可用最新版本
#sudo apt-get install gitlab-ce=11.7.5-ce.0  #指定版本号
#由于版本太低,需要指定源进行下载
#sudo apt-get install gitlab-ce=12.9.2-ce.0 https://mirrors.tuna.tsinghua.edu.cn/gitlab-ce/ubuntu/pool/bionic/main/g/gitlab-ce/

#指定清华源 apt install gitlab-ce方法
sudo vim /etc/apt/sources.list.d/gitlab-ce.list #写入如下内容
deb https://mirrors.tuna.tsinghua.edu.cn/gitlab-ce/ubuntu bionic main
#首先信任 GitLab 的 GPG 公钥:
curl https://packages.gitlab.com/gpg.key 2> /dev/null | sudo apt-key add - &>/dev/null
sudo apt update
sudo apt list gitlab-ce -a #查看所有的gilab-ce版本
sudo apt-get install gitlab-ce=12.9.2-ce.0 #指定版本安装


sudo vim /etc/gitlab/gitlab.rb
#配置external_url 通常是本机局域网ip的形式,例如:external_url 'http://192.168.1.106:80'
#设置git-data存储位置
#git_data_dirs({ "default" => { "path" => "/mnt/gitlab/git-data" } })   #添加指定存储位置

sudo gitlab-ctl reconfigure

sudo gitlab-ctl stop
#If you already have existing Git repositories in /var/opt/gitlab/git-data you can move them to the new location as follows:
sudo rsync -av /var/opt/gitlab/git-data/repositories /mnt/nas/git-data/   #同步文件内容

sudo gitlab-ctl upgrade
sudo gitlab-ctl start
#设置下次开机自启动gitlab服务
sudo systemctl enable gitlab-runsvdir.service
sudo systemctl start gitlab-runsvdir.service

错误STDERR: sysctl: cannot open “/etc/sysctl.d/90-omnibus-gitlab-kernel.sem.conf”:
参考:https://www.jianshu.com/p/134c1107114a

错误1:
resql/.s.PGSQL.5432"? [execute] psql: could not connect to server: No such file or directory Is the server running locally and accepting connections on Unix domain socket "/var/opt/gitlab/postgresql

一般是文件权限问题,只要修改/var/opt/gitlab/postgresql权限

sudo chmod 755 /var/opt/gitlab/postgresql
sudo gitlab-ctl reconfigure

错误2:
storage_directory[/var/opt/gitlab/.ssh](gitlab::gitlab-shell line 38)had an error:Mixlib::shellout::shellcommandfailed:
ruby_block[directory resource: xxx_path]

一般是文件权限问题,只要修改xxx_path权限使git用户有读写权限即可

sudo chown git:root xxx_path

错误4
Gitlab更新后gitlab-ctl reconfigure报错rails_migration[gitlab-rails] (gitlab::database_migrations line 51) had an error
方法: https://yangyq.net/2022/05/gitlab-update-error.html

解决方法:

#重起系统
sudo gitlab-rake gitlab:background_migrations:finalize[CopyColumnUsingBackgroundMigrationJob,push_event_payloads,event_id,'[["event_id"]\, ["event_id_convert_to_bigint"]]']
sudo gitlab-ctl reconfigure
sudo gitlab-ctl restart
sudo 
  • 1
    点赞
  • 2
    收藏
    觉得还不错? 一键收藏
  • 打赏
    打赏
  • 0
    评论
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包

打赏作者

阿尔发go

你的鼓励将是我创作的最大动力

¥1 ¥2 ¥4 ¥6 ¥10 ¥20
扫码支付:¥1
获取中
扫码支付

您的余额不足,请更换扫码支付或充值

打赏作者

实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

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

余额充值