Cyber Month Offers - Up to 41% OFF

How to Set Up a Self-Hosted GitHub Actions Runner

How to Set Up a Self-Hosted GitHub Actions Runner
Published on Nov 19, 2026 Updated on Nov 23, 2026

GitHub Actions is a CI/CD platform that lets teams automate building, testing, and deploying code directly from their repositories. Every workflow job runs on a runner. This is a virtual machine with the GitHub Actions runner application installed. The runner listens for queued jobs, executes the steps defined in the workflow, and reports the logs and results back to GitHub.

GitHub supports two kinds of runners: GitHub-hosted runners and self-hosted runners.

GitHub-hosted runners are virtual machines that GitHub provisions and maintains for you. They are available for Linux, Windows, and macOS. Each job gets a fresh, ephemeral VM built from a preconfigured image with common tools already installed, and the VM is destroyed once the job finishes.

Every job starts from a clean, predictable environment. There is no infrastructure to maintain. The trade-offs are fixed machine sizes (no scalability), per-minute billing once your plan’s included minutes run out, and no persistence between jobs, which means dependencies and caches must be downloaded or restored on every run.

Self-hosted runners are machines you set up and manage yourself, whether a cloud VPS, a virtual machine, or a bare metal server. Here, you choose the hardware, operating system, toolchains (e.g., Rust, Go, and Python), and system settings. In exchange for this autonomy, you take full responsibility for patching the OS, updating the runner application, securing the machine, and keeping it online.

In this article, we'll walk through installing and configuring a self-hosted GitHub runner on a bare-metal server.

#Why Self-Hosted Runners?

The main reasons for choosing a self-hosted runner usually come down to performance, cost, and control. Let’s dive deeper into these key points.

#1) Greater Autonomy

GitHub-hosted runners come in preset sizes. Beyond the standard runners, GitHub offers larger runners, including GPU-enabled options, on its Team and Enterprise Cloud plans. But even so, you’re limited to the configurations GitHub provides, and larger machines come at a higher per-minute rate.

A self-hosted runner removes those limits. You choose the operating system, hardware, system settings, and installed software. For example, you can run workflows on an Ubuntu server with a dedicated GPU, a particular CPU architecture, and preferred software packages already installed.

You can also tune kernel settings or connect directly to services on your private network. This flexibility is especially valuable for teams running heavy workloads or jobs that require specialized hardware.

#2) Potential Cost Savings

A standard GitHub-hosted runner is charged per minute once the included minutes are exhausted. This can easily snowball into huge costs with heavy usage over time, especially for Windows and macOS runners.

Self-hosted runners are free of GitHub Actions platform charges. Hence, running workflows on your own server is significantly cheaper since you only pay for the cloud hosting and maintenance.

#3) Speed Through Persistence

A GitHub-hosted standard runner runs on a lightweight virtual machine. A fresh VM is created for each job. Once the job finishes, the virtual machine is destroyed, and the filesystem starts afresh with no lingering state from previous builds.

A self-hosted runner, on the other hand, retains build caches, downloaded dependencies, compiled artifacts, and other resources between jobs, reducing setup time for subsequent jobs.

#4) Compliance Through Data Residency

With self-hosted runners, you can build workflows that deploy directly to your own servers and run integration tests against your lab environment. This lets organizations keep source code, build artifacts, and secrets within their infrastructure for compliance. They dictate where jobs run and who can access their servers.

Rent Dedicated Servers

Deploy custom or pre-built dedicated bare metal. Get full root access, AMD EPYC and Ryzen CPUs, and 24/7 technical support from humans, not bots.

#Prerequisites

To follow along, here’s what you need:

  • A bare server instance. In this guide, we are running Ubuntu 26.04. You can provision a high-performance, [dedicated bare-metal server]https://www.cherryservers.com/bare-metal-dedicated-servers) on Cherry Servers to follow along.

  • Minimum 8 GB RAM and 4 vCPUs

  • SSH access to the server with a sudo user configured

  • A GitHub account with an existing repository

#Setting Up a Self-Hosted GitHub Actions Runner on Bare Metal

#Step 1: Install Prerequisite Packages

  1. To get things off the ground, log into your server via SSH and start by updating the system by running the following command:

    Command Line
    sudo apt update
    
  2. Next, install the following prerequisite packages that will be required during installation and configuration of GitHub runners with:

    Command Line
    sudo apt install curl wget git unzip jq ca-certificates -y
    

