Home - Tuertolin/Linux GitHub Wiki

Installing MAGENTO

1. Environment

$sudo apt-get update

$sudo apt-get upgrade

2. Install LAMP

I will follow this guide: https://www.linode.com/docs/web-servers/lamp/install-lamp-stack-on-ubuntu-16-04/

$sudo apt install tasksel

$sudo tasksel install lamp-server

$sudo a2dismod mpm_event

$sudo a2enmod mpm_prefork

$sudo systemctl restart apache2

Configure virtual host

$sudo cp /etc/apache2/sites-available/000-default.conf /etc/apache2/sites-available/example.com.conf

Edit the new example.com.conf configuration file by uncommenting ServerName and replacing example.com with your site’s IP or Fully Qualified Domain Name (FQDN). Enter the document root path and log directories as shown below, and add a Directory block before :

/etc/apache2/sites-available/example.com.conf 1 2 3 4 5 6 7 8 9 10 11 12 13 <Directory /var/www/html/example.com/public_html> Require all granted <VirtualHost *:80> ServerName example.com ServerAlias www.example.com ServerAdmin webmaster@localhost DocumentRoot /var/www/html/example.com/public_html

    ErrorLog /var/www/html/example.com/logs/error.log
    CustomLog /var/www/html/example.com/logs/access.log combined

Create the folder that we have especified above

$sudo mkdir -p /var/www/html/example.com/{public_html,logs}

Link your virtual host file from the sites-available directory to the sites-enabled directory:

$sudo a2ensite example.com.conf

Disable the default virtual host to minimize security risks:

$sudo a2dissite 000-default.conf

Reload Apache $sudo systemctl reload apache2

Install dependencies $sudo apt-get install php7.2-common php7.2-gd php7.2-mcrypt php7.2-curl php7.2-intl php7.2-xsl php7.2-mbstring php7.2-zip php7.2-iconv mysql-client

Configure Apache $sudo a2enmod rewrite

3. Installing MAGENTO

Modify the virtual host file for your Magento site to resemble the example below. If you have not previously created a virtual host file, do so now and refer to the Configure Virtual Hosts section of the LAMP on Ubuntu 16.04 guide for additional guidance.

/etc/apache2/sites-available/example.com.conf

<Directory /var/www/html/example.com/public_html> Require all granted <VirtualHost *:80> ServerName example.com ServerAlias www.example.com ServerAdmin webmaster@localhost DocumentRoot /var/www/html/example.com/public_html

ErrorLog /var/www/html/example.com/logs/error.log
CustomLog /var/www/html/example.com/logs/access.log combined

<Directory /var/www/html/example.com/public_html>
    Options Indexes FollowSymLinks MultiViews
    AllowOverride All
</Directory>
The Directory block inside the Virtual Host block should point to the directory where you plan to install Magento. For simplicity, we will be installing it in our web root, but if you want to put it elsewhere (e.g., a subdirectory of your web root), modify this setting.

It’s important to note the value of AllowOverride as this affects which settings in each directory’s .htaccess file will apply and which will be ignored. If you’re not sure if the All option is optimal for your site, refer to the Apache documentation for more information on this setting.

⚠️ **GitHub.com Fallback** ⚠️