How to install Magento 2.4.5-p1 and build a web server (updated)

VERY IMPORTANT: This post has been updated for Magento 2.4.5-p1 (17th December 2022) and is no longer exactly in sync with the video.

Chapter 1: Introduction

1.1 Initial Comments

By the end of this video, you’ll learn how to:

  • Build a Web Server that runs:
    • Ubuntu 20.04
    • Apache 2.4
    • MySQL 8
    • PHP 8.1
    • Postfix
    • Elasticsearch 7.17 (now required by Magento)
  • Install Magento 2.4.5-p1 via Composer

I try not to start with lengthy introductions these days. However, I’ve packed so much information into this tutorial that I felt it was important that I cover some basics…

I want to start by acknowledging that this tutorial is not for everyone. The topics are aimed at nerds like myself who want to install Magento 2.4 from scratch. However, this tutorial has been designed for any skill level to follow.

To help you follow along, you’ll want to refer to the supporting article that I’ve linked in the video description below. There, you will have access to commands that you can copy & paste - All time-stamped to help you navigate with ease. It will also contain any amendments that get made (as obviously I can’t amend this video after uploading it).

1.2 What you’ll need before starting

Let’s start this video by highlighting what you’ll need before starting.

Web Server (Digital Ocean)

You’ll first need access to a service provider that hosts Web Servers. I recommend Digital Ocean for a number of reasons. The costs are reasonable and their services are spot-on. You can literally create a server in minutes.

As I use this service myself, it improves the chances that I’ll be able to answer any additional questions you may have - Unlike AWS, which I haven’t used. You’ll find a link to Digital Ocean in the video description and the article.

Magento Marketplace (Log In/Create Account)

You’ll also need a Magento Marketplace account. This is where you’ll need to generate a set of “keys”. These keys are required during the Magento 2.4 installation process.

Once you sign into Magento Marketplace, navigate to My Profile. Under the Marketplace tab, click on Access Keys. Then under the Magento 2 tab, click the Create A New Access Key button. In the Popup, give this an appropriate name such as the Business Name of the website you plan to install (note, you cannot use spaces).

Once your Public Key and Private Key are generated, put them somewhere safe for later.

SSH Client (Putty for Windows)

The majority of this video will require you to use an SSH Client to connect to the server. Both Linux and Mac users have an SSH Client built into their operating systems. But on Windows (which I’m using), I use a program called Putty for Windows. Again, you’ll find a link in the article.


During the entire process, you’ll be prompted to provide credentials such as Usernames and Passwords. I often find that it’s good practice to think of these in advance. Here is a list that I have already thought of, that will be used throughout this tutorial:

The passwords are for example purposes only. Be sure to generate your own using the following recommendations:

  • Longer than 16 characters
  • Contains numbers
  • Contains lower & uppercase characters
  • Contains special characters
  • Avoid using quotations (") and apostrophes (') in passwords for technical reasons
Service Username Password
Ubuntu root }@U$ufJ@5EyjJ$=>+V3!7;
Ubuntu craig 5CD;Zcjxe*HafWx\wAw\,w
Ubuntu magento H_?*VyVD_h{3#a(eNp>CCv
MySQL phpmyadmin 36K4sWW7V6Nk5R9yRMg@h6G
MySQL magento U274eeGzNCqKJ2LpvtS@329
Magento Public Key
Magento Private Key
Magento Admin enCbTf98Q}3xyhHss96$h+

Chapter 2: Build a basic server

As you can see, my screen is split up into 3 sections. We’ve got my web browser, my SSH Client of choice (which is Putty for Windows), and a breakdown of Chapters to help you quickly navigate through the video.

So, let’s start building our Web Server so that we can install Magento 2.4. Don’t forget that you can follow along with me at your own pace by referring to this article that I wrote containing all of the commands that you’re going to see me use.

2.1 Create a Ubuntu Server

First things first, we need a web server. I’ve chosen the Ubuntu 20.04 Operating System using the Basic $20/mo Package. This includes 4GB Memory, 2 CPUs and 80GB of Storage.

I do not recommend any server package under 4GB of Memory because Elasticsearch is quite resource heavy

After creating my server, we’ll move onto the next step. If you’re following along, pause here until you’re ready.

2.2 Create a new user

So, I’ve just logged into my server as the “root” user for the very first time.

