How to Set Up a Self-Hosted GitHub Actions Runner
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
-
To get things off the ground, log into your server via SSH and start by updating the system by running the following command:
Command Linesudo apt update -
Next, install the following prerequisite packages that will be required during installation and configuration of GitHub runners with:
Command Linesudo 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.
-
To create a dedicated runner system user, run the command:
Command Linesudo useradd -m -s /bin/bash github-runner -
Then lock its password to ensure no one can log in and gain access to your system.
Command Linesudo passwd -l github-runner -
Next, switch to the
github-runneruser:Command Linesudo 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.
-
To download the GitHub Actions Runner, first create the directory for the runner and navigate into it.
Command Linemkdir actions-runner && cd actions-runner -
When you run the
pwdcommand, 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.
-
Access your GitHub account and navigate to the repository where you want to create the runner.
Next, navigate to Repository > Settings > Actions > Runners.
-
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.
-
Using the
curlcommand, download the latest actions-runner compressed file.Command Linecurl -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 -
Once downloaded, be sure to verify the checksum.
Command Lineecho "<SHA256> actions-runner-linux-x64-<VERSION>.tar.gz" | shasum -a 256 -cYou should get the following response, confirming the authenticity of the downloaded file.
Command Lineactions-runner-linux-x64-<VERSION>.tar.gz: OK -
Next, uncompress the
actions-runnertarball file using thetarcommand:Command Linetar -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.
-
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_TOKENHere 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-01or press ENTER to chooselocalhostas the default name. -
Labels: Provide a label name, e.g.,
ubuntuorlabel-01. -
Work folder: Provide your preferred work folder name, or hit ENTER to choose the default selection:
_work.
-
#Step 5: Test the Runner Manually
-
Once done, you can test the runner manually by running:
Command Line./run.shYou should see the following output:
Output
√ Connected to GitHub Current runner version: '...' Listening for JobsThe output above is a good sign and shows everything is working as intended.
In GitHub, the runner should be indicated as
Idleunder 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.
-
Next, create a workflow directory path by clicking Add File and selecting Create new file in the pull-down menu that appears.
-
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. -
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 -ThLet’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
rundirective: These are the commands that will be executed on your server.
-
-
Once you have pasted the code, click the green Commit changes button in the top right corner.
-
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.
Your workflow is now saved in the repository.
-
To run the workflow, click the Actions tab at the top of your repository. Your workflows will be listed on the left-side bar.
-
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.
You should get a Success status showing that the workflow executed successfully.
-
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.
#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.
-
First, stop the manual runner by pressing Ctrl + C.
-
Since the
github-runneruser cannot run privileged tasks, exit and switch to your administrative userCommand LineexitCommand Linesudo su - username # where username is the sudo user -
Then navigate to the
/home/github-runner/actions-runnerdirectory.Command Linecd /home/github-runner/actions-runner -
Next, install the systemd service by running:
Command Linesudo ./svc.sh install github-runner -
Next, start the service with:
Command Linesudo ./svc.sh start -
Then verify the service status.
Command Linesudo ./svc.sh statusThe 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?
-
Since you've installed your runner as a systemd service on bare-metal Ubuntu, you can monitor it directly from the terminal.
Command Linesudo 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.
#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:
-
Check if the service is running. To do so, navigate into the
actions-runnerdirectory and run the command:Command Linesudo ./svc.sh statusIf the service has stopped, try restarting it by running:
Command Linesudo ./svc.sh start -
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 Lineping -c 4 github.comYou should get a positive ping result if your server has an internet connection. Additionally, try sending an HTTP GET request to GitHub with the
curlcommand:Command Linecurl -I https://github.comYou should get the
HTTP/2 200HTTP status code, indicating your server can reach GitHub. Also, you should see headers such asdate,content-language,cache-control, andstrict-transport-security. -
Additionally, check recent service logs using the
journalctlcommand and ensure there are no errors.Command Linesudo journalctl -u "$(cat .service)" -n 50 --no-pagerAlternatively, you can also follow live logs as shown for any errors.
Command Linesudo journalctl -u 'actions.runner.*' -fAlso, check the service log files in the
~/actions-runner/_diagdirectory. You can list the files using thelscommand:Command Linels ~/actions-runner/_diagFor example, you can examine a log file and look for entries containing the 'Error' keyword, as shown:
Command Linecat ~/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
-
If the runner service fails after a reboot, first check if it is enabled by using:
Command Linesystemctl is-enabled "$(cat /home/github-runner/actions-runner/.service)" -
If it’s not enabled, be sure to enable it by running the following command:
Command Linesudo systemctl enable "$(cat /home/github-runner/actions-runner/.service)" -
Then start the service with:
Command Linesudo ./svc.sh startThis 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.
-
To address the problem, check the processes consuming excessive resources by running the
htopcommand:Command Linehtop -
To check memory utilization, use the
free -hcommand:Command Linefree -hThis shows information about used and available memory and swap usage.
-
For filesystem usage, run the
dfcommand.Command Linedf -ThOnce 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.
Get 100% dedicated resources for high-performance workloads.






