Ubuntu

How to install and configure Magento 2.3.0 on Ubuntu 18.04

How to install and configure Magento 2.3.0 on Ubuntu 18.04

Magento is an open source modern cloud eCommerce platform. It is written in PHP, and there is both a free and paid version of its platform. The Community edition is offered for free, while the paid version is targetted for Enterprises with increased cloud integration capabilities.

Magento has some compelling features for an e-commerce business to build and grow a unique online store from scratch. The first stable version of Magento was released in 2008. In May 2018, Adobe acquired Magento for $1.68bn. The current stable version is Magento 2.3.0.

Install Magento 2.3.0 on Ubuntu

In this tutorial, we will present you a step-by-step guide on how to install and configure Magento 2.3.0 on Ubuntu 18.04. Before jumping on to steps, let's figure out the prerequisites.

Magento 2.3.x technology stack requirements

Detailed system requirements is found on the official Magento website. Our Nginx based test computer has the following setup:

1. Installing Nginx

Nginx is a yet another Web Server and used as a reverse proxy, HTTP cache, load balancer, and mail proxy, etc. The first thing to do is to check available Nginx version on repositories. Launch the Terminal and enter the following command:

sudo apt-cache policy nginx

Check Available Nginx Version

The following command installs Nginx.

sudo apt-get -y install nginx

The Nginx service should automatically start. You can check its status:

sudo systemctl status nginx.service

Check Status

For some reason, if you can't see Nginx as an active process, you can still manually start the process:

sudo systemctl start nginx.service

Next, launch the internet browser and test Nginx installation:

http://localhost/

Alternatively, you can input your Server IP too. For example,

http://192.168.20.3 (server IP)

If you can see the Nginx default page. Installation is successful!

Test nginx Installation

2. Installing PHP 7.2

As usual, let's first check for availability for PHP 7.2.

sudo apt-cache policy php7.2

You can next install PHP 7.2 and extensions.

sudo apt-get install php7.2-fpm php7.2-cli php7.2 php7.2-common php7.2-gd php7.2-mysql php7.2-curl php7.2-intl php7.2-xsl php7.2-mbstring php7.2-zip php7.2-bcmath php7.2-iconv php7.2-soap

Verify the installation of PHP 7.2 using the below command:

sudo php -v

Verify PHP Installation

Check whether all the PHP extensions are installed:

sudo php -me

The output should be similar to the following

[PHP Modules] bcmath calendar Core ctype curl date dom exif fileinfo filter ftp gd gettext hash iconv intl json libxml mbstring mysqli mysqlnd openssl pcntl pcre PDO pdo_mysql Phar posix readline Reflection session shmop SimpleXML soap sockets sodium SPL standard sysvmsg sysvsem sysvshm tokenizer wddx xml xmlreader xmlwriter xsl Zend OPcache zip zlib [Zend Modules] Zend OPcache

Modify PHP parameters to suit the Magento needs for optimal performance. Particularly, we will be indicating the RAM allocation and the execution time.

Use the vim command to edit the php.ini file:

vim /etc/php/7.2/fpm/php.ini

Modify the following parameters:

memory_limit = 2G max_execution_time = 1800 zlib.output_compression = O

Save and close the file. Similarly, let's edit one more file:

vim /etc/php/7.2/cli/php.ini

Modify the following parameters. Yes, it's the same as the previous mod.

memory_limit = 2G max_execution_time = 1800 zlib.output_compression = O

Save and close the file. You need to restart php fpm for the new settings to take effect.

sudo systemctl restart php7.2-fpm

3. Installing MySQL 5.7

The same exercise to begin with. Check for the available version on the Repositories.

sudo apt-cache policy mysql-server

Finish installing MYSQL:

sudo apt install -y mysql-server mysql-client

Check MYSQL server status:

sudo systemctl status mysql.service

Start MYSQL server:

sudo systemctl start mysql.service

Secure the installation:

sudo mysql_secure_installation

Test the installation:

sudo mysql -u root -p

4. Installing and configuring Magento 2.3.0

Finally, we are here to download and install Magento software. There are a few ways you can do it:

We recommend using the composer and we will show you how. Firstly, install the composer using the following command:

sudo curl -sS https://getcomposer.org/installer | sudo php -- --install-dir=/usr/bin --filename=composer

Create a folder and user for Magento installation:

sudo adduser deploy
sudo mkdir -p /var/www/html/webapp

Change the folder permissions:

chown -R deploy:www-data /var/www/html/webapp