It’s time to create a “superuser” that we can use instead of the “root” user to carry out our administrative tasks. This is a recommended security step when building new servers as it strengthens against brute force attacks. Plus, as a superuser you can’t accidentally run root tasks without first prefixing your commands with “sudo”.

Tip: Once you copy the commands from the article, you can paste them directly into Putty by right-clicking anywhere inside the window. The text will paste wherever the prompt is.

Create yourself a superuser by entering the following command (I’m calling mine “craig”) [05:34]

adduser craig

You’ll then need to set and confirm a password that we decided upon chose earlier in the video.

After confirming a password, you’ll then be asked a bunch of questions. However, you can just press Enter to skip, until you’re prompted to enter “Yes” or “No”. So, type “Y” and Enter to confirm.

Now give the user a “superuser” privilege by adding it to the “sudo” group [06:11]

usermod -aG sudo craig

Now it’s time to logout as the root user and reconnect with our new user. From this point forward, you’ll notice me prefix most of my commands with “sudo” – This tells the operating system that you want to exercise your supervisor privileges to run an administrative task.

I’ve now closed the original Putty window and reconnected to the server as “craig” - Which I’ll remain logged in as through the remainder of this tutorial. Feel free to pause here for a moment whilst you do the same.

2.3 Disable the root user (for security)

Now access the ssh config file to disable root user login [06:58]

sudo nano /etc/ssh/sshd_config

Enter your password if prompted to do so.

Use your Arrow or Page Up/Down keys to work your way down the file and find “PermitRootLogin yes”. You’ll want to replace the “yes” with a “no”. Now save your changes by press Ctrl+X to exit, Y to save and Enter to confirm.

Now reload the SSH Service for the changes to take effect [07:47]

sudo systemctl reload sshd

And you’ve successfully blocked the “root” user from logging in.

2.4 Enable a basic firewall

You must create a rule that allows SSH connections to your server. This is the connection we are currently using [08:12]

sudo ufw allow ssh

With the new rule created, turn on the firewall [08:22]

sudo ufw enable

You’ll get a warning to make sure we’ve allowed SSH connections. So just type “Y” and hit Enter

Fantastic. So, just to quickly recap… We’ve built a server and followed some very basic security practices. If this was your first time using SSH, I hope it wasn’t too intimidating for you.

Chapter 3: Convert to a web server for Magento 2.4

Now is the time to take our basic server and convert it into a web server that is capable of installing Magento 2.4. There are lots of commands coming up in this chapter, so pay very close attention to each step.

3.1 Updating repositories

You’ll first start by updating your servers repositories. This tells Ubuntu what is available to download when we ask it to install something. Kind of like refreshing the App Store on your phone.

We need to tell Ubuntu to update it’s records from all of the connected repositories. [09:15]

sudo apt update

3.2 Install Apache and configure it specifically for Magento 2.4

Now we’re ready to install and configure Apache. Apache is the software that will ultimately convert our basic server into a web server.

Install Apache

With the repositories updated, install Apache using: [09:41]

sudo apt install apache2 -y

Open an Apache config file to allow .htaccess files in the web directory: [10:24]

sudo nano /etc/apache2/sites-available/000-default.conf

Add the below to the file, then save and exit

<Directory "/var/www/html">
    AllowOverride All

Open an Apache config file to set the Global ServerName [11:02]

sudo nano /etc/apache2/apache2.conf

Add this line at the end of the file, then save and exit ( represents your server IP):


Check for any syntax errors we may have introduced [11:58]

sudo apache2ctl configtest

Enable Apache rewrite (this resolves most post-installation 404 errors) [12:28]

sudo a2enmod rewrite

Restart Apache for any changes to take effect [12:43]

sudo systemctl restart apache2

Enable Apache through the firewall that we enabled earlier [12:54]

sudo ufw allow 'Apache Full'

Test Apache

To test that Apache is working, simply visit the IP address of your server. You should see a test page similar to this one.

3.3 Install PHP and any extensions specifically for Magento 2.4

Now, we need to install PHP. PHP is a scripting language which allows web applications like Magento to supercharge normal HTML pages. It’s a bit more complicated than that, but needless to say it’s a requirement for Magento.

Let’s start by installing PHP and all of the PHP extensions required in order for Magento 2.4 to run [13:40]

sudo apt install php8.1 libapache2-mod-php8.1 php8.1-mysql php8.1-soap php8.1-bcmath php8.1-xml php8.1-mbstring php8.1-gd php8.1-common php8.1-cli php8.1-curl php8.1-intl php8.1-zip zip unzip -y

