how to install magento 2 code example

Example 1: install magento 2

php bin/magento setup:install --base-url="http://magento2.local/" --db-host="localhost" --db-name="magento" --db-user="magento" --db-password="mage3nt0" --admin-firstname="admin" --admin-lastname="admin" --admin-email="[email protected]" --admin-user="admin" --admin-password="admin123" --language="en_US" --currency="USD" --timezone="America/Chicago"  --use-rewrites="1"  --backend-frontname="admin"

Example 2: install magento 2.4.2

composer create-project --repository-url=https://repo.magento.com/ magento/project-community-edition ./


php bin/magento setup:install \
--admin-firstname=John \
--admin-lastname=Doe \
--admin-email=[email protected] \
--admin-user=admin \
--admin-password=tin@me42. \
--base-url=https://fohow.kara.com.ng \
--base-url-secure=https://fohow.kara.com.ng \
--backend-frontname=admin \
--db-host=mysql \
--db-name=fohowkara \
--db-user=root \
--db-password=Tin@@me43.. \
--use-rewrites=1 \
--language=en_US \
--currency=NGN \
--timezone=Africa/Lagos \
--use-secure-admin=1 \
--admin-use-security-key=1 \
--session-save=files \
--elasticsearch-host=elasticsearch \
--elasticsearch-port=9200