Why Run Your Own
- Speed: more cores and memory than hosted runners, and caches that stay on disk between builds.
- Cost: a flat monthly price for the server instead of hosted-runner minutes for heavy pipelines.
- Access: a fixed IP address for firewalls and allowlists, and private services on the same network.
Our VPS plans start at $37.50 a month, and dedicated servers at $399.00, up to 128 cores in one server.
1. Create a User for the Runner
The runner refuses to register as root. Give it its own user:
sudo useradd -m -s /bin/bash runner sudo su - runner
2. Download and Register
In GitHub, open the repository (or the organisation, to share runners across repositories), then Settings → Actions → Runners → New self-hosted runner, and choose Linux x64. GitHub shows the commands with the current version and a registration token; they look like this:
mkdir actions-runner && cd actions-runner curl -o actions-runner-linux-x64-VERSION.tar.gz -L \ https://github.com/actions/runner/releases/download/vVERSION/actions-runner-linux-x64-VERSION.tar.gz tar xzf ./actions-runner-linux-x64-VERSION.tar.gz ./config.sh --url https://github.com/OWNER/REPO --token TOKEN --name build-01 --labels linux,x64,vps
Copy the exact lines from GitHub: the version and token change, and the token expires after about an hour.
3. Run It as a Service
Back as a user with sudo, in the runner's folder:
cd /home/runner/actions-runner sudo ./svc.sh install runner sudo ./svc.sh start sudo ./svc.sh status
The runner now starts with the server and shows as Idle under Settings → Actions → Runners.
4. Use It in a Workflow
jobs:
build:
runs-on: [self-hosted, linux, x64]
steps:
- uses: actions/checkout@v4
- run: make testLabels pick the runner: add your own, such as vps or big, to send heavy jobs to a larger server.
5. Install What Your Builds Need
Unlike GitHub's hosted runners, yours starts with only what the operating system has. Install your toolchains once, or run jobs in containers:
curl -fsSL https://get.docker.com | sudo sh sudo usermod -aG docker runner # the runner can now start containers sudo ./svc.sh stop && sudo ./svc.sh start
Membership of the docker group is equivalent to root on that server, which is another reason to keep the runner to repositories you trust. Running Docker on a VPS covers the rest of the setup.
Keeping It Healthy
- Disk: build caches and Docker images grow. Prune them on a schedule (
docker system prune -af --filter until=168h) and watch space as in freeing up disk space. - Clean jobs: register with
--ephemeralto have a runner take one job and unregister, for builds that must start from a clean state; this needs something to register a new runner each time. - Updates: the runner updates itself; keep the operating system patched as on any internet-facing server.
- Several runners: repeat steps 2 and 3 in folders such as
actions-runner-2with different names, so one server runs several jobs at once.