You need to get your authentication keys from Magento before downloading Magento via composer.

To acquire the authentication keys, follow these simple steps:

  1. Log in to the Magento Marketplace. If you don't have an account, you can create one for free by clicking on “Register”.
  2. Next, click on your account name in the top-right of the page and select “My Profile”.
  3. Click “Access Keys” in the Marketplace tab.
  4. Click “Create a New Access Key”. Enter a specific name for the keys and click “OK”.
  5. Use the “Public key” as your username and the “Private key” as your password.

Authentication-keys

Additionally, you can refer the official documentation about the authentication keys in the Magento webpage. Time to start downloading Magento:

Change the user to the one you created earlier.

sudo su deploy

Navigate to the webapp directory:

cd /var/www/html/webapp

Finally, download Magento using composer:

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

When prompted for the user name and password. Provide your  Magento authentication keys:

Download Magento using Composer

Also, you should see a prompt to save credentials. Type Y to begin downloading Magento and its needed modules. After the installation is done exit the terminal.

5. Configuring Nginx

We shall first create a new virtual host for the Magento site. To begin with, Magento installation directory comes with a sample Nginx configuration file, therefore we shall simply copy it to the nginx directory:

cp /var/www/html/webapp/nginx.conf.sample /etc/nginx/magento.conf

Create a virtual host configuration file called “magento”

sudo vim /etc/nginx/sites-available/magento

Add the following contents to the file. Make sure to replace your domain name in place of magentotest.fosslinux.com in the below text.

 upstream fastcgi_backend  server unix:/run/php/php7.2-fpm.sock;  server  listen 80; server_name magentotest.fosslinux.com; set $MAGE_ROOT /var/www/html/webapp; include /etc/nginx/magento.conf;  

Save and exit the file.

Enable the virtual host you created:

sudo ln -s /etc/nginx/sites-available/magento /etc/nginx/sites-enabled

Verify nginx syntax:

sudo nginx -t

Restart Nginx service:

sudo systemctl restart nginx

6. Configuring MySQL user

Login to MySQL server using root login.

sudo mysql -u root -p

Create a database of your choice.

Create database magdb;

Create a database user.

CREATE USER magousr@'localhost' IDENTIFIED BY '123abc';

Grant the Permissions.

grant all privileges on magdb.* to 'magousr'@localhost ;
FLUSH PRIVILEGES;

In order for the installation process to proceed smoothly, you need to set folder permission. Failing to do this often ends with Readiness check fail error in the upcoming stage.

Change directory to your document root.

sudo cd /var/www/html/webapp

Change folder permissions.

sudo chmod -R 775 var/ generated/ pub/ app/ vendor/

Let's start Magento! Launch a web browser and type your web server name. Obviously, replace magentotest.fosslinux.com with your domain name and hit enter.

http://magentotest.fosslinux.com/setup

You should see the Magento web page.

Magento Setup Page

Click “Agree and setup Magento” and go through the Readiness Check process. Click “Next”.

Readiness Check

You should enter the database details. Enter Database Server Hostname, username, password, and database name. Optionally, we can enter a Table prefix to easily identify the database. Click “Next”.

Database

In the Web Configuration section, enter the store address followed by admin address. Make sure “Encryption Key” is set to “I want o use a Magento generated key”. Click “Next”.

Web Configuration

Customize Your Store as per your needs:

Customize Your Store

Create an Admin Account:

Create an Admin account

Finish the installation by clicking “Install Now”.

Install

Wait for the installation to finish.

Installation Progress

Enjoy success!

Verify and browse storefront.

Verify the storefront

Enter the admin username and login password.

Admin login page

That's it! Hopefully, your installation went smooth as mine. Let us know your feedback in the comments below.

Parhaat pelit, joita voi seurata käsien seurannalla
Oculus Quest esitteli äskettäin loistavan ajatuksen seurannasta ilman ohjaimia. Yhä kasvavan määrän pelejä ja aktiviteetteja, jotka tukevat tukea joko...
Kuinka näyttää OSD-peitto koko näytön Linux-sovelluksissa ja peleissä
Koko näytön pelien pelaaminen tai sovellusten käyttäminen häiriöttömässä koko näytön tilassa voi estää sinut paneelissa tai tehtäväpalkissa näkyvistä ...
Viisi parasta pelin kaappauskorttia
Olemme kaikki nähneet ja rakastaneet suoratoistopelejä YouTubessa. PewDiePie, Jakesepticye ja Markiplier ovat vain joitain huippupelaajista, jotka ova...