How to Install Magento 2.2 In Digital Ocean

Let’s install Magento 2.2 on Digital Ocean droplet.  Basically, digital ocean droplet is clean OS only so, you will have to install LAMP (Linux, Apache, MySQL and PHP) stack. Based on the Magento 2.2 requirement I created an Ubuntu 16.04.3 x 64 droplet. The ideal droplet size for magento2.2 would be size would be 3GB 20GB and 3TB in terms of performances.

Megento 2.2 Requirments

#1 Install Apache 2

  • sudo apt-get update
  • sudo apt-get install apache2
  • sudo systemctl status apache2 to check the apache status

Now you should be able to visit http://server_domain_or_IP and it will show you Apache2 Ubuntu Default Page.

Install PHP 7.1

  • Install PHP7.1 – sudo apt-get install php7.1
  • Restart Apache – systemctl restart apache2
  • sudo apt-cache search php7.1

Install PHP7.1 Modules

  • sudo apt-cache search php7.1
  • sudo apt-get install php7.1 php7.1-cli php7.1-common php7.1-json php7.1-opcache php7.1-mysql php7.1-mbstring php7.1-mcrypt php7.1-zip php7.1-fpm
  • sudo apt-get install curl
  • Restart Apache – systemctl restart apache2
  • Then Install PHP5 CURL by typing sudo apt-get install php5-curl
  • sudo apt-get install php-xml
  • sudo apt-get install php7.1-intl
  • sudo apt-get install php7.1-gd
  • sudo apt-get install php7.1-intl
  • sudo apt-get install php7.1-xsl
  • sudo apt-get install php7.0-soap
  • sudo systemctl restart apache2.service
  • apt install composer

php –ini |grep Loaded
Loaded Configuration File: /etc/php/7.1/cli/php.ini

sudo nano /etc/php/7.1/cli/php.ini
cgi.fix_pathinfo=0

Change defaul page

sudo nano /etc/apache2/mods-enabled/dir.conf
Change: DirectoryIndex index.html index.cgi index.pl index.php index.xhtml index.htm
To: DirectoryIndex index.php index.html index.cgi index.pl index.xhtml index.htm

Restart the PHP-FPM service:
sudo systemctl restart php7.1-fpm.service

Find the Sever Public IP

  • ip addr show eth0 | grep inet | awk ‘{ print $2; }’ | sed ‘s/\/.*$//’
  • http://your.id.add.is/

Install Mysql5.7

  • sudo apt-get update && sudo apt-get upgrade
  • sudo apt-cache search mysql | grep mysql | more
  • sudo apt-get install mysql-server5.7 php7.1-mysql

Create MySql Database

  • mysql -u root -p
  • CREATE DATABASE magento;
  • CREATE USER magento_user@localhost IDENTIFIED BY ‘password’;
  • GRANT ALL PRIVILEGES ON magento.* TO magento_user@localhost IDENTIFIED BY ‘password’;
  • FLUSH PRIVILEGES;
  • exit

Install Magento 2.0

Composer install

[Composer\Downloader\TransportException]
Invalid credentials for ‘https://repo.magento.com/packages.json’, aborting.

[Composer\Downloader\TransportException]
Invalid credentials for ‘https://repo.magento.com/archives/shopialfb/facebook-module/shopialfb-facebook-module-2.0.0.0.zip’, aborting.

Use public and private keys from here to solve this issue.
https://developer.magento.com/customer/accessKeys/list/

sudo find . -type d -exec chmod 775 {} \; && sudo find . -type f -exec chmod 664 {} \; && sudo chmod u+x bin/magento

For security, remove write permissions from these directories: ‘/var/www/html/app/etc’ {} \; && sudo chmod u+x bin/magento

find app/code lib pub/static app/etc var/generation var/di var/view_preprocessed vendor \( -type d -or -type f \) -exec chmod g-w {} \; && chmod o-rwx app/etc/env.php

Referances

  • Magento 2.2 Requirments – http://devdocs.magento.com/guides/v2.2/install-gde/system-requirements-tech.html
  • https://www.digitalocean.com/community/tutorials/how-to-install-and-configure-magento-on-ubuntu-14-04
  • https://www.digitalocean.com/community/questions/magento-2-1-3-on-ubuntu-16-04-1
  • https://www.digitalocean.com/community/tutorials/how-to-install-and-configure-magento-on-ubuntu-14-04
  • https://www.digitalocean.com/community/tutorials/how-to-install-and-configure-magento-on-ubuntu-14-04

 

Share this post



Leave a Reply

Your email address will not be published. Required fields are marked *