Headless linux install of Unity version for building on server

I am using the latest Ubuntu Server and have TeamCity installed as my build server. I have an agent installed and running as well. I want to do this so that I can have a build created for a linux target to ensure it actually builds. In the future I can have Linux users actually playtest these builds.

I am unable to find any documentation on how I would install Unity build tools and stuff to do a headless build without the editor through UnityHub (which I can’t open). Is what I want to do even possible?

You can use Unity Hub headless. -m and -cm automatically installs all child modules of selected modules. You can try “–headless help” for more options.

Example: unityhub --headless install --version 2022.1.22f1 -m android --cm

This command will install Unity 2022.1.22f1 with android build support. OpenJDK, SDK, NDK everything.

Would you be able to link official documentation around installing headless? Would be good for that to be found here in case anyone has the same question and finds this thread. I have tried finding that doc but unsuccessful.

I think I tried this earlier for an automated install, but had to accept a license agreement. Is there a flag to auto-accept that?

Is there any way to use unity hub on servers without display? When launching unity hub in headless mode get the error (unityhub-bin:1761678): Gtk-WARNING **: 12:19:44.890: cannot open display:

Tried to install unity version without hub, but installer from Download Archive is unable to install android platform entirely (missing SDK, NDK, JDK and no possibility to add it). The info message says

Available components: Unity,Android,iOS,Linux-IL2CPP,Linux-Server,Mac-Mono,Mac-Server,WebGL,Windows-Mono,Windows-Server