1、下载 gitlab-runner 安装包
[root@izuf61s3j5m1fuhcwghcysz ~]# wget -O /usr/local/bin/gitlab-runner https://gitlab-ci-multi-runner-downloads.s3.amazonaws.com/latest/binaries/gitlab-ci-multi-runner-linux-amd64
2、赋予执行权限
[root@izuf61s3j5m1fuhcwghcysz ~]# chmod +x /usr/local/bin/gitlab-runner
3、创建runner用户
[root@izuf61s3j5m1fuhcwghcysz ~]# useradd --comment 'GitLab Runner' --create-home gitlab-runner --shell /bin/bash
4、注册runner
先到gitlab上查看如下图信息:
开始注册 runner
[root@izuf61s3j5m1fuhcwghcysz ~]# gitlab-runner register
5、安装并启动 gitlab-runner
[root@izuf61s3j5m1fuhcwghcysz ~]# gitlab-runner install --user=gitlab-runner --working-directory=/home/gitlab-runner
[root@izuf61s3j5m1fuhcwghcysz ~]# gitlab-runner start
如果 gitlab-runner start 无法启动,换成 gitlab-runner run 启动方式
更新操作
停止服务
[root@izuf61s3j5m1fuhcwghcysz ~]# gitlab-runner stop
下载新版本并设置执行权限
[root@izuf61s3j5m1fuhcwghcysz ~]# wget -O /usr/local/bin/gitlab-runner https://gitlab-ci-multi-runner-downloads.s3.amazonaws.com/latest/binaries/gitlab-ci-multi-runner-linux-amd64
[root@izuf61s3j5m1fuhcwghcysz ~]# chmod +x /usr/local/bin/gitlab-runner
启动服务
[root@izuf61s3j5m1fuhcwghcysz ~]# gitlab-runner start