#Step 2: Create a Dedicated Runner User

The recommended way of operating the runner is to create a dedicated, unprivileged system user. Running it as root is not recommended, as it exposes your entire system to significant security and operational risks. Any malicious script can effortlessly modify system files, access secrets, or compromise your bare-metal server.

  1. To create a dedicated runner system user, run the command:

    Command Line
    sudo useradd -m -s /bin/bash github-runner
    
  2. Then lock its password to ensure no one can log in and gain access to your system.

    Command Line
    sudo passwd -l github-runner
    
  3. Next, switch to the github-runner user:

    Command Line
    sudo su - github-runner
    

#Step 3: Download the GitHub Actions Runner

The next step is to download the GitHub Actions Runner. This will act as the bridge or agent that connects your local machine or private server to GitHub's cloud. It checks GitHub for workflow jobs, executes them locally on your bare-metal server, and sends the logs back.

  1. To download the GitHub Actions Runner, first create the directory for the runner and navigate into it.

    Command Line
    mkdir actions-runner && cd actions-runner
    
  2. When you run the pwd command, your directory should look like this:

    Command Line
    /home/github-runner/actions-runner/
    

Once you have set up a dedicated user for operating the runner, the next step is to create the runner in GitHub.

  1. Access your GitHub account and navigate to the repository where you want to create the runner.

    Next, navigate to Repository > Settings > Actions > Runners.

  2. Then choose New self-hosted runner.

    You will be presented with a list of operating systems to choose from: Windows, Linux, and Mac. Since we are running on a Linux system, select Linux > x64.

    Once you’ve selected the architecture, GitHub will display commands to download, configure, and run your runner.

self-hosted-runner-installation-instructions

  1. Using the curl command, download the latest actions-runner compressed file.

    Command Line
    curl -o actions-runner-linux-x64-<VERSION>.tar.gz -L https://github.com/actions/runner/releases/download/v<VERSION>/actions-runner-linux-x64-<VERSION>.tar.gz
    
  2. Once downloaded, be sure to verify the checksum.

    Command Line
    echo "<SHA256>  actions-runner-linux-x64-<VERSION>.tar.gz" | shasum -a 256 -c
    

    You should get the following response, confirming the authenticity of the downloaded file.

    Command Line
    actions-runner-linux-x64-<VERSION>.tar.gz: OK
    
  3. Next, uncompress the actions-runner tarball file using the tar command:

    Command Line
    tar -xvzf actions-runner-linux-x64-<VERSION>.tar.gz
    

#Step 4: Register the Runner

Once you have downloaded and uncompressed the actions-runner tarball file, the next step is to register the runner.

  1. Once again, head back to your GitHub page and continue following the steps outlined.

    Under the Configure section, copy and run the following command on your bare metal server.

    Command Line
    ./config.sh \
      --url https://github.com/YOUR_USERNAME/YOUR_REPOSITORY \
      --token YOUR_REGISTRATION_TOKEN
    

    Here you will be prompted for the following details:

    • Runner group: You can press ENTER to go with the default.

    • Runner name: You can provide a simple name, e.g., server-01 or press ENTER to choose localhost as the default name.

    • Labels: Provide a label name, e.g., ubuntu or label-01.

    • Work folder: Provide your preferred work folder name, or hit ENTER to choose the default selection: _work.

#Step 5: Test the Runner Manually

  1. Once done, you can test the runner manually by running:

    Command Line
    ./run.sh
    

    You should see the following output:

    Output√ Connected to GitHub
    
    Current runner version: '...'
    
    Listening for Jobs
    

    The output above is a good sign and shows everything is working as intended.

    In GitHub, the runner should be indicated as Idle under Settings > Actions > Runners. Leave it running for the next step.

#Step 6: Create a Test GitHub Actions Workflow

