1. Setup Requirements
- Apache 2.2 or 2.4 with mod_rewrite module (or) Nginx >= 1.8.
- PHP 5.5 or later version. PHP 7.0 also supported.
- Required PHP-Modules – PDO/MySQL, mbstring, mcrypt, mhash, SimpleXML, curl, xsl, gd, ImageMagick 6.3.7 (or later) or both, soap, intl, openssl.
- Composer and Git
$ sudo apt install apache2 git mysql-server $ sudo apt install php libapache2-mod-php php-mysql php-dom php-simplexml php-gd $ sudo apt install php-curl php-intl php-xsl php-mbstring php-zip php-xml php-mcrypt
$ curl -sS https://getcomposer.org/installer | php $ mv composer.phar /usr/local/bin/composer $ chmod +x /usr/local/bin/composer
2. Setup Magento2
Magento2 code is available under Github repository. Use following command to clone Magento2 repository on your system.$ git clone https://github.com/magento/magento2.gitNow install all required modules for Magento2 using composer. Wait for the installation process completed.
$ cd magento2/ $ composer installNow set the permissions on files and directories.
$ sudo chmod -R 755 /var/www/magento2/ $ sudo chmod -R 777 /var/www/magento2/{pub,var}
3. Create Database
Now login to your mysql server with admin privileges and create a database and user for new magento2 installation.$ mysql -u root -p mysql> CREATE DATABASE magento2_db; mysql> GRANT ALL ON magento2_db.* TO magento2_usr@'localhost' IDENTIFIED BY 'password'; mysql> FLUSH PRIVILEGES; mysql> quit
4. Configure Apache VirtualHost
Create Apache configuration file for your Magento website like /etc/apache2/sites-available/magento2.example.com.conf and add following content.<VirtualHost *:80> DocumentRoot /var/www/magento2 ServerName magento2.example.com <Directory /var/www/magento2> Allowoverride all </Directory> </VirtualHost>Now enable virtualhost using following command.
$ sudo a2ensite magento2.example.comAlso make sure to enable Apache rewrite module, which is recommended by Magento.
$ sudo a2enmod rewriteAfter doing all above changes, make sure to restart Apache server.
$ sudo systemctl restart apache2.service
5. Start Web Installer
Let’s begin the installation of Magento2 using web installer. Access your magento2 directory on web browser like below. It will redirect you to installation start page.http://magento2.example.com/On first step agree the License agreement and click on “Agree and Setup Magento”.
On Step 1 click on “Start Rediness Test”. Magento will check for system requirements here. On successful completion you will see screen like below then Just click Next. Fix issues if shows on this screen and click Try again.

Now follow the wizard steps 2, 3, 4, 5, 6 and on successful installation you will get screen like below.

Now login to your admin panel using created admin credentials in above steps.

Congratulation! You have successfully deployed Magento2 on your system.
6. Schedule Magento2 Cronjobs
Finally schedule the backgound cronjobs for your magento2 installation. These cronjobs does some activities like, re-indexing, Newsletters, Update of currency rates, sending automatic emails and generating sitemaps etc. To schedule these jobs edit crontab file$ crontab -eand add following cronjobs at the end of file and save it.
*/1 * * * * www-data php /var/www/magento2/bin/magento cron:run */1 * * * * www-data php /var/www/magento2/update/cron.php */1 * * * * www-data php /var/www/magento2/bin/magento setup:cron:runHere www-data is the user under which Apache is running and /var/www/html/magento2/ is the location of your Magento2 applications.
Comments
Post a Comment