How to Install GitLab Runner on Amazon Linux 2

In this article we are going to cover How to Install GitLab Runner on Amazon Linux 2 and Register GitLab Runner to GitLab on Amazon Linux 2 .

Step #1: Add the Official GitLab Repository

First add the official GitLab Repository using below command, to check latest Gitlab Repository visit the official GitLab Runner page

curl -L "" | sudo bash

Step #2: Install GitLab Runner on Amazon Linux 2

Run below command to install latest GitLab Runner on Amazon Linux 2

sudo yum install gitlab-runner

use below commands to install specific version of GitLab Runner on Amazon Linux 2

yum list gitlab-runner --showduplicates | sort -r
sudo yum install gitlab-runner-10.0.0-1

Command to check GitLab Runner version

sudo gitlab-runner -version


Version:      13.4.1
Git revision: e95f89a0
Git branch:   13-4-stable
GO version:   go1.13.8
Built:        2020-09-25T20:03:43+0000
OS/Arch:      linux/amd64

To check status if GitLab Runner service is running or not

sudo gitlab-runner status


Runtime platform                                    arch=amd64 os=linux pid=29368 revision=e95f89a0 version=13.4.1
gitlab-runner: Service is running!

Commands to Start, Stop and Restart GitLab Runner

sudo gitlab-runner start
sudo gitlab-runner stop
sudo gitlab-runner restart

We have covered How to Install GitLab Runner on Amazon Linux 2.

Step #3: Grant sudo Permission to GitLab Runner User

After install GitLab Runner you will see gitlab-runner user in /home directory

cd /home



To grant sudo permission to gitlab-runner user, ope the visudo file

sudo visudo

Add the gitlab-runner user in sudoers group and set NOPASSWD as shown below

gitlab-runner ALL=(ALL:ALL) ALL
 gitlab-runner ALL=(ALL) NOPASSWD: ALL 


# Host alias specification

# User alias specification

# Cmnd alias specification

# User privilege specification
root    ALL=(ALL:ALL) ALL
gitlab-runner ALL=(ALL:ALL) ALL

# Members of the admin group may gain root privileges
%admin ALL=(ALL) ALL

# Allow members of group sudo to execute any command
%sudo   ALL=(ALL:ALL) ALL

# See sudoers(5) for more information on "#include" directives:

#includedir /etc/sudoers.d
gitlab-runner ALL=(ALL) NOPASSWD: ALL

Step #4: Register GitLab Runner to GitLab on Amazon Linux 2

1. First login to GitLab Server with Username and Password.

login to gitlab server with username and password

2. Click on your project and select Settings

goto gitlab project settings

3. Navigate to Settings and click on CI/CD inside this click on Expand of Runners section

goto gitlab CICD and expand

4. Copy GitLab server URL and Registration Token as shown below.

copy the gitlab server url and token

5. Paste GitLab Server URL and Token in registration command as below

sudo gitlab-runner register --name project-name-runner --url --registration-token  Uc7yzxTMzsXhXJx3zgM


sudo gitlab-runner register


if you want to register gitlab-runner with docker executor then use below command

sudo gitlab-runner register \
  --non-interactive \
  --registration-token "REGISTRATION_TOKEN" \
  --description "docker-runner" \
  --executor "docker" \
  --docker-image centos:latest

6. Copy above command. Login to GitLab runner server through SSH and paste & run copied command on command line.

Follow the default options until which agent you need to register and then select agent as shown below

register gitlab runner using ssh

7. Once you registered Runner for project then you will get runner as below,

gitlab runner activated

Successfully, We have performed GitLab Runner Registration.

Error: This job is stuck because the project doesn’t have any runners online assigned to it. Go to Runners page.


You have added tags while registering GitLab Runner however you have not added tags for your Job.

Follow below steps to add tags.

1. Navigate to Settings and click on CI/CD inside this click on Expand of Runners section

2. Go to Runners and check on Indicates whether this runner can pick jobs without tags Box

How to Install GitLab Runner on Ubuntu 20.04 LTS 1

Uninstall GitLab Runner from Amazon Linux 2

First remove the gitlab-runner using apt

sudo yum install gitlab-runner-10.0.0-1

Remove gitlab-runner gitlab directory

sudo rm -rf /var/opt/gitlab

Kill all processes of gitlab

pkill -f gitlab

Remove gitlab-runner installation directories

sudo rm -rf /opt/gitlab
sudo rm -rf /etc/gitlab
sudo rm -rf /var/opt/gitlab


In this article, How to Install GitLab Runner on Amazon Linux 2 and Register GitLab Runner to GitLab on Amazon Linux 2.

Related Articles

How to Install GitLab on Ubuntu 18.04/16.04 LTS

Angular CI CD Pipeline with GitLab in 6 Easy Steps


GitLab Official Documentation

About DevOps Hint

DevOps Hint Founded in 2020 Community Site where you can find about How to Guides, Articles and Troubleshooting Tips for DevOps, SRE, Sysadmins and Developers.

Leave a Comment

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

Share via
Copy link