You must install Elasticsearch before installing Adobe Commerce or Magento Open Source 2.4.0. See Elasticsearch for details.
Install sample data after Magento
The following topics discuss how to install optional sample data after you have already installed the Magento software. There is one additional step compared to pre-installation, which is to update the Magento database schema and data.