Skip to content

Instantly share code, notes, and snippets.

@pablopunk
Last active January 13, 2026 18:22
Show Gist options
  • Select an option

  • Save pablopunk/ffa1de4ec0f298f122a5e87129a74626 to your computer and use it in GitHub Desktop.

Select an option

Save pablopunk/ffa1de4ec0f298f122a5e87129a74626 to your computer and use it in GitHub Desktop.
Install Github Actions runner on a brand new ubuntu server
#!/bin/bash
set -e
REPO_URL="https://github.com/xxxxxxx/yyyyyyy"
RUNNER_VERSION="2.330.0"
RUNNER_USER="runner"
RUNNER_DIR="/home/${RUNNER_USER}/actions-runner"
RUNNER_TGZ="actions-runner-linux-x64-${RUNNER_VERSION}.tar.gz"
RUNNER_TOKEN="YYYYYYYYYYYYYYYYYYYYYYYY" # get it from repo - settings - actions - runners - new self hosted runner
apt update
apt install -y curl git sudo gh
if ! id "${RUNNER_USER}" >/dev/null 2>&1; then
useradd -m -s /bin/bash "${RUNNER_USER}"
fi
if ! grep -q "^${RUNNER_USER} " /etc/sudoers; then
echo "${RUNNER_USER} ALL=(ALL) NOPASSWD:ALL" >> /etc/sudoers
fi
mkdir -p "${RUNNER_DIR}"
chown "${RUNNER_USER}:${RUNNER_USER}" "${RUNNER_DIR}"
sudo -u "${RUNNER_USER}" bash <<EOF
set -e
cd "${RUNNER_DIR}"
curl -o "${RUNNER_TGZ}" -L \
"https://github.com/actions/runner/releases/download/v${RUNNER_VERSION}/${RUNNER_TGZ}"
tar xzf "${RUNNER_TGZ}"
./config.sh \
--url "${REPO_URL}" \
--token "${RUNNER_TOKEN}"
EOF
cd "${RUNNER_DIR}"
./svc.sh install
./svc.sh start
./svc.sh status
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment