First step is to remove the default files using these commands:
rm index.php rm missing.html rm php.ini rmdir cgi-bin
Next is to install Drupal 9:
composer create-project drupal/recommended-project . --no-interaction
The
--no-interaction
is optional, that’s just how we like to do it.
Next step is to install the files for CiviCRM:
composer require civicrm/civicrm-{core,packages,drupal-8}:'~5.55'
Last step is to set the “webroot.” To do that, visit the Subdomains page of your hosting Control Panel and edit the subdomain in question and change the webroot to “web”.
To finish, you install Drupal and then CiviCRM normally, via their web interfaces.