This blog will show you how to install Gitlab runner on Linux.
- Gitlab is an open-source platform built around Git, the distributed version control system. It provides a comprehensive set of tools and features to manage Git repositories, project planning, continuous integration/continuous deployment (CI/CD), code review, issue tracking, and more.
- GitLab Runner is an application that works with GitLab CI/CD to run jobs in a pipeline.
Prerequisites
- Docker
Install Runner
1.Add the official GitLab repository:
curl -L "https://packages.gitlab.com/install/repositories/runner/gitlab-runner/script.deb.sh" | sudo bash
2.Install the latest version of GitLab Runner
sudo apt install gitlab-runner
3.Register the runner
goto project -> setttings -> CI/CD -> Runners -> Create project runner
To register the runner
gitlab-runner register --url https://gitlab.com --token glrt-5zA1jpuG***
Enter the GitLab instance URL (for example, https://gitlab.com/): Enter
Enter a name for the runner. This is stored only in the local config.toml file:
docker-runner
Enter an executor: custom, ssh, virtualbox, docker, docker+machine, docker-autoscaler, shell, parallels, docker-windows, kubernetes, instance:
docker
Enter the default Docker image (for example, ruby:2.7):
alpine:latest
To verify, run:
gitlab-runner list
---
Runtime platform arch=amd64 os=linux pid=98145 revision=2b813ade version=18.1.1
Listing configured runners ConfigFile=/etc/gitlab-runner/config.toml
docker-runner Executor=docker Token=glrt-5zA1jpuGICa***
then run gitlab-runner run
Read the official document
Useful Gitlab-runner commands:
### register runner
gitlab-runner register --name my-runner --url "http://gitlab.example.com" --token my-authentication-token
### list all runner
gitlab-runner list
### verify runner
gitlab-runner verify
### remove old runner
gitlab-runner verify --delete
### unregister runner
gitlab-runner unregister --name test-runner
or
gitlab-runner unregister --url "http://gitlab.example.com/" --token t0k3n
gitlab-runner unregister --all-runners
### Other
gitlab-runner reset-token --name test-runner
gitlab-runner install
gitlab-runner uninstall
gitlab-runner start
gitlab-runner stop
gitlab-runner restart
gitlab-runner status
# Run with systemctl
systemctl start gitlab-runner.service
Leave a comment if you have any questions.
===========
Please keep in touch
Portfolio
Linkedin
Github
Youtube
Top comments (0)