|
| 1 | +--- |
| 2 | +title: Install and Set Up GitHub Self-Hosted Runner on Google Cloud C4A Virtual Machine |
| 3 | +weight: 4 |
| 4 | + |
| 5 | +### FIXED, DO NOT MODIFY |
| 6 | +layout: learningpathall |
| 7 | +--- |
| 8 | + |
| 9 | + |
| 10 | +## Set Up GitHub Actions Self-Hosted Runner on Google Axion C4A Virtual Machine |
| 11 | + |
| 12 | +This Learning Path shows how to deploy a self-hosted GitHub Actions runner on a Google Cloud C4A Arm64 virtual machine running Ubuntu. It covers installing Git and GitHub CLI, authenticating with GitHub and configuring the runner on an Arm64 environment for optimized CI/CD workflows. |
| 13 | + |
| 14 | +### Install Git and GitHub CLI |
| 15 | +```console |
| 16 | +sudo apt update |
| 17 | +sudo apt install -y git gh |
| 18 | +``` |
| 19 | +Login to GitHub |
| 20 | +```console |
| 21 | +gh auth login |
| 22 | + ``` |
| 23 | +The command `gh auth login` is used to authenticate the GitHub CLI with your GitHub account. It allows you to securely log in using a web browser or token, enabling the CLI to interact with repositories, actions, and other GitHub features on your behalf. |
| 24 | + |
| 25 | + |
| 26 | + |
| 27 | +Below is the GitHub login UI: |
| 28 | + |
| 29 | + |
| 30 | + |
| 31 | +### Test GitHub CLI and Git |
| 32 | +Create a test repo: |
| 33 | +```console |
| 34 | +gh repo create test-repo –public |
| 35 | +``` |
| 36 | +You should see an output similar to: |
| 37 | +```output |
| 38 | +✓ Created repository <your-github-account>/test-repo on GitHub |
| 39 | + https://github.com/<your-github-account>/test-repo |
| 40 | +``` |
| 41 | + |
| 42 | +The command `gh repo create test-repo --public` creates a new public GitHub repository named **test-repo** using the GitHub CLI. It sets the repository visibility to public, meaning anyone can view it |
| 43 | + |
| 44 | +### Configure the Self-Hosted Runner |
| 45 | +Go to your repository's **Settings > Actions**, and under the **Runners** section, click on **Add Runner** or view existing self-hosted runners. |
| 46 | +If the **Actions** tab is not visible, ensure Actions are enabled by navigating to **Settings > Actions > General**, and select **Allow all actions and reusable workflows**. |
| 47 | + |
| 48 | + |
| 49 | + |
| 50 | +Then, click on the **New runner** button, followed by **New self-hosted runner**. In the **Add new self-hosted runner** section, proceed as follows: |
| 51 | +- Select Linux for the operating system. |
| 52 | +- Choose ARM64 for the architecture |
| 53 | + |
| 54 | + |
| 55 | + |
| 56 | +Next, execute the following instructions on your Google Axion C4A virtual machine: |
| 57 | +```console |
| 58 | +mkdir actions-runner && cd actions-runner# Download the latest runner package |
| 59 | +curl -o actions-runner-linux-arm64-2.326.0.tar.gz -L https://github.com/actions/runner/releases/download/v2.326.0/actions-runner-linux-arm64-2.326.0.tar.gz |
| 60 | +echo "ee7c229c979c5152e9f12be16ee9e83ff74c9d9b95c3c1aeb2e9b6d07157ec85 actions-runner-linux-arm64-2.326.0.tar.gz" | shasum -a 256 -c# Extract the installer |
| 61 | +tar xzf ./actions-runner-linux-arm64-2.326.0.tar.gz |
| 62 | +``` |
| 63 | +Then, configure the virtual machine with the following command: |
| 64 | + |
| 65 | +```console |
| 66 | +./config.sh --url https://github.com/<YOUR_USERNAME>/YOUR_REPO --token YOUR_TOKEN |
| 67 | +``` |
| 68 | +Replace `YOUR_USERNAME`, `YOUR_REPO`, and `YOUR_TOKEN` accordingly. |
| 69 | +This command links the runner to your GitHub repo using a one-time registration token. |
| 70 | + |
| 71 | +During the command’s execution, you will be prompted to provide the runner group, the name of the runner, and the work folder name. You can accept the defaults by pressing **Enter** at each step. The output will resemble as below: |
| 72 | + |
| 73 | +You should see an output similar to: |
| 74 | + |
| 75 | +```output |
| 76 | +-------------------------------------------------------------------------------- |
| 77 | +| ____ _ _ _ _ _ _ _ _ | |
| 78 | +| / ___(_) |_| | | |_ _| |__ / \ ___| |_(_) ___ _ __ ___ | |
| 79 | +| | | _| | __| |_| | | | | '_ \ / _ \ / __| __| |/ _ \| '_ \/ __| | |
| 80 | +| | |_| | | |_| _ | |_| | |_) | / ___ \ (__| |_| | (_) | | | \__ \ | |
| 81 | +| \____|_|\__|_| |_|\__,_|_.__/ /_/ \_\___|\__|_|\___/|_| |_|___/ | |
| 82 | +| | |
| 83 | +| Self-hosted runner registration | |
| 84 | +| | |
| 85 | +-------------------------------------------------------------------------------- |
| 86 | +
|
| 87 | +# Authentication |
| 88 | +
|
| 89 | +√ Connected to GitHub |
| 90 | +# Runner Registration |
| 91 | +Enter the name of the runner group to add this runner to: [press Enter for Default] |
| 92 | +Enter the name of runner: [press Enter for lpprojectubuntuarm64] |
| 93 | +This runner will have the following labels: 'self-hosted', 'Linux', 'ARM64' |
| 94 | +Enter any additional labels (ex. label-1,label-2): [press Enter to skip] |
| 95 | +√ Runner successfully added |
| 96 | +√ Runner connection is good |
| 97 | +``` |
| 98 | + |
| 99 | +Finally, start the runner by executing: |
| 100 | +```console |
| 101 | +./run.sh |
| 102 | +``` |
| 103 | +You should see an output similar to: |
| 104 | + |
| 105 | +```output |
| 106 | +√ Connected to GitHub |
| 107 | +
|
| 108 | +Current runner version: '2.326.0' |
| 109 | +2025-07-15 05:51:13Z: Listening for Jobs |
| 110 | +``` |
| 111 | +The runner will now be visible in the GitHub actions: |
| 112 | + |
| 113 | + |
0 commit comments