章工运维 章工运维
首页
  • linux
  • windows
  • 中间件
  • 监控
  • 网络
  • 存储
  • 安全
  • 防火墙
  • 数据库
  • 系统
  • docker
  • 运维工具
  • other
  • elk
  • K8S
  • ansible
  • Jenkins
  • GitLabCI_CD
  • 随笔
  • 面试
  • 工具
  • 收藏夹
  • Shell
  • python
  • golang
友链
  • 索引

    • 分类
    • 标签
    • 归档
    • 首页 (opens new window)
    • 关于我 (opens new window)
    • 图床 (opens new window)
    • 评论 (opens new window)
    • 导航栏 (opens new window)
周刊
GitHub (opens new window)

章工运维

业精于勤,荒于嬉
首页
  • linux
  • windows
  • 中间件
  • 监控
  • 网络
  • 存储
  • 安全
  • 防火墙
  • 数据库
  • 系统
  • docker
  • 运维工具
  • other
  • elk
  • K8S
  • ansible
  • Jenkins
  • GitLabCI_CD
  • 随笔
  • 面试
  • 工具
  • 收藏夹
  • Shell
  • python
  • golang
友链
  • 索引

    • 分类
    • 标签
    • 归档
    • 首页 (opens new window)
    • 关于我 (opens new window)
    • 图床 (opens new window)
    • 评论 (opens new window)
    • 导航栏 (opens new window)
周刊
GitHub (opens new window)
  • ansible系列文章

  • Kubernetes笔记

  • elk

  • jenkins

  • GitLabCI_CD

    • Gitlab ci与Jenkins对比
    • GitLabRunner简介
    • GitLabRunner安装
      • 1. 使用GItLab官方仓库安装
      • 2. 在GNU / Linux上手动安装GitLab Runner
        • 通过deb或rpm软件包
        • 使用二进制文件
      • 在MacOS中安装
        • 手动安装
        • 自动安装
        • 更新
      • 4. 在容器中运行GitLab Runner
    • GitLabRunner注册
    • Runner-命令
    • 运行流水线任务
    • 集成构建工具
    • 制品库集成
    • 按时间统计GitLab所有用户代码提交量
    • gitlab ci部署web程序示例
    • gitlab部署

  • 专题
  • GitLabCI_CD
章工运维
2024-03-13
目录

GitLabRunner安装

# GitLab Runner安装

可以在GNU / Linux,macOS,FreeBSD和Windows上安装 (opens new window)和使用GitLab Runner 。您可以使用Docker安装它,手动下载二进制文件,也可以使用GitLab提供的rpm / deb软件包的存储库。

# 1. 使用GItLab官方仓库安装

  • 重点掌握CentOS系统的安装方式
  • 重点掌握Ubuntu系统的安装方式

我们提供Debian,Ubuntu,Mint,RHEL,Fedora和CentOS当前受支持版本的软件包。

Distribution Version End of Life date
Debian stretch approx. 2022
Debian jessie June 2020
Ubuntu bionic April 2023
Ubuntu xenial April 2021
Mint sonya approx. 2021
Mint serena approx. 2021
Mint sarah approx. 2021
RHEL/CentOS 7 June 2024
RHEL/CentOS 6 November 2020
Fedora 29 approx. November 2019

Add GitLab’s official repository: 添加官方仓库

# For Debian/Ubuntu/Mint
curl -L https://packages.gitlab.com/install/repositories/runner/gitlab-runner/script.deb.sh | sudo bash

# For RHEL/CentOS/Fedora
curl -L https://packages.gitlab.com/install/repositories/runner/gitlab-runner/script.rpm.sh | sudo bash
1
2
3
4
5

Install the latest version of GitLab Runner: 安装最新版本

# For Debian/Ubuntu/Mint
sudo apt-get install gitlab-runner

# For RHEL/CentOS/Fedora
sudo yum install gitlab-runner
1
2
3
4
5

To install a specific version of GitLab Runner: 安装指定版本

# for DEB based systems
apt-cache madison gitlab-runner
sudo apt-get install gitlab-runner=10.0.0

# for RPM based systems
yum list gitlab-runner --showduplicates | sort -r
sudo yum install gitlab-runner-10.0.0-1
1
2
3
4
5
6
7

更新runner

# For Debian/Ubuntu/Mint
sudo apt-get update
sudo apt-get install gitlab-runner

# For RHEL/CentOS/Fedora
sudo yum update
sudo yum install gitlab-runner
1
2
3
4
5
6
7

# 2. 在GNU / Linux上手动安装GitLab Runner

如果您不能使用deb / rpm存储库 (opens new window)安装GitLab Runner,或者您的GNU / Linux操作系统不在支持的版本中,则可以使用以下一种方法手动安装它,这是最后的选择。

