地址:https://docs.gitlab.com/runner/install/linux-manually.html
Simply download one of the binaries for your system:
下载安装 包
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
You can download a binary for every available version as described in Bleeding Edge - download any other tagged release.
获取执行权限
Give it permissions to execute:
sudo chmod +x /usr/local/bin/gitlab-runner
建立用户
Create a GitLab CI user:
sudo useradd --comment 'GitLab Runner' --create-home gitlab-runner --shell /bin/bash
安装服务和启动
Install and run as service:
sudo gitlab-runner install --user=gitlab-runner --working-directory=/home/gitlab-runner
sudo gitlab-runner start
注册runner到gitlab
https://docs.gitlab.com/runner/register/index.html
- Run the following command:
sudo gitlab-runner register
- Enter your GitLab instance URL:
Please enter the gitlab-ci coordinator URL (e.g. https://gitlab.com )
https://gitlab.com
- Enter the token you obtained to register the Runner:
Please enter the gitlab-ci token for this runner
xxx
- Enter a description for the Runner, you can change this later in GitLab’s UI:
Please enter the gitlab-ci description for this runner
[hostname] my-runner
Enter the tags associated with the Runner, you can change this later in GitLab’s UI:
-
Please enter the gitlab-ci tags for this runner (comma separated):
my-tag,another-tag -
Enter the Runner executor:
Please enter the executor: ssh, docker+machine, docker-ssh+machine, kubernetes, docker, parallels, virtualbox, docker-ssh, shell:
docker
- If you chose Docker as your executor, you’ll be asked for the default image to be used for projects that do not define one in .gitlab-ci.yml:
Please enter the Docker image (eg. ruby:2.6):
alpine:latest