Tell the web server to prefer PHP files (move index.php to front of the list) [14:09]

sudo nano /etc/apache2/mods-enabled/dir.conf

You now need to replace 2 default variables in the PHP configuration. Do this by editing the php.ini file! [14:54]

sudo nano /etc/php/7.4/apache2/php.ini

Tip: Press Ctrl+W to load Search Box in nano text editor

Use your Arrow or Page Up/Down keys to work your way down the file and find “date.timezone =”. You’ll need to add your server’s time zone. Use the Supported List linked in the article for your setup. In my case, it would be Europe/London.

Then, find “memory_limit” and replace “128M” with an appropriate value. Because this is a 4GB Server, I’ll set this to “4G”.

Then, find “realpath_cache_size” and replace the default value to “10M”

Then, find “realpath_cache_size” and replace the default value to “7200”

Now save your changes by press Ctrl+X to exit, Y to save and Enter to confirm.

Restart apache for changes to take effect [16:14]

sudo systemctl restart apache2

3.4 Install MySQL and secure the installation

Now, it’s time to install and configure MySQL. MySQL is a database management system that allows the web server to store information that can be accessed by Magento.

Install MySQL

Install MySQL Server with [16:36]

sudo apt install mysql-server -y

Switch MySQL Password Plugin

In a recent update, I found that I went around in circles attempting to get the next few steps to work.

To resolve this issue, switch to the “native” MySQL password plugin. This can be done by entering the following command. Just make sure to replace the password with your own: [18:05]

sudo mysql -e "ALTER USER 'root'@'localhost' IDENTIFIED WITH mysql_native_password BY 'XHUWKxKyCX8LmEGsHKG@cER'"

And then

sudo mysql UNINSTALL COMPONENT 'file://component_validate_password';

MySQL Secure Installation Script

Run a MySQL security script that addresses some vulnerabilities [16:50]

sudo mysql_secure_installation

3.5 Install phpMyAdmin and secure the installation

What we’re doing now is installing phpMyAdmin. This is not required, but makes life easier when interacting with our MySQL Databases. It essentially allows us to log into a web page and make adjustments with your mouse and keyboard. As opposed to using the Command Line Interface.

Install phpMyAdmin

So, install phpMyAdmin plus a couple of require PHP plugins using: [18:46]

sudo apt install phpmyadmin php8.1-mbstring php8.1-gettext -y

Make sure that you select apache2 using your SPACE BAR before hitting ENTER to continue. Then restart Apache for any changes to take effect [19:38]

sudo systemctl restart apache2

Test phpMyAdmin

To test that phpMyAdmin works, simply enter your IP address into your browser followed by /phpmyadmin . For example, If you’ve successfully followed the steps then you’ll see this login page.

Chapter 4: Create a database for installing Magento 2.4

This Chapter is super-easy and quick thanks to phpMyAdmin - which we’ll use to create a Magento user and database.

Set up a user & database

  1. So visit HTTP://<your_server>/phpmyadmin
  2. Log in with your MySQL root credentials
  3. Once logged in, click User Accounts
  4. Then click Add user account
  5. Enter a username – I’ll call mine magento-master
  6. Change Host name to Local
  7. Enter the password we chose earlier
  8. Click the box below labelled “Create database with same name and grant all privileges.”, which will conveniently create a database for us at the same time as creating the user.
  9. Now hit Go at the bottom-right of the page

You’ve now successfully set up an isolated MySQL user that only has access to one specific database that it owns. A database that Magento will use to store all kinds of data such as settings, products details, customer details, sales and so on.

Chapter 5: Enable SMTP Capability

This next step is somewhat controversial as it is only required to send your 2FA email during the installation of Magento 2.4.0. Therefore, we’ll only be doing the bare-minimum to get it working.

Install Postfix (I left all options as default values)

Postfix is a mail transfer agent that handles email on a server. Go ahead and install this by running: [21:43]

sudo apt install mailutils -y

Open postfix config file

Now edit the postfix configuration file using: [22:17]

sudo nano /etc/postfix/

Replace the following

Then find the following line in the document:

inet_interfaces = all

And then replace “all” with “loopback-only”:

inet_interfaces = loopback-only

Now save your changes by press Ctrl+X to exit, Y to save and Enter to confirm.

Restart Postfix for changes to take affect

