Help with developing and contributing to the code

I looked at the developer manual and under development environment it says:

set up web server and database which redirects to another page in the admin manual (set up your web server and database at https://docs.nextcloud.com/server/stable/admin_manual/installation/index.html). My question is that it is not clear what one needs to do. On the admin page, it says that the nextcloud .tar contains all of the php modules, does that mean we must use .tar (not documented how to do that) or are we supposed to do a bunch of apt install commands to install php and the required modules? how do I know which command to run to install all of those.

Then about Apache, no instructions on how to install it and which of the documented additional apache configurations are required to develop?

Later under app development tutorial, it says that the development environment can be done downloading the zip or cloning from github. Does that mean that all of the php tedious undocumented install and the labourious apache install and config are not required?

You need an environment with webserver, php and database. The requirements for development are the same as for running a server.

Except of downloading and install the packaged versions for end users, you will install manually from github/zip-file (+checkout code etc.). But this is just the php script files, to be able to use them, you have to have php installed (and a webserver+database).

You can use also container techniques to avoid cluttering your development machine and avoid the configuration of http/php/database.

I am providing one example configuration on github that you can use as a start. You are welcome to ask questions.
There is also one alternative from juliushaertl, as far as I remember.