Skip to content

Gitlab Stuff

Runner as normal user on Rocky 9

You can run gitlab-runner as a service under a normal user account. We'll add a normal user on the system called testuser. Then we enable lingering for that user so that systemd units can run whether or not the user is logged on.

# adduser testuser
# loginctl enable-linger testuser

Then you can switch to that user from a root session.

# su - testuser

Now that we're running as the new user, we can register gitlab-runner.

$ gitlab-runner register

Once the runner is registered, we need to create a service file for it in ~/.config/systemd/user/gitlab-runner.service

[Unit]
Description=Gitlab CI Runner
Wants=network-online.target
After=network-online.target

[Service]
Restart=on-failure
ExecStart=/usr/bin/gitlab-runner run

[Install]
WantedBy=default.target

Then we can reload the systemd unit files and start and enable the service.

$ systemctl --user daemon-reload
$ systemctl --user enable --now gitlab-runner.service

Now the gitlab runner for that user account will start at boot and be able to run jobs under that account.