《只看原型搭建.Net到跨平台的PDM软件-本地搭建gitlab》

1.windows 安装gitlab托管源代码

1.1 安装环境准备

下载参考:https://docs.gitlab.com/runner/install/windows.html
安装&运行:
gitlab-runner-windows-amd64 install

gitlab-runner-windows-amd64 start

查看日志:
https://learn.microsoft.com/en-us/powershell/module/microsoft.powershell.diagnostics/get-winevent?view=powershell-7.2

Get-WinEvent -ProviderName gitlab-runner

以上步骤可以正常运行,但是我不知道如何启动gitlab,改用WSL+Ubuntu到方式部署,具体步骤如下:

  1. 安装WSL(Windows Subsystem for Linux)

由于GitLab官方不支持在Windows上直接安装,我们需要使用WSL(Windows Subsystem for Linux)来在Windows上运行Linux子系统。首先,我们需要启用WSL功能。

打开“控制面板” -> “程序” -> “启用或关闭Windows功能”,勾选“适用于Linux的Windows子系统”,然后点击“确定”。系统会提示重启电脑,重启后WSL功能即启用成功。

  1. 安装Linux发行版

在Microsoft Store中搜索“Linux”,选择一个Linux发行版进行安装,例如:Ubuntu。安装完成后,启动Linux终端,按照提示设置用户名和密码。

  1. 更新Linux系统

在Linux终端中执行以下命令,更新系统:
sudo apt update sudo apt upgrade

如果update太慢 可以修改成清华大学镜像:

第一步:备份
:~$sudo cp /etc/apt/sources.list /etc/apt/sources.list.bak
第二部:修改文件
sudo vim /etc/apt/sources.list
清空文件内容并替换文件内容为下面内容
deb https://mirrors.tuna.tsinghua.edu.cn/ubuntu/ jammy main restricted universe multiverse
deb https://mirrors.tuna.tsinghua.edu.cn/ubuntu/ jammy-updates main restricted universe multiverse
deb https://mirrors.tuna.tsinghua.edu.cn/ubuntu/ jammy-backports main restricted universe multiverse
deb http://security.ubuntu.com/ubuntu/ jammy-security main restricted universe multiverse
  1. 安装GitLab

在Linux终端中执行以下命令,安装GitLab的依赖:
sudo apt-get install -y curl openssh-server ca-certificates tzdata

接下来,添加GitLab的官方仓库,并安装GitLab:
curl https://packages.gitlab.com/install/repositories/gitlab/gitlab-ee/script.deb.sh | sudo bash sudo EXTERNAL_URL="http://gitlab.example.com" apt-get install gitlab-ee
注意:将http://gitlab.example.com替换为你自己的域名或IP地址。

  1. 配置GitLab
    安装完成后,编辑GitLab的配置文件:
    sudo nano /etc/gitlab/gitlab.rb
    在文件中找到external_url,将其设置为你的域名或IP地址。保存并退出。

安装gitlab使用ip或者url时报错
解决办法


external_url 'xxx'
改成
external_url= 'xxx'

  1. 启动GitLab

执行以下命令,启动GitLab:
sudo gitlab-ctl reconfigure
7. 访问GitLab

在浏览器中输入你设置的域名或IP地址,访问GitLab。首次访问时,系统会提示设置管理员密码。设置完成后,使用root用户和刚设置的密码登录GitLab。

posted @ 2023-05-29 13:32  bibidotdot  阅读(50)  评论(0)    收藏  举报