To create a GitHub workflow, switch to your GitHub repository, i.e., https://github.com/YOUR_USERNAME/YOUR_REPOSITORY.

  1. Next, create a workflow directory path by clicking Add File and selecting Create new file in the pull-down menu that appears.

  2. In the name field that appears, copy and paste this line: .github/workflows/my-test-runner.yml. GitHub will automatically populate the directory structure for you.

  3. Next, add the following sample workflow YAML code.

    name: Test Self-Hosted Runner
    on:
      workflow_dispatch:
    jobs:
      test:
        runs-on: [self-hosted, linux, x64]
        steps:
          - name: Display server information
            run: |
              echo "Hello from my bare-metal runner!"
              echo "Hostname: $(hostname)"
              echo "User: $(whoami)"
              echo "OS: $(grep -w VERSION /etc/os-release)"
              date
              free -h
              df -Th
    

    create-a-test-github-actions-workflow

    Let’s break down the code:

    • name: Defines the workflow name.

    • workflow_dispatch: Lets you start the workflow manually.

    • runs-on: Instructs GitHub to locate your self-hosted Linux x64 runner.

    • steps: Defines the commands that your bare metal server will run.

    • commands under the run directive: These are the commands that will be executed on your server.

  4. Once you have pasted the code, click the green Commit changes button in the top right corner.

  5. In the Commit changes pop-up dialog that appears, GitHub Copilot will suggest a commit message. You can go with the recommended message or provide your own. Then click Commit changes.

    commit-changes-for-github-workflow

    Your workflow is now saved in the repository.

  6. To run the workflow, click the Actions tab at the top of your repository. Your workflows will be listed on the left-side bar.

  7. Next, click Test Self-Hosted Runner, and click Run workflow. Confirm the branch you are working on (in our case, the master branch) and click the confirmation button Run workflow.

    test-run-github-actions-workflow

    You should get a Success status showing that the workflow executed successfully.

    github-actions-workflow-successful

  8. Click the test job and expand the Display server information step. You should see the output of all commands defined in the workflow YAML file.

    github-actions-workflow-display-server-information

#Step 7: Install the Runner as a Systemd Service

In Step 5, you ran the ./run.sh command to test the runner. To avoid running the script every time, we need to create a systemd service for the runner.

  1. First, stop the manual runner by pressing Ctrl + C.

  2. Since the github-runner user cannot run privileged tasks, exit and switch to your administrative user

    Command Line
    exit
    
    Command Line
    sudo su - username  # where username is the sudo user
    
  3. Then navigate to the /home/github-runner/actions-runner directory.

    Command Line
    cd  /home/github-runner/actions-runner
    
  4. Next, install the systemd service by running:

    Command Line
    sudo ./svc.sh install github-runner
    
  5. Next, start the service with:

    Command Line
    sudo ./svc.sh start
    
  6. Then verify the service status.

    Command Line
    sudo ./svc.sh status
    

    The following output will be printed, confirming the runner’s systemd service is active and running.

    Output/etc/systemd/system/actions.runner.kodewise-my-test-project.localhost.service
    ● actions.runner.kodewise-my-test-project.localhost.service - GitHub Actions Runner (kodewise-my-test-project.localhost)
        Loaded: loaded (/etc/systemd/system/actions.runner.kodewise-my-test-project.localhost.service; enabled; preset: enabled)
        Active: active (running) since Mon 2026-10-19 07:00:13 UTC; 3 days ago
    Invocation: ec05e58e63b74509a35ddee3bde26a24
      Main PID: 20236 (runsvc.sh)
         Tasks: 20 (limit: 3561)
        Memory: 85.9M (peak: 117.9M)
            CPU: 40.206s
    

#Step 8: Monitoring the Runner

Now that you have confirmed the self-hosted runner is running, monitoring is the next logical step. Ideally, you want to establish two things:

  • Is the runner online and connected to GitHub?

  • Is it executing the jobs successfully?

  1. Since you've installed your runner as a systemd service on bare-metal Ubuntu, you can monitor it directly from the terminal.

    Command Line
    sudo systemctl status 'actions.runner.*'
    

    The output should confirm that the service is running.

    Additionally, you can head to your GitHub repository and navigate to Settings > Actions > Runners.

    You'll see your runner and its current status indicated as Idle.

    github-actions-runner-idle-status

#Common Runner Issues and How to Troubleshoot

In this section, we will highlight some of the common issues you are likely to run into with your self-hosted runner and troubleshooting tips.

1) Runner Offline Status

Sometimes, the runner can fail to start and register as Offline on GitHub. This means the service has stopped or the server has lost an internet connection and can’t reach GitHub.