And for the changes to take affect, simply restart postfix with: [22:41]

sudo systemctl restart postfix

Important Notes on Postfix

  • Your 2FA email will go to your SPAM when you refresh the Magento backend login page
  • These steps are the bare minimum required to send out an email. There is much more to configure if you plan to use SMTP in a Production Environment

Chapter 6: Install Elasticsearch 7.17

Magento 2.4.0 now requires Elasticsearch as the search engine. Specifically, version 7.6. It’s a memory hunger tool, which is why I recommend a minimum of 4GB for your server now.

6.1 Install Java Development Kit

So, let’s start by installing the Java Development Kit - Which Elasticsearch needs to run. Do this by entering: [23:30]

sudo apt install openjdk-8-jdk -y

To verify your installation of JDK 1.8, enter: [23:47]

java -version

An example output would look like:

openjdk version "1.8.0_252"
OpenJDK Runtime Environment (build 1.8.0_252-8u252-b09-1~16.04-b09)
OpenJDK 64-Bit Server VM (build 25.252-b09, mixed mode)

6.2 Install Elasticsearch

So, we’re about to download 2 files from the Elasticsearch website. One is the installation file and the other is a duplicate file that will be used to compare the integrity of the file. Useful for both technical and security reasons.

Download the necessary files

Now download the 2 Elasticsearch 7.6.0 files I just mentioned using: [24:12]


and then: [24:23]


File integrity check

With the 2 files now downloaded to our home directory, it’s time to run the following command to ensure the downloaded files aren’t compromised using:

shasum -a 512 -c elasticsearch-7.17.0-amd64.deb.sha512

A successful message will look something like this: [24:38]

elasticsearch-7.17.0-amd64.deb: OK

Add the file to our package manager

The final setup is to add the downloaded file to our operating system package manager. This is simply achieved by running: [24:57]

sudo dpkg -i elasticsearch-7.17.0-amd64.deb

6.3 Setting Elasticsearch to autorun

Now that we’ve installed Elasticsearch, it’s time to tell our web server to autorun whenever you restart the server.

Reload systemd manager

Start by reloading the systemd manager configuration with: [25:18]

sudo /bin/systemctl daemon-reload

Add Elasticsearch to system startup

And then adding Elasticsearch to our list or bootup services with: [25:31]

sudo /bin/systemctl enable elasticsearch.service

Running Elasticsearch

With the autorun now set, we still need to manually start Elasticsearch. Do this by entering: [25:46]

sudo systemctl start elasticsearch

Note: In my experience it usually takes 1-2 minutes for the service to initialise, but be patient. Once it’s active, the command prompt will return to normal.

Testing Elasticsearch

Now, before we go any further, it’s a good time to test that everything we’ve done so far is working as expected. We can use the cURL tool to do this by entering the following command: [26:10]

curl -X GET 'http://localhost:9200'

