Magento 2 – Install On Ubuntu 16.04 – 18.04 via Setup Wizard – Here we are going to discuss how to install Magento 2 latest version easily. This post helps you to setup Magento 2 using GUI setup wizard.
This will help new users to Install Magento 2 On Ubuntu 16.04 | 18.04 With Apache2, Percona DB and PHP 7.2
When you use Composer to install Magento 2 packages, you can easily upgrade from the commmand line with Composer.
This tutorial is going to show new users how to install / upgrade Magento 2 (CE 2.3.3) from Github repository via Composer with Apache2, Percona DB and PHP 7.2 on Ubuntu 16.04 | 18.04 LTS servers…
To get started with installing Magento 2.3.3, follow the steps below:
Step 1: Install Apache 2.4.x (HTTP)Web Server on Ubuntu 16.04-18.04 LTS
The Apache HTTP Server, colloquially called Apache, is free and open-source cross-platform web server software, released under the terms of Apache License 2.0. Apache is developed and maintained by an open community of developers under the auspices of the Apache Software Foundation
Please follow below steps to install Apache HTTP server
$ sudo apt update $ sudo apt install apache2 $ apache2 -v (to check apache version)
Use below commands to enable Apache2 with startup and start, restart & stop Apache2 service.
sudo systemctl enable apache2.service sudo systemctl start apache2.service sudo systemctl restart apache2.service sudo systemctl stop apache2.service
Once you finish the installation, you need to enable the Apache mod_rewrite module using below commands
$ sudo a2enmod rewrite $ sudo service apache2 restart
To test the Apache setup, open your browser and type your server IP address or host name. If you can see below Apache landing page you have installed HTTP server correctly.
Step 2: Install Percona Server 5.7 on Ubuntu 16.04-18.04 LTS
Percona Server for MySQL is a distribution of the MySQL relational database management system created by Percona. Percona Server for MySQL is an open source relational database management system. It is a free, fully compatible drop in replacement for Oracle MySQL
To Install Percona Server please follow below steps;
$ wget https://repo.percona.com/apt/percona-release_latest.$(lsb_release -sc)_all.deb $ sudo dpkg -i percona-release_latest.$(lsb_release -sc)_all.deb $ sudo apt-get update $ sudo apt-get install percona-server-server-5.7
During the installation, setup will prompt for “root” password and keep it safe place to work with the server in the future. Please use below command to access Percona Server.
$ mysql -u root -p "your password"
After installing Percona server, the commands below can be used to stop, start and enable Percona server service to always start up when the server boots..
sudo systemctl stop mysql.service sudo systemctl start mysql.service sudo systemctl enable mysql.service
Step 3: Install PHP 7.2 and related modules on Ubuntu 16.04-18.04 LTS
PHP: Hypertext Preprocessor is a general-purpose programming language originally designed for web development. It was originally created by Rasmus Lerdorf in 1994; the PHP reference implementation is now produced by The PHP Group
Please follow below steps to install PHP 7.2 with required modules to run Magento 2.3.3 installation.
PHP 7.1 may not be available in Ubuntu default repositories… in order to install it, you will have to get it from third-party repositories.
$ sudo apt-get install software-properties-common $ sudo add-apt-repository ppa:ondrej/php
Please run below command to update repository
$ sudo apt update
Please run below command to install PHP and relate modules
$ sudo apt install php7.2 libapache2-mod-php7.2 php7.2-common php7.2-gmp php7.2-curl php7.2-soap php7.2-bcmath php7.2-intl php7.2-mbstring php7.2-xmlrpc php7.2-mysql php7.2-gd php7.2-xml php7.2-cli php7.2-zip
After installation you can use below commands to check PHP version and modules installed.
$ php -v $ php -m
PHP 7.2.24-1+ubuntu18.04.1+deb.sury.org+1 (cli) (built: Oct 24 2019 18:29:11) ( NTS ) Copyright (c) 1997-2018 The PHP Group Zend Engine v3.2.0, Copyright (c) 1998-2018 Zend Technologies with Zend OPcache v7.2.24-1+ubuntu18.04.1+deb.sury.org+1, Copyright (c) 1999-2018, by Zend Technologies
After installing PHP 7.1, run the commands below to open PHP default config file for Apache2
You need to change below parameters to work with Magento 2
$ sudo nano /etc/php/7.2/apache2/php.ini
Then make the changes on the following lines below in the file and save. The value below is great settings to apply in your environments.
file_uploads = On allow_url_fopen = On short_open_tag = On memory_limit = 768M upload_max_filesize = 100M max_execution_time = 360 date.timezone = America/Chicago
After making the above change, save the file and close out and restart the Apache service to effect changes
$ sudo systemctl restart apache2.service
To test PHP 7.2 settings with Apache2, create a phpinfo.php file in the Apache2 root directory by running the commands below.
$ sudo nano /var/www/html/phpinfo.php
Paste below code and save the file
<?php phpinfo( ); ?>
Try to access http://localhost/phpinfo.php You should see PHP settings page as below
Step 4: Create Magento Database
Our server is ready with all the prerequisites to install Magento 2, but we need to create Magento DB and the DB users with the required privileges
To logon on to Percona database server, run the commands below.
$ mysql -u root -p
Then create a database called magento233
mysql> CREATE DATABASE magento233;
Create a database user called magento233user with the new password
mysql> CREATE USER 'magento233user'@'localhost' IDENTIFIED BY 'your pass';
Then grant the user full access to the database.
mysql> GRANT ALL PRIVILEGES ON magento233 . * TO magento233user'@'localhost';
Finally flush privileges and exit
FLUSH PRIVILEGES; EXIT;
Step 4: Download Magento 2.3.3 CE Package
To download Magento Community edition setup package you need to create Magento account or If you are a existing users please logon to your account
Once you are ready with the account please got to https://magento.com/tech-resources/download page to download your copy of Magento community edition
Upload Magento 2 setup to your web root directory and access using browser to continue with the setup
http or https://example.com
Follow the instructions according to the setup wizard