To resolve this:

  1. Check if the service is running. To do so, navigate into the actions-runner directory and run the command:

    Command Line
    sudo ./svc.sh status
    

    If the service has stopped, try restarting it by running:

    Command Line
    sudo ./svc.sh start
    
  2. Check the server’s internet connection.

    Another problem could be a dropped internet connection. To check if your server has internet access, use the ping command:

    Command Line
    ping -c 4 github.com
    

    You should get a positive ping result if your server has an internet connection. Additionally, try sending an HTTP GET request to GitHub with the curl command:

    Command Line
    curl -I https://github.com
    

    You should get the HTTP/2 200 HTTP status code, indicating your server can reach GitHub. Also, you should see headers such as date, content-language, cache-control, and strict-transport-security.

  3. Additionally, check recent service logs using the journalctl command and ensure there are no errors.

    Command Line
    sudo journalctl -u "$(cat .service)" -n 50 --no-pager
    

    Alternatively, you can also follow live logs as shown for any errors.

    Command Line
    sudo journalctl -u 'actions.runner.*' -f
    

    Also, check the service log files in the ~/actions-runner/_diag directory. You can list the files using the ls command:

    Command Line
    ls ~/actions-runner/_diag
    

    For example, you can examine a log file and look for entries containing the 'Error' keyword, as shown:

    Command Line
    cat ~/actions-runner/_diag/Runner_20261019-070013-utc.log | grep 'Error'
    

2) Workflow Job Remains Queued

A job runs only on a runner that has all the labels listed in the runs-on directive in the workflow YAML file.

Suppose the workflow’s YAML file has the following labels:

runs-on: [self-hosted, linux, x64]

The same labels must be present in the runner. To confirm your runner’s labels, navigate to:

Repository > Settings > Actions > Runners > Your runner name

To add a missing label, click the gear icon next to the labels, specify the new label name, and refresh the web page.

3) Runner Fails After a Reboot

  1. If the runner service fails after a reboot, first check if it is enabled by using:

    Command Line
    systemctl is-enabled "$(cat /home/github-runner/actions-runner/.service)"
    
  2. If it’s not enabled, be sure to enable it by running the following command:

    Command Line
    sudo systemctl enable "$(cat /home/github-runner/actions-runner/.service)"
    
  3. Then start the service with:

    Command Line
    sudo ./svc.sh start
    

    This should keep the service running even after a restart.

4) Jobs Fail or Run Slowly

Another issue you may run into is a failed job or degraded performance when running one. This is indicative of your server running out of CPU and memory when building jobs.

  1. To address the problem, check the processes consuming excessive resources by running the htop command:

    Command Line
    htop
    
  2. To check memory utilization, use the free -h command:

    Command Line
    free -h
    

    This shows information about used and available memory and swap usage.

  3. For filesystem usage, run the df command.

    Command Line
    df -Th
    

    Once you have identified the resource-hogging applications/processes, consider terminating them or ramping up underlying resources to keep up with rising workload demands.

#Conclusion

Setting up a self-hosted GitHub runner on a bare metal server offers full control over the environment where your workflows run. We have seen how to download and configure the runner application, register it with GitHub, and configure it as a systemd service so that it starts automatically on boot or a reboot. Lastly, we covered how to monitor the server to track resource usage and catch problems early.

Running your own runner also means taking full responsibility for the server environment. This means keeping the OS and runner application up to date and avoiding self-hosted runners with public repositories unless you fully trust the code being executed, since self-hosted runners persist job state and malicious code can exploit your system.

You now have a bare-metal self-hosted runner for running your CI/CD pipelines. For enhanced monitoring of your server, consider installing Prometheus and Grafana for tracking, alerting, and visualizing system metrics in real time.

Bare Metal Servers - 12 Minute Deployment

Get 100% dedicated resources for high-performance workloads.

Share this article

Related Articles

Published on Dec 1, 2026 Updated on Dec 2, 2026

How to Choose a Dedicated Server in Sweden

Learn how to choose a dedicated server in Sweden. Compare hardware, performance, security, hosting providers, pricing, and data residency options.

Read More
Published on Nov 29, 2026 Updated on Nov 30, 2026

Bare Metal Vs. Dedicated Server: What Is The Difference?

Learn the differences between bare metal and dedicated servers, including performance, hardware, pricing, deployment, and management, to choose the right hosting solution.

Read More
Published on Nov 26, 2026 Updated on Nov 26, 2026

Tokyo Dedicated Servers: A Guide to Latency, Specs and Providers

This guide lists seven of the best Tokyo dedicated server providers, highlighting their strengths, limitations, and ideal use cases.

Read More
No results found for ""
Recent Searches
Navigate
Go
ESC
Exit