Which should return values similar to what you see here.

  "name" : "My First Node",
  "cluster_name" : "elasticsearch",
  "version" : {
    "number" : "2.3.1",
    "build_hash" : "bd980929010aef404e7cb0843e61d0665269fc39",
    "build_timestamp" : "2016-04-04T12:25:05Z",
    "build_snapshot" : false,
    "lucene_version" : "5.5.0"
  "tagline" : "You Know, for Search"

If so, then that’s great. If not then retrace the steps we’ve gone over so far.

6.4 Securing Elasticsearch

Disclaimer: Next, I was going to talk about securing your installation of Elasticsearch. But from the research I did, it appeared that this was only necessary when installing Elasticsearch on a secondary server due to the use of Ports and External Connections. It appears that as we’re running this on a single-server, those configurations are redundant. However, I do urge you to do your own research in case I’m wrong.

6.5 Configuring Elasticsearch

By default, Elasticsearch boasts that it’s default settings are good to go straight “out-the-box”. However, this is subject to some optimisation tweaking (that I won’t be covering in this video) and some slight housekeeping - Which we’ll do now.

Let’s start by opening the Elasticsearch configuration file using: [27:06]

sudo nano /etc/elasticsearch/elasticsearch.yml

There are 3 thing we want to change in this file whilst we have it open:

Updating the Cluster Name

Using your arrow keys, find the line that contains . Once you’ve located it, first delete the preceding “#” and then replace “my-application” with something descriptive like “Magento Cluster”.

Updating the Node Name

Now do the same with , remembering to delete the preceding “ # ” and then replacing “node-1” with something descriptive like “Magento Node”.

Updating the Network Host

Finally do the same with , replacing the IP (“”) with “localhost”. Don’t forget to delete the preceding “#” like we did with the others.

Now save your changes and exit the nano editor by pressing Ctrl+X to exit, Y to save and Enter to confirm.

Reload your changes

In order for those 3 changes to take affect, reload the Elasticsearch service by running: [27:58]

sudo systemctl restart elasticsearch

Final Test of Elasticsearch

Now let’s run a final check to ensure the changes took affect and that we didn’t break anything. Remember, can do this by entering: [28:12]

curl -X GET 'http://localhost:9200'

And as you can see, the Name and Cluster name now reflect those changes.

  "name" : "Magento Node",
  "cluster_name" : "Magento Cluster",
  "cluster_uuid" : "7ymV1F7HTw2RuScEDaimvQ",
  "version" : {
    "number" : "7.6.0",
    "build_flavor" : "default",
    "build_type" : "deb",
    "build_hash" : "7f634e9f44834fbc12724506cc1da681b0c3b1e3",
    "build_date" : "2020-02-06T00:09:00.449973Z",
    "build_snapshot" : false,
    "lucene_version" : "8.4.0",
    "minimum_wire_compatibility_version" : "6.8.0",
    "minimum_index_compatibility_version" : "6.0.0-beta1"
  "tagline" : "You Know, for Search"

Chapter 7: Download Magento 2.4.0 with Composer

We’re now at the point where we can think about installing Magento 2.4. Just like the rest of this video so far, you will want to pay very close attention. It’s especially important that you run commands as the correct user as you’ll see issues further down the road that may not be obvious straight away.

7.1 Create a Magento user

So, let’s start by creating a Magento user. The reason for creating a new user is for added security. The main user that we created (e.g. “craig”) has the ability to run superuser commands if required, where the web user would never need such privileges. This user will also be who you log in as to upload and download your files via FTP.

Add the user (I’ve called my user “magento”) [29:08]

sudo adduser magento

Make the web server group the primary group for the new user [29:38]

sudo usermod -g www-data magento

7.2 Folder permissions

When we installed Apache, it automatically created a web directory to store web files. However, it will have created this under the default user known as www-data (or even root). So, we need to update the permissions for that directory. This will allow our new Magento user to operate correctly.

Update the folder ownership and group to coincide with our new web user [30:12]

sudo chown -R magento:www-data /var/www/html/

7.3 Install Composer

Now we’re ready to install Composer. Composer is an application that allows us to access and download packaged files from various repositories. Not only can we access and download Magento, but many 3rd party developers will recommend installing their extensions this way – As opposed to traditionally downloading a zip file and uploading it via FTP.

Install Composer by downloading the file direct from their website [30:54]

sudo curl -sS | php

Move composer file to the required directory [31:15]

sudo mv composer.phar /usr/local/bin/composer

7.4 Download Magento 2.4.5-p1 via Composer

Now, it’s time to use composer to download Magento 2.4.5-p1.

We first need to navigate to the web directory of our web server [31:42]

cd /var/www/html

Now, we need to switch from our superuser to the magento user that we created a few moments ago [31:54]

su magento

In order for Composer to work, it needs to be ran from within an empty directory – Otherwise it’ll generate an error. However, the web directory we’re now sitting in isn’t empty because when we installed apache, it created a test file called index.hml. This is the same file that we saw when we tested that Apache was working.

We can verify this by listing all file and folder inside the directory [32:29]

ls -la

So let’s delete that test file [32:54]

rm index.html

So, let’s now tell composer to install the latest copy of Magento – Which happens to be 2.4.0 at the time of creating this video. Make sure you don’t miss the Period at the end of the command. This insignificant looking dot tells composer to install it in the same directory from where we are running the command from. Missing this dot will cause Magento to install somewhere else [33:05]

composer create-project --repository-url= magento/project-community-edition .

Note: This command will load the latest version of Magento. At the time of writing this, the latest version is 2.4.5-p1.

During the setup, you will be asked for a Username and a Password. Just to be clear, Username = Public Key and Password = Private Key. We talked about obtaining these from your Magento Marketplace Account at the beginning of the video.

Once underway, the composer process can take anywhere from 5-10 minutes to complete.

7.5 Set pre-installation permissions

You should now see a screen similar to this, where Putty is waiting for my next command. This is when we want to take a moment to set the necessary file permissions in order for Magento to run correctly.

This next command looks like a long one, but it is in fact 4 commands strung together – This will save us putting each command in one at a time [35:10]

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 . && chmod u+x bin/magento

You’ve now ensured that Magento can now access all the necessary folders and files.

Chapter 8: Install Magento 2.4 via the Command Line

8.1 Run Install Script

This is the point, where we get to run the Magento Installation Script. Use this example as a template and change the values where appropriate. You’ll be able to copy and paste this as one piece (so do not try to copy and paste line by line into the SSH Terminal). [35:46]

Be sure to change the following variables for your setup. These are examples only.

bin/magento setup:install \
--base-url= \
--db-host=localhost \
--db-name=magento \
--db-user=magento \
--db-password="U274eeGzNCqKJ2LpvtS@329" \
--admin-firstname=bob \
--admin-lastname=smith \
[email protected] \
--admin-user=bob \
--admin-password=example@123 \
--language=en_US \
--currency=GBP \
--timezone=Europe/London \

Note: I have not specified the Elasticsearch variables, because they will default to our current local setup. I have also not specified a backend URL because it will generate one at random.

The installation script can take a couple of minutes to run. But once complete, you’ll see an automatically generated URL for the backend login page. Make a note of this and keep safe.

8.2 Update memory_limit

Before you get too excited and start playing with Magento, we will want to increase our PHP memory_limit. By default, Magento will be using 756MB of your web servers available memory. This will commonly make Magento slow and result in some errors.

Open our .htaccess file [40:22]

nano pub/.htaccess

Use your Arrow or Page Up/Down keys to work your way down the file and find a line containing memory_limit. Just go ahead and change the instance under PHP 7.

Replace 756MB with 2G

Now save your changes by press Ctrl+X to exit, Y to save and Enter to confirm.

8.3 Install cron tasks

Next we need to set up our cron tasks. These are scheduled tasks that are required to run in the background. They assist with tasks like Indexing, Backups, Updates and so forth.

Luckily, this can now be setup by running one command [41:10]

bin/magento cron:install

8.4 Testing Magento 2.4.0 is working

Congratulations – You’ve just built a Web Server and installed Magento 2.4.

So, let’s make sure we can load our Frontend and Backend successfully. It’s normal for everything to run slow at first. The most regular issue you might come across are the pages not loading correctly. Anything from images and styling not loading on the frontend and the backend resulting in a 404. In almost all cases, this is down to Apache rewrites not being enabled. Be sure to re-visit Chapter 3 if this is the case.

When you load the backend, simply follow the instructions that will have been emailed to you. You will find an email in your junk folder with a link. Following that link will allow you to setup 2FA so that you can login.

As we’ve come this far, I figured I’d throw in a bonus chapter to show you how to install Sample Data into Magento 2. This is useful if you’ve never used Magento before as it shows you what a standard setup looks like.

Chapter 9: Bonus – Install Sample Data

9.1 Switch to Developer Mode

It’s time to switch Magento to Developer Mode. Magento has 3 modes, all designed to use optimal settings based on your usage. In Developer Mode, you can access more tools in the backend of Magento than any other mode. I’ve covered these Modes in more depth video that you’ll find on the channel

Switch modes using [41:52]

bin/magento deploy:mode:set developer

Clear the cached generated folders [42:12]

rm -rf generated/metadata/* generated/code/*

Clear the remaining cache [42:25]

bin/magento cache:clean

9.2 Backup your installation

It would be a shame to have spent all of this time building your web server and installing Magento 2.4, just to fill it with Sample Data. So, I would recommend creating a backup of your installation or your web server before doing anything else. If you’re using Digital Ocean, then the easiest way to do this is by creating a “snapshot”. Then you can roll your server back to this very instance at any time.

9.3 Download Sample Data via Composer

Magento has a really useful command for installing all of the sample data from the Magento Repository via Composer. This step can normally take a couple of minutes to complete. At times, it may appear that nothing is happening, but just give it time.

The the Sample Data installation script [43:24]

bin/magento sampledata:deploy

It’s been a couple of minutes and now Putty is awaiting our next command. We need to tell Magento to install the latest changes we’ve just made [44:14]

bin/magento setup:upgrade

Now, when we refresh the Frontend and Backend, you can see what Magento now looks like with Sample Data.

For more useful Magento 2 Tutorial, be sure to checkout the following Playlists.