Not Your Dad's IT

Updated Solutions to Classic Challenges

A personal website dedicated to helping IT professionals review where we've been, where we are, and maybe where we are headed.

  • Blog
  • About
  • Disclaimer

GitLab - Install GitLab Runner on Amazon Linux 2

October 04, 2020 by Nathaniel Avery in DevOps, Install, POC, Software Development

GitLab is a powerful, all-in-one package for use as a source code repository as well as a full continuous integration / continuous deployment (CI/CD) suite. Using GitLab on AWS for implementing CI/CD tasks is made possible by using an EC2 Instance that’s allocated for use by GitLab as a “runner.” Runners execute the commands included in the pipeline definition. This document walks through the steps used to install the runner software. The software is installed on a typical AWS EC2 Instance running Amazon Linux 2 as an OS. If you’d like to follow along using this blog in a simple proof-of-concept (PoC), it’s acceptable to use choose a free tier option.

Prerequisites

The runner has to have a communication channel to the main GitLab server. Ports 80, and/or 443 need to be opened based on the configuration of the GitLab server. This is accomplished via a modification of the AWS Security group(s) regulating EC2 access. Access can be validated via a curl command from the runner vm to the GitLab server.

Steps

  1. Update the instance with the latest packages

    sudo yum update -y
  2. Add the repository of the package

    curl -L https://packages.gitlab.com/install/repositories/runner/gitlab-runner/script.deb.sh | sudo bash
GitLab-add-package-repository.png

3. Download the package for RHEL/CentOS/Fedora

sudo curl -L --output /usr/local/bin/gitlab-runner https://gitlab-runner-downloads.s3.amazonaws.com/latest/binaries/gitlab-runner-linux-386

4. Install the Package

export GITLAB_RUNNER_DISABLE_SKEL=true; sudo -E yum install gitlab-runner

5. Register the runner - When registering the the runner, there are options. In this case, guidance for a "Specific Runner” is used

sudo gitlab-runner register

During registration, you'll be asked a number of questions. The PoC keeps the answers simple.

  1. Please enter the gitlab-ci coordinator URL (e.g. https://gitlab.com/):

    <URL of the GitLab Server to conne to>

  2. Please enter the gitlab-ci token for this runner:

    <Token is provided by the GitLab server>

  3. Please enter the gitlab-ci description for this runner:

    <This can be something simple>

  4. Please enter the gitlab-ci tags for this runner (comma separated):

    <leave blank>

After this, the runner should have connectivity to the GitLab server.

Runner_successful_screenshot.png

References

https://docs.gitlab.com/runner/install/linux-repository.html

Registering Runners - https://docs.gitlab.com/runner/register/index.html

https://medium.com/@journald/gitlab-runner-setup-on-ec2-instance-centos-7-3b49f4b43132



October 04, 2020 /Nathaniel Avery
GitLab
DevOps, Install, POC, Software Development
  • Newer
  • Older

Powered by Squarespace