Skip to content

Instantly share code, notes, and snippets.

@EvanBalster
Created February 28, 2024 10:25
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save EvanBalster/50cd3ff2db27a31e4e8fc2a4717e2499 to your computer and use it in GitHub Desktop.
Save EvanBalster/50cd3ff2db27a31e4e8fc2a4717e2499 to your computer and use it in GitHub Desktop.
Steps for installing forgejo without root access (eg, on Dreamhost VPS)

Setting up Forgejo without root access / running under a single user. I devised these steps to deploy Forgejo on a Dreamhost VPS which only provided an SSH user.

  • Create user folders and install forgejo to use these rather than system paths.
    • Download forgejo to ~/bin/forgejo. Make sure ~/bin is in your path (for example by editing your .bashrc file)
    • Download the forgejo.service script to ~/.config/systemd/user.
    • Create the following folders:
      • ~/var/lib/forgejo
      • ~/etc/forgejo
  • Edit the forgejo.service script to run under the current user.
    • Delete the lines assigning User and Group.
    • Edit the lines assigning WorkingDirectory, ExecStart and Environment to use your revised local paths. These must be absolute, and include your username:
      • /usr/bin/forgejo is replaced by /home/my_username/bin/forgejo
      • /var/lib/forgejo is replaced by /home/my_username/var/lib/forgejo
      • /etc/forgejo is replaced by /home/my_username/etc/forgejo
  • Include the --user switch in all invocations of systemctl.
    • systemctl --user enable forgejo.service
    • systemctl --user start forgejo.service
  • Run loginctl enable-linger $USER (this will keep forgejo running even if you log out or reboot)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment