{"id":34460,"date":"2020-10-07T14:37:55","date_gmt":"2020-10-07T19:37:55","guid":{"rendered":"https:\/\/www.rosehosting.com\/blog\/?p=34460"},"modified":"2022-06-03T03:32:37","modified_gmt":"2022-06-03T08:32:37","slug":"how-to-install-magento-2-4-with-lemp-stack-on-ubuntu-20-04","status":"publish","type":"post","link":"https:\/\/www.rosehosting.com\/blog\/how-to-install-magento-2-4-with-lemp-stack-on-ubuntu-20-04\/","title":{"rendered":"How to Install Magento 2.4 with LEMP Stack on Ubuntu 20.04"},"content":{"rendered":"<div id=\"bsf_rt_marker\"><\/div>\n<div class=\"wp-block-image is-style-default\"><figure class=\"aligncenter size-full\"><img decoding=\"async\" width=\"742\" height=\"372\" src=\"https:\/\/www.rosehosting.com\/blog\/wp-content\/uploads\/2020\/10\/how-to-install-magento-2-4-on-ubuntu-20-04.jpg\" alt=\"installation magento 2.4 ecommerce ubuntu\" class=\"wp-image-34505\" srcset=\"https:\/\/www.rosehosting.com\/blog\/wp-content\/uploads\/2020\/10\/how-to-install-magento-2-4-on-ubuntu-20-04.jpg 742w, https:\/\/www.rosehosting.com\/blog\/wp-content\/uploads\/2020\/10\/how-to-install-magento-2-4-on-ubuntu-20-04-300x150.jpg 300w, https:\/\/www.rosehosting.com\/blog\/wp-content\/uploads\/2020\/10\/how-to-install-magento-2-4-on-ubuntu-20-04-150x75.jpg 150w\" sizes=\"(max-width: 742px) 100vw, 742px\" \/><\/figure><\/div>\n\n\n\n<p class=\"wp-block-paragraph\">In this guide, we will show you how to install Magento 2.4 with LEMP stack on an <a href=\"https:\/\/www.rosehosting.com\/ubuntu-hosting.html\">Ubuntu 20.04 VPS<\/a>.<\/p>\n\n\n\n<div class=\"wp-block-image is-style-default\"><figure class=\"alignright size-large\"><img decoding=\"async\" width=\"97\" height=\"115\" src=\"https:\/\/www.rosehosting.com\/blog\/wp-content\/uploads\/2020\/10\/installation-magento-2-ecommerce-platform-on-ubuntu-vps.jpg\" alt=\"magento nginx install ubuntu 20.04\" class=\"wp-image-34490\"\/><\/figure><\/div>\n\n\n\n<p class=\"wp-block-paragraph\">Magento is one of the most popular open-source eCommerce platforms available, thanks to its customization and flexibility. It is created using the Zend Framework and uses MySQL as its database management system. Magento provides online merchants with a very flexible shopping cart and it comes with a rich set of features, making it an excellent choice for businesses looking to have an online stop set up without hassle.<\/p>\n\n\n\n<p class=\"wp-block-paragraph\"><strong>Installing Magento 2.4 with a LEMP Stack on Ubuntu 20.04<\/strong>&nbsp;should take less than 10 minutes to complete. Let\u2019s get started with the tutorial.<\/p>\n\n\n\n<!--more-->\n\n\n\n<div id=\"ez-toc-container\" class=\"ez-toc-v2_0_84 counter-hierarchy ez-toc-counter ez-toc-transparent ez-toc-container-direction\">\n<p class=\"ez-toc-title\" style=\"cursor:inherit\">Table of Contents<\/p>\n<label for=\"ez-toc-cssicon-toggle-item-6a286d329f0e5\" class=\"ez-toc-cssicon-toggle-label\"><span class=\"ez-toc-cssicon\"><span class=\"eztoc-hide\" style=\"display:none;\">Toggle<\/span><span class=\"ez-toc-icon-toggle-span\"><svg style=\"fill: #999;color:#999\" xmlns=\"http:\/\/www.w3.org\/2000\/svg\" class=\"list-377408\" width=\"20px\" height=\"20px\" viewBox=\"0 0 24 24\" fill=\"none\"><path d=\"M6 6H4v2h2V6zm14 0H8v2h12V6zM4 11h2v2H4v-2zm16 0H8v2h12v-2zM4 16h2v2H4v-2zm16 0H8v2h12v-2z\" fill=\"currentColor\"><\/path><\/svg><svg style=\"fill: #999;color:#999\" class=\"arrow-unsorted-368013\" xmlns=\"http:\/\/www.w3.org\/2000\/svg\" width=\"10px\" height=\"10px\" viewBox=\"0 0 24 24\" version=\"1.2\" baseProfile=\"tiny\"><path d=\"M18.2 9.3l-6.2-6.3-6.2 6.3c-.2.2-.3.4-.3.7s.1.5.3.7c.2.2.4.3.7.3h11c.3 0 .5-.1.7-.3.2-.2.3-.5.3-.7s-.1-.5-.3-.7zM5.8 14.7l6.2 6.3 6.2-6.3c.2-.2.3-.5.3-.7s-.1-.5-.3-.7c-.2-.2-.4-.3-.7-.3h-11c-.3 0-.5.1-.7.3-.2.2-.3.5-.3.7s.1.5.3.7z\"\/><\/svg><\/span><\/span><\/label><input type=\"checkbox\"  id=\"ez-toc-cssicon-toggle-item-6a286d329f0e5\"  aria-label=\"Toggle\" \/><nav><ul class='ez-toc-list ez-toc-list-level-1 ' ><li class='ez-toc-page-1 ez-toc-heading-level-2'><a class=\"ez-toc-link ez-toc-heading-1\" href=\"https:\/\/www.rosehosting.com\/blog\/how-to-install-magento-2-4-with-lemp-stack-on-ubuntu-20-04\/#Prerequisites\" >Prerequisites<\/a><\/li><li class='ez-toc-page-1 ez-toc-heading-level-2'><a class=\"ez-toc-link ez-toc-heading-2\" href=\"https:\/\/www.rosehosting.com\/blog\/how-to-install-magento-2-4-with-lemp-stack-on-ubuntu-20-04\/#Getting-Started\" >Getting Started<\/a><\/li><li class='ez-toc-page-1 ez-toc-heading-level-2'><a class=\"ez-toc-link ez-toc-heading-3\" href=\"https:\/\/www.rosehosting.com\/blog\/how-to-install-magento-2-4-with-lemp-stack-on-ubuntu-20-04\/#Install-LEMP-and-Elasticsearch\" >Install LEMP and Elasticsearch<\/a><\/li><li class='ez-toc-page-1 ez-toc-heading-level-2'><a class=\"ez-toc-link ez-toc-heading-4\" href=\"https:\/\/www.rosehosting.com\/blog\/how-to-install-magento-2-4-with-lemp-stack-on-ubuntu-20-04\/#Create-a-Database-for-Magento-2\" >Create a Database for Magento 2<\/a><\/li><li class='ez-toc-page-1 ez-toc-heading-level-2'><a class=\"ez-toc-link ez-toc-heading-5\" href=\"https:\/\/www.rosehosting.com\/blog\/how-to-install-magento-2-4-with-lemp-stack-on-ubuntu-20-04\/#Install-Magento-2\" >Install Magento 2<\/a><\/li><li class='ez-toc-page-1 ez-toc-heading-level-2'><a class=\"ez-toc-link ez-toc-heading-6\" href=\"https:\/\/www.rosehosting.com\/blog\/how-to-install-magento-2-4-with-lemp-stack-on-ubuntu-20-04\/#Create-an-Nginx-Configuration-File\" >Create an Nginx Configuration File<\/a><\/li><li class='ez-toc-page-1 ez-toc-heading-level-2'><a class=\"ez-toc-link ez-toc-heading-7\" href=\"https:\/\/www.rosehosting.com\/blog\/how-to-install-magento-2-4-with-lemp-stack-on-ubuntu-20-04\/#Install-an-SSL-Certificate\" >Install an SSL Certificate<\/a><\/li><li class='ez-toc-page-1 ez-toc-heading-level-2'><a class=\"ez-toc-link ez-toc-heading-8\" href=\"https:\/\/www.rosehosting.com\/blog\/how-to-install-magento-2-4-with-lemp-stack-on-ubuntu-20-04\/#Install-Cron-Job\" >Install Cron Job<\/a><\/li><\/ul><\/nav><\/div>\n<h2 class=\"wp-block-heading\" id=\"h-prerequisites\"><span class=\"ez-toc-section\" id=\"Prerequisites\"><\/span>Prerequisites<span class=\"ez-toc-section-end\"><\/span><\/h2>\n\n\n\n<ul class=\"wp-block-list\"><li>An Ubuntu 20.04 VPS with root access enabled, or a <a href=\"https:\/\/www.rosehosting.com\/blog\/how-to-create-a-sudo-user-on-ubuntu\/\">user with sudo privileges<\/a><\/li><li>4GB of RAM or higher<\/li><li>Nginx<\/li><li>MariaDB 10.4<\/li><li>Elasticsearch 7.6.x because Magento 2.4 is tested with this version<\/li><li>PHP 7.4 with bcmath, ctype, curl, dom, gd, hash, iconv, intl, libxml, mbstring, openssl, pdo_mysql, simplexml, soap, xsl and zip extensions enabled. Also, for performance reasons it is a good idea to install and enable the opcache extension.<\/li><li>A valid domain name for accessing the Magento 2 website. Also, a valid SSL certificate is required for accessing the website using HTTPS.<\/li><\/ul>\n\n\n\n<p class=\"wp-block-paragraph\">If you don&#8217;t have a LEMP stack set up (Nginx, MariaDB, PHP), no problem &#8211; we&#8217;ll be covering how to install those in this tutorial as well.<\/p>\n\n\n\n<h2 class=\"wp-block-heading\" id=\"h-getting-started\"><span class=\"ez-toc-section\" id=\"Getting-Started\"><\/span><span id=\"Step-1-Log-in-and-Update-Packages\" class=\"ez-toc-section\"><\/span>Getting Started<span class=\"ez-toc-section-end\"><\/span><\/h2>\n\n\n\n<p class=\"wp-block-paragraph\">First, we\u2019re going to need to log into our server using SSH. You can do that by entering this command:<\/p>\n\n\n\n<pre class=\"wp-block-preformatted\">ssh root@<span style=\"color: #ff0000;\">IP_Address<\/span> -p <span style=\"color: #ff0000;\">Port_number<\/span><\/pre>\n\n\n\n<p class=\"wp-block-paragraph\">Replace \u201croot\u201d with a user that has sudo privileges if necessary. Additionally, replace \u201c<span style=\"color: #ff0000;\">IP_Address<\/span>\u201d and \u201c<span style=\"color: #ff0000;\">Port_Number<\/span>\u201d with your server\u2019s respective IP address and SSH port number.<\/p>\n\n\n\n<p class=\"wp-block-paragraph\">Once you are logged in, you should update all of your Ubuntu OS packages to their latest available versions.<\/p>\n\n\n\n<pre class=\"wp-block-preformatted\">apt-get update \napt-get upgrade<\/pre>\n\n\n\n<p class=\"wp-block-paragraph\">Once all of the OS packages are up-to-date, restart your server if required to apply any new configuration changes.<\/p>\n\n\n\n<h2 class=\"wp-block-heading\" id=\"h-install-lemp-and-elasticsearch\"><span class=\"ez-toc-section\" id=\"Install-LEMP-and-Elasticsearch\"><\/span><span id=\"Step-2-Install-Apache-and-PHP\" class=\"ez-toc-section\"><\/span>Install LEMP and Elasticsearch<span class=\"ez-toc-section-end\"><\/span><\/h2>\n\n\n\n<p class=\"wp-block-paragraph\">LEMP is an acronym that describes a Linux OS with Nginx, MySQL (or MariaDB), and PHP. It&#8217;s a general stack of applications and servers that can provide the foundation for many software packages. Let&#8217;s install LEMP on our Ubuntu 20.04 VPS.<\/p>\n\n\n\n<h3 class=\"wp-block-heading\" id=\"h-install-nginx\">Install Nginx<\/h3>\n\n\n\n<p class=\"wp-block-paragraph\">If there is an Apache web server installed on the server already, stop the Apache service and disable it from starting on server boot:<\/p>\n\n\n\n<pre class=\"wp-block-preformatted\">systemctl stop apache2\nsystemctl disable apache2<\/pre>\n\n\n\n<p class=\"wp-block-paragraph\">Install Nginx with the following command:<\/p>\n\n\n\n<pre class=\"wp-block-preformatted\">apt-get install nginx<\/pre>\n\n\n\n<p class=\"wp-block-paragraph\">That&#8217;s all we need to do with Nginx for now.<\/p>\n\n\n\n<h3 class=\"wp-block-heading\" id=\"h-install-mysql\">Install MySQL<\/h3>\n\n\n\n<p class=\"wp-block-paragraph\">Next, we will install the MySQL database server, which will be used for storing the data of our Magento website, such as the products, categories, customers, and orders.<br>For the purposes of this tutorial, we will install and use MariaDB. To install the MariaDB database server, enter the following commands:<\/p>\n\n\n\n<pre class=\"wp-block-preformatted\">apt-get install software-properties-common<\/pre>\n\n\n\n<p class=\"wp-block-paragraph\">We need to add a key in order to add our MariaDB repository.<\/p>\n\n\n\n<pre class=\"wp-block-preformatted\">apt-key adv --recv-keys --keyserver hkp:\/\/keyserver.ubuntu.com:80 0xF1656F24C74CD1D8<\/pre>\n\n\n\n<p class=\"wp-block-paragraph\">Now that we have the key, let&#8217;s install the repository:<\/p>\n\n\n\n<pre class=\"wp-block-preformatted\">add-apt-repository 'deb [arch=amd64,arm64,ppc64el] http:\/\/mirror.lstn.net\/mariadb\/repo\/10.4\/ubuntu bionic main'<\/pre>\n\n\n\n<p class=\"wp-block-paragraph\">Update your APT repositories so that the package lists get read.<\/p>\n\n\n\n<pre class=\"wp-block-preformatted\">apt update<\/pre>\n\n\n\n<p class=\"wp-block-paragraph\">Finally, we can install MariaDB.<\/p>\n\n\n\n<pre class=\"wp-block-preformatted\">apt install mariadb-server<\/pre>\n\n\n\n<p class=\"wp-block-paragraph\">Once MariaDB installed, enable the MariaDB service to start on server boot:<\/p>\n\n\n\n<pre class=\"wp-block-preformatted\">systemctl enable mariadb.service<\/pre>\n\n\n\n<p class=\"wp-block-paragraph\">Check the status of the MariaDB service:<\/p>\n\n\n\n<pre class=\"wp-block-preformatted\">systemctl status mariadb.service<\/pre>\n\n\n\n<p class=\"wp-block-paragraph\">It should be running. That&#8217;s all we need to do with MariaDB for now.<\/p>\n\n\n\n<h3 class=\"wp-block-heading\" id=\"h-install-elasticsearch\">Install Elasticsearch<\/h3>\n\n\n\n<p class=\"wp-block-paragraph\">Switch to a directory where you can download a file temporarily.<\/p>\n\n\n\n<pre class=\"wp-block-preformatted\">cd \/opt<\/pre>\n\n\n\n<p class=\"wp-block-paragraph\">Let&#8217;s download the Elasticsearch package file.<\/p>\n\n\n\n<pre class=\"wp-block-preformatted\">wget https:\/\/artifacts.elastic.co\/downloads\/elasticsearch\/elasticsearch-7.6.1-amd64.deb<\/pre>\n\n\n\n<p class=\"wp-block-paragraph\">Install it by running this next command:<\/p>\n\n\n\n<pre class=\"wp-block-preformatted\">dpkg -i elasticsearch-7.6.1-amd64.deb<\/pre>\n\n\n\n<p class=\"wp-block-paragraph\">Start the Elasticsearch service:<\/p>\n\n\n\n<pre class=\"wp-block-preformatted\">systemctl start elasticsearch<\/pre>\n\n\n\n<p class=\"wp-block-paragraph\">Check the status:<\/p>\n\n\n\n<pre class=\"wp-block-preformatted\">systemctl status elasticsearch<\/pre>\n\n\n\n<p class=\"wp-block-paragraph\">Check the version and other information about Elasticsearch:<\/p>\n\n\n\n<pre class=\"wp-block-preformatted\">curl -XGET 'http:\/\/localhost:9200'<\/pre>\n\n\n\n<p class=\"wp-block-paragraph\">If it all looks normal up to this point, we can now install PHP.<\/p>\n\n\n\n<h3 class=\"wp-block-heading\" id=\"h-install-php-7-4\">Install PHP 7.4<\/h3>\n\n\n\n<p class=\"wp-block-paragraph\">Add the PPA for&nbsp;PHP 7.4<em>:<\/em><\/p>\n\n\n\n<pre class=\"wp-block-preformatted\">add-apt-repository ppa:ondrej\/php<\/pre>\n\n\n\n<p class=\"wp-block-paragraph\">Next, update the OS package list and install PHP 7.4 with the following command:<\/p>\n\n\n\n<pre class=\"wp-block-preformatted\">apt-get update\napt-get install php7.4<\/pre>\n\n\n\n<p class=\"wp-block-paragraph\">Install all of the required PHP extensions with the following command:<\/p>\n\n\n\n<pre class=\"wp-block-preformatted\">apt install php7.4-fpm php7.4-common php7.4-mysql php7.4-gmp php7.4-curl php7.4-intl php7.4-mbstring php7.4-xmlrpc php7.4-gd php7.4-xml php7.4-cli php7.4-zip php7.4-bcmath<\/pre>\n\n\n\n<p class=\"wp-block-paragraph\">Once the PHP extensions have been installed on the server, install a few other OS packages that are required for the Magento 2 installation:<\/p>\n\n\n\n<pre class=\"wp-block-preformatted\">apt-get install git curl software-properties-common<\/pre>\n\n\n\n<p class=\"wp-block-paragraph\">Next, open the main PHP configuration file <code>\/etc\/php\/7.4\/fpm\/php.ini<\/code>:<\/p>\n\n\n\n<pre class=\"wp-block-preformatted\">nano \/etc\/php\/7.4\/fpm\/php.ini<\/pre>\n\n\n\n<p class=\"wp-block-paragraph\">Change the following settings:<\/p>\n\n\n\n<pre class=\"wp-block-preformatted\">file_uploads = On\nallow_url_fopen = On\nshort_open_tag = On\nmemory_limit = 256M\ncgi.fix_pathinfo = 0\nzlib.output_compression = On\nupload_max_filesize = 128M\nmax_execution_time = 600\nmax_input_time = 900\ndate.timezone = America\/Chicago<\/pre>\n\n\n\n<p class=\"wp-block-paragraph\">Save and close the PHP configuration file.<\/p>\n\n\n\n<h2 class=\"wp-block-heading\" id=\"h-create-a-database-for-magento-2\"><span class=\"ez-toc-section\" id=\"Create-a-Database-for-Magento-2\"><\/span>Create a Database for Magento 2<span class=\"ez-toc-section-end\"><\/span><\/h2>\n\n\n\n<p class=\"wp-block-paragraph\">Secure your MariaDB installation by using the <code>mysql_secure_installation<\/code> script. This script will remove anonymous users, disallow root login remotely, and remove the test database.<\/p>\n\n\n\n<pre class=\"wp-block-preformatted\">mysql_secure_installation<\/pre>\n\n\n\n<p class=\"wp-block-paragraph\">We recommend that you answer all of the questions as shown below:<\/p>\n\n\n\n<pre class=\"wp-block-preformatted\">Enter current password for root (enter for none): Press [Enter] since no password is set by default\nSet root password? [Y\/n]: N (You can set a password if you like)\nRemove anonymous users? [Y\/n]: Y\nDisallow root login remotely? [Y\/n]: Y\nRemove test database and access to it? [Y\/n]: Y\nReload privilege tables now? [Y\/n]: Y<\/pre>\n\n\n\n<p class=\"wp-block-paragraph\">Next, we will create our MySQL user and database for our Magento 2 website. Log in to your MySQL server with the following command and enter your MySQL root password when prompted:<\/p>\n\n\n\n<pre class=\"wp-block-preformatted\">mysql -u root -p<\/pre>\n\n\n\n<p class=\"wp-block-paragraph\">To create a new database for our Magento 2 instance, run the following commands:<\/p>\n\n\n\n<pre class=\"wp-block-preformatted\">mysql&gt; set global log_bin_trust_function_creators=1;\nmysql&gt; CREATE USER 'magento'@'localhost' IDENTIFIED WITH mysql_native_password BY '<span style=\"color: #ff0000;\">strongPassword<\/span>';\nmysql&gt; create database magentodb;\nmysql&gt; GRANT ALL PRIVILEGES ON magentodb.* TO 'magento'@'localhost';\nmysql&gt; flush privileges;\nmysql&gt; quit<\/pre>\n\n\n\n<p class=\"wp-block-paragraph\">Make sure that you give your <code>magento<\/code> MariaDB user a real and strong password.<\/p>\n\n\n\n<h2 class=\"wp-block-heading\" id=\"h-install-magento-2\"><span class=\"ez-toc-section\" id=\"Install-Magento-2\"><\/span>Install Magento 2<span class=\"ez-toc-section-end\"><\/span><\/h2>\n\n\n\n<p class=\"wp-block-paragraph\">We can now proceed with the Magento 2 installation. At the time of writing this article, the latest stable version of Magento is version 2.4.<\/p>\n\n\n\n<p class=\"wp-block-paragraph\">First, go to the GitHub repository and download the latest version of Magento with the following command:<\/p>\n\n\n\n<pre class=\"wp-block-preformatted\">mkdir -p \/var\/www\/magento2\/\ncd \/var\/www\/magento2\/\ngit clone https:\/\/github.com\/magento\/magento2.git \/var\/www\/magento2\/<\/pre>\n\n\n\n<p class=\"wp-block-paragraph\">Next, we will need to install Composer to install all necessary Magento components. You can install Composer by just running the following command:<\/p>\n\n\n\n<pre class=\"wp-block-preformatted\">curl -sS https:\/\/getcomposer.org\/installer | php -- --install-dir=\/usr\/bin --filename=composer<\/pre>\n\n\n\n<p class=\"wp-block-paragraph\">Run these next commands to configure composer.<\/p>\n\n\n\n<pre class=\"wp-block-preformatted\">cd \/var\/www\/magento2\ncomposer install\nbin\/magento setup:install --base-url=http:\/\/<span style=\"color: #ff0000;\">yourdomain.com<\/span>\/ --db-host=localhost --db-name=magentodb --db-user=magento --db-password=<span style=\"color: #ff0000;\">strongPassword<\/span> --admin-firstname=<span style=\"color: #ff0000;\">FirstName<\/span> --admin-lastname=<span style=\"color: #ff0000;\">LastName<\/span> --admin-email=<span style=\"color: #ff0000;\">your@emailaddress.com<\/span> --admin-user=<span style=\"color: #ff0000;\">magentoadmin<\/span> --admin-password=<span style=\"color: #ff0000;\">strong-password<\/span> --language=en_US --currency=USD --timezone=America\/Chicago --use-rewrites=1\n<\/pre>\n\n\n\n<p class=\"wp-block-paragraph\"><strong>Do not forget<\/strong> to replace the <strong>domain name<\/strong>, <strong>database password<\/strong>, <strong>admin username<\/strong>, <strong>password<\/strong> and <strong>admin email address<\/strong> accordingly.<br>Once the installation is complete, you should receive the following output:<\/p>\n\n\n\n<pre class=\"wp-block-preformatted\">[Progress: 699 \/ 701]<br>Post installation file permissions check...<br>For security, remove write permissions from these directories: '\/var\/www\/magento2\/app\/etc'<br>[Progress: 700 \/ 701]<br>Write installation date...<br>[Progress: 701 \/ 701]<br>[SUCCESS]: Magento installation complete.<br>[SUCCESS]: Magento Admin URI: \/admin_1k4pc0<br>Nothing to import.<\/pre>\n\n\n\n<p class=\"wp-block-paragraph\">Remember the &#8216;Magento Admin URI&#8217;. You will need this info later as that&#8217;s the URL that you&#8217;ll be using to log in to the Magento back-end.<\/p>\n\n\n\n<p class=\"wp-block-paragraph\">Change the ownership of the&nbsp;<code>magento2<\/code>&nbsp;directory to&nbsp;<code>www-data<\/code>&nbsp;with the following command:<\/p>\n\n\n\n<pre class=\"wp-block-preformatted\">chown -R www-data:www-data \/var\/www\/magento2\/<\/pre>\n\n\n\n<h2 class=\"wp-block-heading\" id=\"h-create-an-nginx-configuration-file\"><span class=\"ez-toc-section\" id=\"Create-an-Nginx-Configuration-File\"><\/span>Create an Nginx Configuration File<span class=\"ez-toc-section-end\"><\/span><\/h2>\n\n\n\n<p class=\"wp-block-paragraph\">Create an Nginx configuration file with your text editor:<\/p>\n\n\n\n<pre class=\"wp-block-preformatted\">nano \/etc\/nginx\/sites-available\/magento2<\/pre>\n\n\n\n<p class=\"wp-block-paragraph\">Then add the following as the file&#8217;s content:<\/p>\n\n\n\n<pre class=\"wp-block-preformatted\">upstream fastcgi_backend {\nserver unix:\/run\/php\/php7.4-fpm.sock;\n}\nserver {\nserver_name <span style=\"color: #ff0000;\">yourdomain.com<\/span>;\nlisten 80;\nset $MAGE_ROOT \/var\/www\/magento2;\nset $MAGE_MODE developer; # or production\naccess_log \/var\/log\/nginx\/magento2-access.log;\nerror_log \/var\/log\/nginx\/magento2-error.log;\ninclude \/var\/www\/magento2\/nginx.conf.sample;\n}<\/pre>\n\n\n\n<p class=\"wp-block-paragraph\">Make sure that you set <code>yourdomain.com<\/code> to your registered domain name.<\/p>\n\n\n\n<p class=\"wp-block-paragraph\">Remove the default Nginx configuration file, if is not being used:<\/p>\n\n\n\n<pre class=\"wp-block-preformatted\">rm -f \/etc\/nginx\/sites-enabled\/default<\/pre>\n\n\n\n<p class=\"wp-block-paragraph\">Enable the newly created Nginx configuration file, then test the Nginx configuration and make sure that there are no errors:<\/p>\n\n\n\n<pre class=\"wp-block-preformatted\">ln -s \/etc\/nginx\/sites-available\/magento2 \/etc\/nginx\/sites-enabled\/magento2<\/pre>\n\n\n\n<pre class=\"wp-block-preformatted\">nginx -t\nnginx: the configuration file \/etc\/nginx\/nginx.conf syntax is ok\nnginx: configuration file \/etc\/nginx\/nginx.conf test is successful<\/pre>\n\n\n\n<p class=\"wp-block-paragraph\">That&#8217;s it! Your web server is now successfully configured.<\/p>\n\n\n\n<h2 class=\"wp-block-heading\" id=\"h-install-an-ssl-certificate\"><span class=\"ez-toc-section\" id=\"Install-an-SSL-Certificate\"><\/span>Install an SSL Certificate<span class=\"ez-toc-section-end\"><\/span><\/h2>\n\n\n\n<p class=\"wp-block-paragraph\">We&#8217;re going to install a free SSL certificate from Let&#8217;s Encrypt. Install the required packages by running this command:<\/p>\n\n\n\n<pre class=\"wp-block-preformatted\">apt-get install certbot python3-certbot-nginx<\/pre>\n\n\n\n<p class=\"wp-block-paragraph\">Then install a new SSL certificate for your domain name, making sure that <code>yourdomain.com<\/code> is set to your registered domain name:<\/p>\n\n\n\n<pre class=\"wp-block-preformatted\">certbot --nginx -d <code>yourdomain.com<\/code> -d <code>www.yourdomain.com<\/code><\/pre>\n\n\n\n<p class=\"wp-block-paragraph\" id=\"block-e72490ef-983f-45c8-ba8f-964a60c6d8a2\">Please select &#8216;2&#8217; and choose to redirect HTTP traffic to HTTPS:<\/p>\n\n\n\n<pre class=\"wp-block-preformatted\">- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -\n1: No redirect - Make no further changes to the webserver configuration.\n2: Redirect - Make all requests redirect to secure HTTPS access. Choose this for\nnew sites, or if you're confident your site works on HTTPS. You can undo this\nchange by editing your web server's configuration.\n- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -\nSelect the appropriate number [1-2] then [enter] (press 'c' to cancel): 2<\/pre>\n\n\n\n<p class=\"wp-block-paragraph\">Use the following Magento 2 CLI commands to update the Magento <code>base-url<\/code>&nbsp;and the&nbsp;<code>base-url-secure<\/code> values:<\/p>\n\n\n\n<pre class=\"wp-block-preformatted\">cd \/var\/www\/magento2\/<\/pre>\n\n\n\n<pre class=\"wp-block-preformatted\">php bin\/magento setup:store-config:set --base-url=\"<code>https:\/\/yourdomain.com\/<\/code>\"<\/pre>\n\n\n\n<pre class=\"wp-block-preformatted\">php bin\/magento setup:store-config:set --base-url-secure=\"<code>https:\/\/yourdomain.com\/<\/code>\"<\/pre>\n\n\n\n<p class=\"wp-block-paragraph\">Edit the Nginx configuration file and enable HTTP\/2:<\/p>\n\n\n\n<pre class=\"wp-block-preformatted\">nano \/etc\/nginx\/sites-enabled\/magento2<\/pre>\n\n\n\n<p class=\"wp-block-paragraph\">Replace:<\/p>\n\n\n\n<pre class=\"wp-block-preformatted\">listen 443 ssl;<\/pre>\n\n\n\n<p class=\"wp-block-paragraph\">With:<\/p>\n\n\n\n<pre class=\"wp-block-preformatted\">listen 443 ssl http2;<\/pre>\n\n\n\n<p class=\"wp-block-paragraph\">Restart the Nginx service for the changes to take effect:<\/p>\n\n\n\n<pre class=\"wp-block-preformatted\">systemctl restart cron.service<\/pre>\n\n\n\n<h2 class=\"wp-block-heading\" id=\"h-install-cron-job\"><span class=\"ez-toc-section\" id=\"Install-Cron-Job\"><\/span>Install Cron Job<span class=\"ez-toc-section-end\"><\/span><\/h2>\n\n\n\n<p class=\"wp-block-paragraph\">Magento requires a cron job configuration for many important system functions. Let&#8217;s create the following cron job:<\/p>\n\n\n\n<pre class=\"wp-block-preformatted\">crontab -u www-data -e<\/pre>\n\n\n\n<p class=\"wp-block-paragraph\">Add this to the file:<\/p>\n\n\n\n<pre class=\"wp-block-preformatted\">* * * * * \/usr\/bin\/php \/var\/www\/magento2\/bin\/magento cron:run | grep -v \"Ran jobs by schedule\" &gt;&gt; \/var\/www\/magento2\/var\/log\/magento.cron.log<\/pre>\n\n\n\n<p class=\"wp-block-paragraph\">Save and close the file.<\/p>\n\n\n\n<p class=\"wp-block-paragraph\">Restart the cron service:<\/p>\n\n\n\n<pre class=\"wp-block-preformatted\">systemctl restart cron.service<\/pre>\n\n\n\n<p class=\"wp-block-paragraph\">That is everything! Magento 2 has been successfully installed on your server.<\/p>\n\n\n\n<div class=\"wp-block-image is-style-default\"><figure class=\"aligncenter size-full\"><img decoding=\"async\" width=\"904\" height=\"348\" src=\"https:\/\/www.rosehosting.com\/blog\/wp-content\/uploads\/2020\/05\/magento2-front-end.png\" alt=\"magento2 front-end\" class=\"wp-image-32597\" srcset=\"https:\/\/www.rosehosting.com\/blog\/wp-content\/uploads\/2020\/05\/magento2-front-end.png 904w, https:\/\/www.rosehosting.com\/blog\/wp-content\/uploads\/2020\/05\/magento2-front-end-300x115.png 300w, https:\/\/www.rosehosting.com\/blog\/wp-content\/uploads\/2020\/05\/magento2-front-end-150x58.png 150w, https:\/\/www.rosehosting.com\/blog\/wp-content\/uploads\/2020\/05\/magento2-front-end-768x296.png 768w\" sizes=\"(max-width: 904px) 100vw, 904px\" \/><\/figure><\/div>\n\n\n\n<p class=\"wp-block-paragraph\">You can access the Magento front-end at <code>http:\/\/yourdomain.com<\/code> :<br><br>Log in to the Magento 2 back-end at <code>http:\/\/<code>yourdomain.com<\/code>\/<span style=\"color: #ff0000;\">Magento Admin URI<\/span><\/code>, and configure Magento according to your needs. You can install extensions, add products, categories, and more.<\/p>\n\n\n\n<div class=\"wp-block-image is-style-default\"><figure class=\"aligncenter size-full\"><img decoding=\"async\" width=\"1329\" height=\"652\" src=\"https:\/\/www.rosehosting.com\/blog\/wp-content\/uploads\/2020\/05\/magento2-back-end.png\" alt=\"magento2 back-end\" class=\"wp-image-32598\" srcset=\"https:\/\/www.rosehosting.com\/blog\/wp-content\/uploads\/2020\/05\/magento2-back-end.png 1329w, https:\/\/www.rosehosting.com\/blog\/wp-content\/uploads\/2020\/05\/magento2-back-end-300x147.png 300w, https:\/\/www.rosehosting.com\/blog\/wp-content\/uploads\/2020\/05\/magento2-back-end-1024x502.png 1024w, https:\/\/www.rosehosting.com\/blog\/wp-content\/uploads\/2020\/05\/magento2-back-end-150x74.png 150w, https:\/\/www.rosehosting.com\/blog\/wp-content\/uploads\/2020\/05\/magento2-back-end-768x377.png 768w, https:\/\/www.rosehosting.com\/blog\/wp-content\/uploads\/2020\/05\/magento2-back-end-1080x530.png 1080w\" sizes=\"(max-width: 1329px) 100vw, 1329px\" \/><\/figure><\/div>\n\n\n\n<hr class=\"wp-block-separator is-style-wide\"\/>\n\n\n\n<div class=\"wp-block-image is-style-default\"><figure class=\"alignleft size-large\"><img decoding=\"async\" width=\"97\" height=\"115\" src=\"https:\/\/www.rosehosting.com\/blog\/wp-content\/uploads\/2020\/10\/magento-managed-support-for-ubuntu-20-04-vps.jpg\" alt=\"managed magento support\" class=\"wp-image-34492\"\/><\/figure><\/div>\n\n\n\n<p class=\"wp-block-paragraph\">It&#8217;s becoming more and more important to have online presence in today&#8217;s digital world. You don&#8217;t need to be an expert in Linux system administration when you use our <a href=\"https:\/\/www.rosehosting.com\/magento-hosting.html\">Managed Magento hosting<\/a> &#8211; we&#8217;ll set everything up for you and maintain it, all included with our VPS. We can even optimize your server as well as perform any requests that you might have. You&#8217;ll still have full control over your server, but you&#8217;ll never need to go through any hassle ever again.<\/p>\n\n\n\n<p class=\"wp-block-paragraph\">We hope that this tutorial helped you install Magento 2 on your Ubuntu 20.04 VPS. If it did, please consider sharing this post on social media with our share shortcuts, or leave a comment below with any questions or suggestions that you might have. Thank you.<\/p>\n","protected":false},"excerpt":{"rendered":"<p>In this guide, we will show you how to install Magento 2.4 with LEMP stack on an Ubuntu 20.04 VPS. &#8230; <\/p>\n<p class=\"read-more-container\"><a title=\"How to Install Magento 2.4 with LEMP Stack on Ubuntu 20.04\" class=\"read-more button\" href=\"https:\/\/www.rosehosting.com\/blog\/how-to-install-magento-2-4-with-lemp-stack-on-ubuntu-20-04\/#more-34460\" aria-label=\"Read more about How to Install Magento 2.4 with LEMP Stack on Ubuntu 20.04\">Read More<\/a><\/p>\n","protected":false},"author":4,"featured_media":34505,"comment_status":"open","ping_status":"closed","sticky":false,"template":"","format":"standard","meta":{"footnotes":""},"categories":[1711,13,1698],"tags":[375,216,983,1839],"class_list":["post-34460","post","type-post","status-publish","format-standard","has-post-thumbnail","hentry","category-e-commerce","category-tutorials","category-ubuntu","tag-ecommerce","tag-magento","tag-magento-2","tag-ubuntu-20-04","generate-columns","tablet-grid-50","mobile-grid-100","grid-parent","grid-33"],"yoast_head":"<!-- This site is optimized with the Yoast SEO Premium plugin v27.7 (Yoast SEO v27.7) - https:\/\/yoast.com\/product\/yoast-seo-premium-wordpress\/ -->\n<title>How to Install Magento 2.4 with LEMP Stack on Ubuntu 20.04 | RoseHosting<\/title>\n<meta name=\"description\" content=\"We&#039;ll show you how to install the Magento 2.4 eCommerce platform along with the LEMP stack on an Ubuntu 20.04 VPS.\" \/>\n<meta name=\"robots\" content=\"index, follow, max-snippet:-1, max-image-preview:large, max-video-preview:-1\" \/>\n<link rel=\"canonical\" href=\"https:\/\/www.rosehosting.com\/blog\/how-to-install-magento-2-4-with-lemp-stack-on-ubuntu-20-04\/\" \/>\n<meta property=\"og:locale\" content=\"en_US\" \/>\n<meta property=\"og:type\" content=\"article\" \/>\n<meta property=\"og:title\" content=\"How to Install Magento 2.4 with LEMP Stack on Ubuntu 20.04\" \/>\n<meta property=\"og:description\" content=\"How to Install Magento 2.4 with LEMP Stack on Ubuntu 20.04 | RoseHosting\" \/>\n<meta property=\"og:url\" content=\"https:\/\/www.rosehosting.com\/blog\/how-to-install-magento-2-4-with-lemp-stack-on-ubuntu-20-04\/\" \/>\n<meta property=\"og:site_name\" content=\"RoseHosting\" \/>\n<meta property=\"article:publisher\" content=\"https:\/\/www.facebook.com\/RoseHosting\" \/>\n<meta property=\"article:author\" content=\"https:\/\/www.facebook.com\/rosehosting.helpdesk\" \/>\n<meta property=\"article:published_time\" content=\"2020-10-07T19:37:55+00:00\" \/>\n<meta property=\"article:modified_time\" content=\"2022-06-03T08:32:37+00:00\" \/>\n<meta property=\"og:image\" content=\"https:\/\/www.rosehosting.com\/blog\/wp-content\/uploads\/2020\/10\/how-to-install-magento-2-4-on-ubuntu-20-04.jpg\" \/>\n\t<meta property=\"og:image:width\" content=\"742\" \/>\n\t<meta property=\"og:image:height\" content=\"372\" \/>\n\t<meta property=\"og:image:type\" content=\"image\/jpeg\" \/>\n<meta name=\"author\" content=\"Jeff Wilson\" \/>\n<meta name=\"twitter:card\" content=\"summary_large_image\" \/>\n<meta name=\"twitter:creator\" content=\"@rosehosting\" \/>\n<meta name=\"twitter:site\" content=\"@rosehosting\" \/>\n<meta name=\"twitter:label1\" content=\"Written by\" \/>\n\t<meta name=\"twitter:data1\" content=\"Jeff Wilson\" \/>\n\t<meta name=\"twitter:label2\" content=\"Est. reading time\" \/>\n\t<meta name=\"twitter:data2\" content=\"10 minutes\" \/>\n<script type=\"application\/ld+json\" class=\"yoast-schema-graph\">{\"@context\":\"https:\\\/\\\/schema.org\",\"@graph\":[{\"@type\":\"Article\",\"@id\":\"https:\\\/\\\/www.rosehosting.com\\\/blog\\\/how-to-install-magento-2-4-with-lemp-stack-on-ubuntu-20-04\\\/#article\",\"isPartOf\":{\"@id\":\"https:\\\/\\\/www.rosehosting.com\\\/blog\\\/how-to-install-magento-2-4-with-lemp-stack-on-ubuntu-20-04\\\/\"},\"author\":{\"name\":\"Jeff Wilson\",\"@id\":\"https:\\\/\\\/www.rosehosting.com\\\/blog\\\/#\\\/schema\\\/person\\\/7ce77a842fa6a9a7f8efa186f2353713\"},\"headline\":\"How to Install Magento 2.4 with LEMP Stack on Ubuntu 20.04\",\"datePublished\":\"2020-10-07T19:37:55+00:00\",\"dateModified\":\"2022-06-03T08:32:37+00:00\",\"mainEntityOfPage\":{\"@id\":\"https:\\\/\\\/www.rosehosting.com\\\/blog\\\/how-to-install-magento-2-4-with-lemp-stack-on-ubuntu-20-04\\\/\"},\"wordCount\":1287,\"commentCount\":6,\"publisher\":{\"@id\":\"https:\\\/\\\/www.rosehosting.com\\\/blog\\\/#organization\"},\"image\":{\"@id\":\"https:\\\/\\\/www.rosehosting.com\\\/blog\\\/how-to-install-magento-2-4-with-lemp-stack-on-ubuntu-20-04\\\/#primaryimage\"},\"thumbnailUrl\":\"https:\\\/\\\/www.rosehosting.com\\\/blog\\\/wp-content\\\/uploads\\\/2020\\\/10\\\/how-to-install-magento-2-4-on-ubuntu-20-04.jpg\",\"keywords\":[\"eCommerce\",\"magento\",\"magento 2\",\"Ubuntu 20.04\"],\"articleSection\":[\"E-Commerce\",\"Tutorials\",\"Ubuntu\"],\"inLanguage\":\"en-US\",\"potentialAction\":[{\"@type\":\"CommentAction\",\"name\":\"Comment\",\"target\":[\"https:\\\/\\\/www.rosehosting.com\\\/blog\\\/how-to-install-magento-2-4-with-lemp-stack-on-ubuntu-20-04\\\/#respond\"]}]},{\"@type\":\"WebPage\",\"@id\":\"https:\\\/\\\/www.rosehosting.com\\\/blog\\\/how-to-install-magento-2-4-with-lemp-stack-on-ubuntu-20-04\\\/\",\"url\":\"https:\\\/\\\/www.rosehosting.com\\\/blog\\\/how-to-install-magento-2-4-with-lemp-stack-on-ubuntu-20-04\\\/\",\"name\":\"How to Install Magento 2.4 with LEMP Stack on Ubuntu 20.04 | RoseHosting\",\"isPartOf\":{\"@id\":\"https:\\\/\\\/www.rosehosting.com\\\/blog\\\/#website\"},\"primaryImageOfPage\":{\"@id\":\"https:\\\/\\\/www.rosehosting.com\\\/blog\\\/how-to-install-magento-2-4-with-lemp-stack-on-ubuntu-20-04\\\/#primaryimage\"},\"image\":{\"@id\":\"https:\\\/\\\/www.rosehosting.com\\\/blog\\\/how-to-install-magento-2-4-with-lemp-stack-on-ubuntu-20-04\\\/#primaryimage\"},\"thumbnailUrl\":\"https:\\\/\\\/www.rosehosting.com\\\/blog\\\/wp-content\\\/uploads\\\/2020\\\/10\\\/how-to-install-magento-2-4-on-ubuntu-20-04.jpg\",\"datePublished\":\"2020-10-07T19:37:55+00:00\",\"dateModified\":\"2022-06-03T08:32:37+00:00\",\"description\":\"We'll show you how to install the Magento 2.4 eCommerce platform along with the LEMP stack on an Ubuntu 20.04 VPS.\",\"breadcrumb\":{\"@id\":\"https:\\\/\\\/www.rosehosting.com\\\/blog\\\/how-to-install-magento-2-4-with-lemp-stack-on-ubuntu-20-04\\\/#breadcrumb\"},\"inLanguage\":\"en-US\",\"potentialAction\":[{\"@type\":\"ReadAction\",\"target\":[\"https:\\\/\\\/www.rosehosting.com\\\/blog\\\/how-to-install-magento-2-4-with-lemp-stack-on-ubuntu-20-04\\\/\"]}]},{\"@type\":\"ImageObject\",\"inLanguage\":\"en-US\",\"@id\":\"https:\\\/\\\/www.rosehosting.com\\\/blog\\\/how-to-install-magento-2-4-with-lemp-stack-on-ubuntu-20-04\\\/#primaryimage\",\"url\":\"https:\\\/\\\/www.rosehosting.com\\\/blog\\\/wp-content\\\/uploads\\\/2020\\\/10\\\/how-to-install-magento-2-4-on-ubuntu-20-04.jpg\",\"contentUrl\":\"https:\\\/\\\/www.rosehosting.com\\\/blog\\\/wp-content\\\/uploads\\\/2020\\\/10\\\/how-to-install-magento-2-4-on-ubuntu-20-04.jpg\",\"width\":742,\"height\":372,\"caption\":\"installation magento 2.4 ecommerce ubuntu\"},{\"@type\":\"BreadcrumbList\",\"@id\":\"https:\\\/\\\/www.rosehosting.com\\\/blog\\\/how-to-install-magento-2-4-with-lemp-stack-on-ubuntu-20-04\\\/#breadcrumb\",\"itemListElement\":[{\"@type\":\"ListItem\",\"position\":1,\"name\":\"Home\",\"item\":\"https:\\\/\\\/www.rosehosting.com\\\/blog\\\/\"},{\"@type\":\"ListItem\",\"position\":2,\"name\":\"How to Install Magento 2.4 with LEMP Stack on Ubuntu 20.04\"}]},{\"@type\":\"WebSite\",\"@id\":\"https:\\\/\\\/www.rosehosting.com\\\/blog\\\/#website\",\"url\":\"https:\\\/\\\/www.rosehosting.com\\\/blog\\\/\",\"name\":\"RoseHosting.com\",\"description\":\"Premium Linux Tutorials Since 2001\",\"publisher\":{\"@id\":\"https:\\\/\\\/www.rosehosting.com\\\/blog\\\/#organization\"},\"potentialAction\":[{\"@type\":\"SearchAction\",\"target\":{\"@type\":\"EntryPoint\",\"urlTemplate\":\"https:\\\/\\\/www.rosehosting.com\\\/blog\\\/?s={search_term_string}\"},\"query-input\":{\"@type\":\"PropertyValueSpecification\",\"valueRequired\":true,\"valueName\":\"search_term_string\"}}],\"inLanguage\":\"en-US\"},{\"@type\":\"Organization\",\"@id\":\"https:\\\/\\\/www.rosehosting.com\\\/blog\\\/#organization\",\"name\":\"RoseHosting\",\"url\":\"https:\\\/\\\/www.rosehosting.com\\\/blog\\\/\",\"logo\":{\"@type\":\"ImageObject\",\"inLanguage\":\"en-US\",\"@id\":\"https:\\\/\\\/www.rosehosting.com\\\/blog\\\/#\\\/schema\\\/logo\\\/image\\\/\",\"url\":\"https:\\\/\\\/www.rosehosting.com\\\/blog\\\/wp-content\\\/uploads\\\/2022\\\/03\\\/android-chrome-192x192-1.png\",\"contentUrl\":\"https:\\\/\\\/www.rosehosting.com\\\/blog\\\/wp-content\\\/uploads\\\/2022\\\/03\\\/android-chrome-192x192-1.png\",\"width\":192,\"height\":192,\"caption\":\"RoseHosting\"},\"image\":{\"@id\":\"https:\\\/\\\/www.rosehosting.com\\\/blog\\\/#\\\/schema\\\/logo\\\/image\\\/\"},\"sameAs\":[\"https:\\\/\\\/www.facebook.com\\\/RoseHosting\",\"https:\\\/\\\/x.com\\\/rosehosting\",\"https:\\\/\\\/www.linkedin.com\\\/in\\\/rosehosting\\\/\"],\"description\":\"RoseHosting is a leading Linux hosting provider, serving thousands of clients world-wide since 2001.\",\"email\":\"info@rosehosting.com\",\"telephone\":\"(314) 275-0414\",\"legalName\":\"Rose Web Services LLC\",\"foundingDate\":\"2001-04-02\",\"numberOfEmployees\":{\"@type\":\"QuantitativeValue\",\"minValue\":\"11\",\"maxValue\":\"50\"}},{\"@type\":\"Person\",\"@id\":\"https:\\\/\\\/www.rosehosting.com\\\/blog\\\/#\\\/schema\\\/person\\\/7ce77a842fa6a9a7f8efa186f2353713\",\"name\":\"Jeff Wilson\",\"image\":{\"@type\":\"ImageObject\",\"inLanguage\":\"en-US\",\"@id\":\"https:\\\/\\\/secure.gravatar.com\\\/avatar\\\/0985fed6af04cc60703d2ecf27c65dfa373e0ca00eb21c0b03477e099ea3f99f?s=96&r=g\",\"url\":\"https:\\\/\\\/secure.gravatar.com\\\/avatar\\\/0985fed6af04cc60703d2ecf27c65dfa373e0ca00eb21c0b03477e099ea3f99f?s=96&r=g\",\"contentUrl\":\"https:\\\/\\\/secure.gravatar.com\\\/avatar\\\/0985fed6af04cc60703d2ecf27c65dfa373e0ca00eb21c0b03477e099ea3f99f?s=96&r=g\",\"caption\":\"Jeff Wilson\"},\"description\":\"An experienced Linux veteran with many years of experience. Helping other Linux admins with frequent Linux and business-related blog posts on the RoseHosting blog. Techie by choice. Loving nature and travel. Happily married and father of two lovely children.\",\"sameAs\":[\"https:\\\/\\\/www.rosehosting.com\",\"https:\\\/\\\/www.facebook.com\\\/rosehosting.helpdesk\"],\"url\":\"https:\\\/\\\/www.rosehosting.com\\\/blog\\\/author\\\/jwilson\\\/\"}]}<\/script>\n<!-- \/ Yoast SEO Premium plugin. -->","yoast_head_json":{"title":"How to Install Magento 2.4 with LEMP Stack on Ubuntu 20.04 | RoseHosting","description":"We'll show you how to install the Magento 2.4 eCommerce platform along with the LEMP stack on an Ubuntu 20.04 VPS.","robots":{"index":"index","follow":"follow","max-snippet":"max-snippet:-1","max-image-preview":"max-image-preview:large","max-video-preview":"max-video-preview:-1"},"canonical":"https:\/\/www.rosehosting.com\/blog\/how-to-install-magento-2-4-with-lemp-stack-on-ubuntu-20-04\/","og_locale":"en_US","og_type":"article","og_title":"How to Install Magento 2.4 with LEMP Stack on Ubuntu 20.04","og_description":"How to Install Magento 2.4 with LEMP Stack on Ubuntu 20.04 | RoseHosting","og_url":"https:\/\/www.rosehosting.com\/blog\/how-to-install-magento-2-4-with-lemp-stack-on-ubuntu-20-04\/","og_site_name":"RoseHosting","article_publisher":"https:\/\/www.facebook.com\/RoseHosting","article_author":"https:\/\/www.facebook.com\/rosehosting.helpdesk","article_published_time":"2020-10-07T19:37:55+00:00","article_modified_time":"2022-06-03T08:32:37+00:00","og_image":[{"width":742,"height":372,"url":"https:\/\/www.rosehosting.com\/blog\/wp-content\/uploads\/2020\/10\/how-to-install-magento-2-4-on-ubuntu-20-04.jpg","type":"image\/jpeg"}],"author":"Jeff Wilson","twitter_card":"summary_large_image","twitter_creator":"@rosehosting","twitter_site":"@rosehosting","twitter_misc":{"Written by":"Jeff Wilson","Est. reading time":"10 minutes"},"schema":{"@context":"https:\/\/schema.org","@graph":[{"@type":"Article","@id":"https:\/\/www.rosehosting.com\/blog\/how-to-install-magento-2-4-with-lemp-stack-on-ubuntu-20-04\/#article","isPartOf":{"@id":"https:\/\/www.rosehosting.com\/blog\/how-to-install-magento-2-4-with-lemp-stack-on-ubuntu-20-04\/"},"author":{"name":"Jeff Wilson","@id":"https:\/\/www.rosehosting.com\/blog\/#\/schema\/person\/7ce77a842fa6a9a7f8efa186f2353713"},"headline":"How to Install Magento 2.4 with LEMP Stack on Ubuntu 20.04","datePublished":"2020-10-07T19:37:55+00:00","dateModified":"2022-06-03T08:32:37+00:00","mainEntityOfPage":{"@id":"https:\/\/www.rosehosting.com\/blog\/how-to-install-magento-2-4-with-lemp-stack-on-ubuntu-20-04\/"},"wordCount":1287,"commentCount":6,"publisher":{"@id":"https:\/\/www.rosehosting.com\/blog\/#organization"},"image":{"@id":"https:\/\/www.rosehosting.com\/blog\/how-to-install-magento-2-4-with-lemp-stack-on-ubuntu-20-04\/#primaryimage"},"thumbnailUrl":"https:\/\/www.rosehosting.com\/blog\/wp-content\/uploads\/2020\/10\/how-to-install-magento-2-4-on-ubuntu-20-04.jpg","keywords":["eCommerce","magento","magento 2","Ubuntu 20.04"],"articleSection":["E-Commerce","Tutorials","Ubuntu"],"inLanguage":"en-US","potentialAction":[{"@type":"CommentAction","name":"Comment","target":["https:\/\/www.rosehosting.com\/blog\/how-to-install-magento-2-4-with-lemp-stack-on-ubuntu-20-04\/#respond"]}]},{"@type":"WebPage","@id":"https:\/\/www.rosehosting.com\/blog\/how-to-install-magento-2-4-with-lemp-stack-on-ubuntu-20-04\/","url":"https:\/\/www.rosehosting.com\/blog\/how-to-install-magento-2-4-with-lemp-stack-on-ubuntu-20-04\/","name":"How to Install Magento 2.4 with LEMP Stack on Ubuntu 20.04 | RoseHosting","isPartOf":{"@id":"https:\/\/www.rosehosting.com\/blog\/#website"},"primaryImageOfPage":{"@id":"https:\/\/www.rosehosting.com\/blog\/how-to-install-magento-2-4-with-lemp-stack-on-ubuntu-20-04\/#primaryimage"},"image":{"@id":"https:\/\/www.rosehosting.com\/blog\/how-to-install-magento-2-4-with-lemp-stack-on-ubuntu-20-04\/#primaryimage"},"thumbnailUrl":"https:\/\/www.rosehosting.com\/blog\/wp-content\/uploads\/2020\/10\/how-to-install-magento-2-4-on-ubuntu-20-04.jpg","datePublished":"2020-10-07T19:37:55+00:00","dateModified":"2022-06-03T08:32:37+00:00","description":"We'll show you how to install the Magento 2.4 eCommerce platform along with the LEMP stack on an Ubuntu 20.04 VPS.","breadcrumb":{"@id":"https:\/\/www.rosehosting.com\/blog\/how-to-install-magento-2-4-with-lemp-stack-on-ubuntu-20-04\/#breadcrumb"},"inLanguage":"en-US","potentialAction":[{"@type":"ReadAction","target":["https:\/\/www.rosehosting.com\/blog\/how-to-install-magento-2-4-with-lemp-stack-on-ubuntu-20-04\/"]}]},{"@type":"ImageObject","inLanguage":"en-US","@id":"https:\/\/www.rosehosting.com\/blog\/how-to-install-magento-2-4-with-lemp-stack-on-ubuntu-20-04\/#primaryimage","url":"https:\/\/www.rosehosting.com\/blog\/wp-content\/uploads\/2020\/10\/how-to-install-magento-2-4-on-ubuntu-20-04.jpg","contentUrl":"https:\/\/www.rosehosting.com\/blog\/wp-content\/uploads\/2020\/10\/how-to-install-magento-2-4-on-ubuntu-20-04.jpg","width":742,"height":372,"caption":"installation magento 2.4 ecommerce ubuntu"},{"@type":"BreadcrumbList","@id":"https:\/\/www.rosehosting.com\/blog\/how-to-install-magento-2-4-with-lemp-stack-on-ubuntu-20-04\/#breadcrumb","itemListElement":[{"@type":"ListItem","position":1,"name":"Home","item":"https:\/\/www.rosehosting.com\/blog\/"},{"@type":"ListItem","position":2,"name":"How to Install Magento 2.4 with LEMP Stack on Ubuntu 20.04"}]},{"@type":"WebSite","@id":"https:\/\/www.rosehosting.com\/blog\/#website","url":"https:\/\/www.rosehosting.com\/blog\/","name":"RoseHosting.com","description":"Premium Linux Tutorials Since 2001","publisher":{"@id":"https:\/\/www.rosehosting.com\/blog\/#organization"},"potentialAction":[{"@type":"SearchAction","target":{"@type":"EntryPoint","urlTemplate":"https:\/\/www.rosehosting.com\/blog\/?s={search_term_string}"},"query-input":{"@type":"PropertyValueSpecification","valueRequired":true,"valueName":"search_term_string"}}],"inLanguage":"en-US"},{"@type":"Organization","@id":"https:\/\/www.rosehosting.com\/blog\/#organization","name":"RoseHosting","url":"https:\/\/www.rosehosting.com\/blog\/","logo":{"@type":"ImageObject","inLanguage":"en-US","@id":"https:\/\/www.rosehosting.com\/blog\/#\/schema\/logo\/image\/","url":"https:\/\/www.rosehosting.com\/blog\/wp-content\/uploads\/2022\/03\/android-chrome-192x192-1.png","contentUrl":"https:\/\/www.rosehosting.com\/blog\/wp-content\/uploads\/2022\/03\/android-chrome-192x192-1.png","width":192,"height":192,"caption":"RoseHosting"},"image":{"@id":"https:\/\/www.rosehosting.com\/blog\/#\/schema\/logo\/image\/"},"sameAs":["https:\/\/www.facebook.com\/RoseHosting","https:\/\/x.com\/rosehosting","https:\/\/www.linkedin.com\/in\/rosehosting\/"],"description":"RoseHosting is a leading Linux hosting provider, serving thousands of clients world-wide since 2001.","email":"info@rosehosting.com","telephone":"(314) 275-0414","legalName":"Rose Web Services LLC","foundingDate":"2001-04-02","numberOfEmployees":{"@type":"QuantitativeValue","minValue":"11","maxValue":"50"}},{"@type":"Person","@id":"https:\/\/www.rosehosting.com\/blog\/#\/schema\/person\/7ce77a842fa6a9a7f8efa186f2353713","name":"Jeff Wilson","image":{"@type":"ImageObject","inLanguage":"en-US","@id":"https:\/\/secure.gravatar.com\/avatar\/0985fed6af04cc60703d2ecf27c65dfa373e0ca00eb21c0b03477e099ea3f99f?s=96&r=g","url":"https:\/\/secure.gravatar.com\/avatar\/0985fed6af04cc60703d2ecf27c65dfa373e0ca00eb21c0b03477e099ea3f99f?s=96&r=g","contentUrl":"https:\/\/secure.gravatar.com\/avatar\/0985fed6af04cc60703d2ecf27c65dfa373e0ca00eb21c0b03477e099ea3f99f?s=96&r=g","caption":"Jeff Wilson"},"description":"An experienced Linux veteran with many years of experience. Helping other Linux admins with frequent Linux and business-related blog posts on the RoseHosting blog. Techie by choice. Loving nature and travel. Happily married and father of two lovely children.","sameAs":["https:\/\/www.rosehosting.com","https:\/\/www.facebook.com\/rosehosting.helpdesk"],"url":"https:\/\/www.rosehosting.com\/blog\/author\/jwilson\/"}]}},"_links":{"self":[{"href":"https:\/\/www.rosehosting.com\/blog\/wp-json\/wp\/v2\/posts\/34460","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/www.rosehosting.com\/blog\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/www.rosehosting.com\/blog\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/www.rosehosting.com\/blog\/wp-json\/wp\/v2\/users\/4"}],"replies":[{"embeddable":true,"href":"https:\/\/www.rosehosting.com\/blog\/wp-json\/wp\/v2\/comments?post=34460"}],"version-history":[{"count":31,"href":"https:\/\/www.rosehosting.com\/blog\/wp-json\/wp\/v2\/posts\/34460\/revisions"}],"predecessor-version":[{"id":34508,"href":"https:\/\/www.rosehosting.com\/blog\/wp-json\/wp\/v2\/posts\/34460\/revisions\/34508"}],"wp:featuredmedia":[{"embeddable":true,"href":"https:\/\/www.rosehosting.com\/blog\/wp-json\/wp\/v2\/media\/34505"}],"wp:attachment":[{"href":"https:\/\/www.rosehosting.com\/blog\/wp-json\/wp\/v2\/media?parent=34460"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/www.rosehosting.com\/blog\/wp-json\/wp\/v2\/categories?post=34460"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/www.rosehosting.com\/blog\/wp-json\/wp\/v2\/tags?post=34460"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}