A Beginners guide: Installing Magento 2.4

In this guide, I will just show you the quick basics to get your Magento site up and running.

Check your Server Requirements

Before we start, ensure that your server meets the requirements set up here: https://devdocs.magento.com/guides/v2.4/install-gde/system-requirements.html

As per the devdocs for Magento 2.4, you must also install Elasticsearch prior to installing Magento see this guide on how to do this. https://devdocs.magento.com/guides/v2.4/install-gde/prereq/elasticsearch.html

Install Composer

Magento 2+ use Composer for dependency management, this allows modules (and Magento) to be installed and managed. So, you need to have Composer installed https://getcomposer.org/download/.

Authentication Keys

Create or Login to your Magento account (https://account.magento.com/customer/account/)

and then navigate to “marketplace” > “Access Keys”

Create a new set of access keys and make a note of the Public and Private Keys. The “Public Key” will be our “Username” and the “private key” will be our “Password”.

Download Magento!

Navigate to the directory, using SSH, where you want Magento to be installed and enter the following command.

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

The “.” at the end installs it in the current directory, but you can adjust this to wherever you want.

When requested for a username and password, simply use the one in “Authentication Keys” in the previous step.

Set the Permissions

As per the devdocs you should set permissions like this:

cd /var/www/html/<magento install directory>
find var generated vendor pub/static pub/media app/etc -type f -exec chmod g+w {} +
find var generated vendor pub/static pub/media app/etc -type d -exec chmod g+ws {} +
chown -R :www-data . # Ubuntu
chmod u+x bin/magento

Install Magento!

Now that Magento is downloaded we finally need to install it by running this following command:

bin/magento setup:install \
--base-url=http://m2.johnadavies.me \
--db-host=localhost \
--db-name=some_database_name \
--db-user=some_database_user \
--db-password=some_database_password \
--admin-firstname=a_firstname \
--admin-lastname=a_lastname \
--admin-email=your.email@address.com \
--admin-user=dont_use_admin_for_a_name \
--admin-password=dont_use_admin123 \
--language=en_GB \
--currency=GBP \
--timezone=Europe/London \
--use-rewrites=1

Leave a Reply

Your email address will not be published. Required fields are marked *