# 通过deb或rpm软件包

下载软件包

  1. 在https://gitlab-runner-downloads.s3.amazonaws.com/latest/index.html上 (opens new window)找到最新的文件名和选项 。
  2. 选择一个版本并下载二进制文件,如文档所述,该文件用于下载任何其他标记的 (opens new window) GitLab Runner发行版。

例如,对于Debian或Ubuntu:

curl -LJO https://gitlab-runner-downloads.s3.amazonaws.com/latest/deb/gitlab-runner_<arch>.deb

dpkg -i gitlab-runner_<arch>.deb

dpkg -i gitlab-runner_<arch>.deb
1
2
3
4
5

例如,对于CentOS或Red Hat Enterprise Linux:

curl -LJO https://gitlab-runner-downloads.s3.amazonaws.com/latest/rpm/gitlab-runner_<arch>.rpm

rpm -i gitlab-runner_<arch>.rpm

rpm -Uvh gitlab-runner_<arch>.rpm
1
2
3
4
5

# 使用二进制文件

参考地址: https://docs.gitlab.com/12.6/runner/install/bleeding-edge.html#download-any-other-tagged-release

下载指定版本: 将上面URL中的latest切换为 v12.6。

# Linux x86-64
sudo curl -L --output /usr/local/bin/gitlab-runner https://gitlab-runner-downloads.s3.amazonaws.com/latest/binaries/gitlab-runner-linux-amd64

# Linux x86
sudo curl -L --output /usr/local/bin/gitlab-runner https://gitlab-runner-downloads.s3.amazonaws.com/latest/binaries/gitlab-runner-linux-386

# Linux arm
sudo curl -L --output /usr/local/bin/gitlab-runner https://gitlab-runner-downloads.s3.amazonaws.com/latest/binaries/gitlab-runner-linux-arm

# Linux arm64
sudo curl -L --output /usr/local/bin/gitlab-runner https://gitlab-runner-downloads.s3.amazonaws.com/latest/binaries/gitlab-runner-linux-arm64
1
2
3
4
5
6
7
8
9
10
11

添加执行权限

sudo chmod +x /usr/local/bin/gitlab-runner
1

创建一个gitlab用户

sudo useradd --comment 'GitLab Runner' --create-home gitlab-runner --shell /bin/bash
1

安装并作为服务运行

sudo gitlab-runner install --user=gitlab-runner --working-directory=/home/gitlab-runner
sudo gitlab-runner start
1
2

更新

#停止服务
sudo gitlab-runner stop

#下载新版本二进制包
sudo curl -L --output /usr/local/bin/gitlab-runner https://gitlab-runner-downloads.s3.amazonaws.com/latest/binaries/gitlab-runner-linux-amd64

#赋予执行权限
sudo chmod +x /usr/local/bin/gitlab-runner

#启动服务
sudo gitlab-runner start
1
2
3
4
5
6
7
8
9
10
11

# 在MacOS中安装

在macOS上安装GitLab Runner有两种方法:

  • 手动安装 (opens new window)。GitLab正式支持和推荐此方法。
  • 自制安装 (opens new window)。使用Homebrew进行 (opens new window)安装,以替代手动安装。

# 手动安装

下载二进制包

sudo curl --output /usr/local/bin/gitlab-runner https://gitlab-runner-downloads.s3.amazonaws.com/v12.6/binaries/gitlab-runner-darwin-amd64
1

授予其执行权限:

sudo chmod +x /usr/local/bin/gitlab-runner
1

将Runner作为服务安装并启动它:

cd ~
gitlab-runner install
gitlab-runner start
1
2
3

# 自动安装

安装,启动

brew install gitlab-runner
brew services start gitlab-runner
1
2

# 更新

gitlab-runner stop

sudo curl -o /usr/local/bin/gitlab-runner https://gitlab-runner-downloads.s3.amazonaws.com/latest/binaries/gitlab-runner-darwin-amd64

sudo chmod +x /usr/local/bin/gitlab-runner
gitlab-runner start
1
2
3
4
5
6

# 4. 在容器中运行GitLab Runner

docker run --rm -t -id -v ~/data/gitlab-runner/config:/etc/gitlab-runner gitlab/gitlab-runner:v12.6.0 
1
微信 支付宝
上次更新: 2024/03/13, 11:27:24

← GitLabRunner简介 GitLabRunner注册→

最近更新
01
不花一分钱从0到1建站教程
04-22
02
批量拿取多台服务器的日志文件
04-21
03
高德MCP智能体搞定旅游计划
04-19
更多文章>
Theme by Vdoing | Copyright © 2019-2025 | 点击查看十年之约 | 鄂ICP备2024072800号
  • 跟随系统
  • 浅色模式
  • 深色模式
  • 阅读模式