Setting Up a Self-Hosted GitHub Runner
Introduction
Section titled “Introduction”Self-hosted runners let you run GitHub Actions jobs on machines you control.
Install and Register
Section titled “Install and Register”- Go to Settings > Actions > Runners and click New self-hosted runner.
- Choose the desired OS and architecture and copy the download and configuration commands.
- On the target machine, run:
Terminal window ./config.sh --url https://github.com/OWNER/REPO --token YOUR_TOKEN - Optionally add labels during configuration to target specific jobs.
- Start the runner:
Terminal window ./run.sh
Service Installation
Section titled “Service Installation”For long-running usage, install the runner as a service:
sudo ./svc.sh installsudo ./svc.sh start
Security Tips
Section titled “Security Tips”- Use ephemeral runners for untrusted workloads.
- Restrict network access and keep the machine updated.
- Regularly rotate runner registration tokens.