How to Install GitLab Runner on RedHat Linux [2 Steps]

In this article we are going to cover How to install GitLab Runner on RedHat Linux/ any other cloud platform like AWS EC2, Azure VM, Google Cloud with preinstalled Red Hat, Register GitLab Runner, GitLab Runner commands and Uninstall GitLab Runner on Red Hat.

What is GitLab Runner?

GitLab Runner is used in GitLab CI/CD to run jobs in a pipeline. It is open source continuous integration service. GitLab runner is a build instance which is used to run the jobs over multiple machines and send the results to GitLab and which can be placed on separate users, servers, and local machine. You can register the runner as shared or group or project after installing it.

Types of GitLab runner:-

  • Share runners
  • Group runners
  • Project runner

Share runners: Share runner are available for jobs that have same requirement for multiple projects. If you use multiple runner for many jobs/projects then it avoid using single runner or minimum runners for many projects. It is use FIFO (first in first out) queue. Share runners are available to all groups and projects in a GitLab executor.

Group runners: Group Runner are available for many projects or multiple subgroup in single group to have access to a set of runners. It is use FIFO (first in first out) queue.

Project runner: Project runner are available for specific requirement for jobs in one project at a time.

How to install GitLab Runner on RedHat Linux ?

Step #1: To install GitLab Runner on RedHat Linux.

Add the official GitLab repository using below command

curl -L "https://packages.gitlab.com/install/repositories/runner/gitlab-runner/script.rpm.sh" | sudo bash
repository

Install the latest version of GitLab Runner

sudo yum install gitlab-runner
install gitlab runner

OR

To install a specific version of GitLab Runner

sudo yum install gitlab-runner-15.11.0-1
specific version

To verify GitLab Runner version using below command

sudo gitlab-runner –version
verify runner version

Step #2:Register GitLab Runner on Redhat Linux

To register GitLab runner run below command

sudo gitlab-runner register

Enter the GitLab instance URL

https://gitlab.com/

register

Enter the registration token:

To get token, you have to go your GitLab project -> setting -> CI/CD -> Runner

setting cicd runner 1

Expand runner to access token

copy token 1
Ex: GR13489417tmRm3FPGPm1zs9RdxiA

Enter a description for the runner:

We used Project runner

Enter tags for the runner (comma-separated):

Devops, RHEL

Enter an executor:

instance

Then you will get Runner registered successfully.

register2

Now you have to refresh the gitlab page and again go to project -> setting -> CI/CD -> runner -> expand it then you can see assigned project runner.

Assigned project runner 1

Step #3:GitLab Runner Services commands

To prints the status of the GitLab Runner service.

sudo gitlab-runner status

To start gitlab runner service

sudo gitlab-runner start

To stop the gitlab runner service.

sudo gitlab-runner stop

To stop and then start the gitlab runner service

sudo gitlab-runner restart
services 1

Step #4:Uninstall GitLab runner

To uninstall gitlab runner on Red Hat, firstly you have to stop the gitlab runner service.

sudo gitlab-runner stop

Remove the gitlab from Red Hat

sudo yum remove gitlab-runner
uninsta

Delete the files which are locally present on Red Hat system

sudo rm -rf /opt/gitlab/
sudo rm -rf /var/opt/gitlab
sudo rm -rf /var/log/gitlab
sudo rm -rf /etc/gitlab
remove files

Conclusion:

In this article we have covered How to install GitLab Runner on RedHat Linux/ any other cloud platform like AWS EC2, Azure VM, Google Cloud with preinstalled Red Hat, Register GitLab Runner, GitLab Runner commands and Uninstall GitLab Runner on Red Hat.

Related Articles:

How to Create Group and Users in GitLab [2 Steps]

About Priti Adkine

I am Priti Adkine working as Software Engineer and having 1+ years of Experience. Likes to share knowledge.

Leave a Comment

This site uses Akismet to reduce spam. Learn how your comment data is processed.

Share via
Copy link