In this article, you going to see a discussion regarding Magento 2 install Step by Step Guide April 2021 in a detailed and simple way.
If you are stuck with the installation process, then this guide is very much useful in the process of installation.
Let’s have look at the topic of Magento 2 install Step by Step Guide April 2022
Before installation of Magento 2 please check with the below link for Magento 2 requirement.
Magento 2 Installation System requirement
There are many steps involved in the installation.
Let’s check with step one on how to install Apache2 Server.
It is an Apache HTTP Server which is completely free, open-source software.
One of the best things regarding is easily run on Linux, Windows, OpenVMS, NetWare.
It is also run on many more operating systems.
There is a need to update the package before installing apache with the help of the executing below install apache2 command.
sudo apt update
sudo apt install apache2
Execute the below command to automatically run apache.
sudo systemctl enable apache2.service
Let’s check with another step to configuring the apache2 virtual host.
In this case, you have to create a fresh and new config file called magento2.conf.
It is for declear
Apache2 site configuration.
To do this use the below command.
sudo nano /etc/apache2/sites-available/magento2.conf
Use the below code.
The next task is to copy and paste it into the above file.
Make sure to change the domain name from the below code.
<VirtualHost *:80> ServerAdmin [email protected] DocumentRoot /var/www/html/magento2/ ServerName domainname.com ServerAlias www.domainname.com <Directory /var/www/html/magento2/> Options Indexes FollowSymLinks MultiViews AllowOverride All Order allow,deny allow from all </Directory> ErrorLog ${APACHE_LOG_DIR}/error.log CustomLog ${APACHE_LOG_DIR}/access.log combined </VirtualHost>
For installing the Magento locally you have to change the domain name as domainname.com to localhostname.com.
Next, you have to update your host file.
Check the below example.
127.0.0.1 localhost.com
127.0.0.1 abc.com
127.0.0.1 m12.com
Important note: I have use localhost so I have used localhost.com in this tutorial.
The next important step is to enable the rewrite mode.
sudo a2ensite magento2.conf
sudo a2enmod rewrite
The important step is to install the latest ver of PHP 7.2 and its extension.
In the case of Ubuntu 18.04, you have to use below command line
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-mcrypt php7.2-mysql php7.2-gd php7.2-xml php7.2-cli php7.2-zip
Another important next step is to update the file called php.ini
For increasing the value in the file use the below command line.
sudo nano /etc/php/7.2/apache2/php.ini
Below are the changes you have to make in this file.
file_uploads = On allow_url_fopen = On short_open_tag = On memory_limit = 512M upload_max_filesize = 128M max_execution_time = 3600
After changing, save the file.
Then after updating use the below command for restart apache2.
sudo systemctl restart apache2.service
An important step of installing a Database Server.
In the case of Magento 2, it preferred MariaDB Server for the database to default MySQL.
It is used because it faster and best in all types of performance.
Use the below command line to install.
sudo apt-get install mariadb-server mariadb-client
Always remember to reboot the server for start and startup every time. Use the below command for this.
sudo systemctl restart mariadb.service
sudo systemctl enable mariadb.service
For set up, a database server uses the below command line.
sudo mysql_secure_installation
During the process, you have to go through the following steps.
Enter current password for root (enter for none): Enter Set root password? [Y/n]: Y New password: Type your password Re-enter new password: Type your password Remove anonymous users? [Y/n]: Y Disallow root login remotely? [Y/n]: Y Remove test database and access to it? [Y/n]: Y Reload privilege tables now? [Y/n]: Y
Important Step for creating Create MySQL User (It is important and required).
It is important to create a unique user for the installation process, it is not a default user – root.
To do this you have to first login to MariaDB to install.
Use the below command line for this.
sudo mysql -u root -p
Use to below command line to create a new database.
CREATE DATABASE magento2
Then create a new user name techone
in the next step.
Execute the below command line.
CREATE USER 'techone'@'localhost' IDENTIFIED BY 'YOUR_PASSWORD';
Give the permission or grant techone
user to magento2 database.
To do this use the below-given command line.
GRANT ALL ON magento2.* TO 'techone'@'localhost' IDENTIFIED BY 'YOUR_PASSWORD' WITH GRANT OPTION;
Then the next step is to flush privileges and exit.
FLUSH PRIVILEGES;
EXIT;
The important step to install the composer.
Visit link Download Composer and install.
You can install the composer using the below command line.
curl -sS https://getcomposer.org/installer | sudo php -- --install-dir=/usr/local/bin --filename=composer
Use the below command line to check the composer version
composer -v.
Important step to download to Magento 2 pack
Use the below link to download the pack of the Magento 2.
After completion of download extract the pack to /var/www/html/
.
In the case of your system, you will have folder magento2Â /var/www/html/
Use the below command line to give permission.
sudo chown -R www-data:www-data /var/www/html/magento2/
sudo chmod -R 755 /var/www/html/magento2/
An important step to install Magento 2
Add the URL in the browser.http://localhost.com/magento2.
You will get the screen as given in the below image[Magento 2 install step one].
In the next, you will see the below screen as the process of readiness check get starts during installation. During this process, you will get an error, fix it and move to the next step, click next to do that.
In next step is to add database information.
Click next to continue.
Now the step is to add web configuration.
- Add Store Address:
http://localhost.com
- Add Magento admin address as you like it such as admin or backend for accessing the admin.
In the next step customize your store Time Zone list, Currency list, Language list.
Then expand advanced Modules Configuration to optionally enable or disable modules.
This is an important step in this you can choose to install sample data or not, depends on you.
Click Next to continue to process of installation.
Important Step to Create Admin Account
Add the below information to create the admin account.
- New Username
- A New E-Mail
- New Password
- Confirm Password
- Then click Next
After doing all this you will get a screen as given below for install.
Now the installation process is complete.
Check the front end link by click on it. You will get a screen as below.
Conclusion :
Finally done with the installation process. If you have any queries you feel free to comment on it.