Skip to content

Instantly share code, notes, and snippets.

@shobhitsinghal624
Last active March 4, 2016 11:13
Show Gist options
  • Save shobhitsinghal624/d2b01fc2d5bf35860308 to your computer and use it in GitHub Desktop.
Save shobhitsinghal624/d2b01fc2d5bf35860308 to your computer and use it in GitHub Desktop.
#! /usr/bin/env bash
cd ~
# Install LAMP - apache, php
sudo apt-get install --assume-yes apache2 php5 mysql-server-5.6 mysql-client-5.6
sudo service apache2 stop
# Install LAMP - mysql
sudo apt-get install --assume-yes mysql-server-5.6 mysql-client-5.6
sudo service mysql stop
# Install other needed stuff
sudo apt-get install --assume-yes wget dos2unix
# Install these php5 modules
sudo apt-get install --assume-yes php5-mhash php5-mcrypt php5-curl php5-cli php5-mysql php5-gd php5-intl php5-xsl
# Enable mcrypt on php
sudo php5enmod mcrypt
# Enable mod_rewrite on apache
sudo a2enmod rewrite
# Install composer
curl -sS https://getcomposer.org/installer | php
sudo mv composer.phar /usr/local/bin/composer
# Install magento using composer
# For Magento authentication - http://devdocs.magento.com/guides/v2.0/install-gde/prereq/connect-auth.html
# To bypass github rate limit generate auth token here - https://github.com/settings/tokens
sudo composer create-project --repository-url=https://repo.magento.com/ magento/project-community-edition /var/www/magento2
# Folder and file ownerships
sudo chown -R www-data:www-data /var/www/magento2
sudo chmod u+x /var/www/magento2/bin/magento
# Change Apache Config
cd /etc/apache2/sites-available/
sudo wget https://gist.githubusercontent.com/shobhitsinghal624/d2b01fc2d5bf35860308/raw/magento.conf
cd /etc/apache2/sites-enabled/
sudo ln -s ../sites-available/magento.conf
sudo rm 000-default.conf
# Restart apache after enabling mcrypt, rewrite
sudo service mysql start
sudo service apache2 start
##
# Make php.ini changes as per this link - http://devdocs.magento.com/guides/v2.0/install-gde/prereq/php-ubuntu.html
##
<VirtualHost *:80>
#ServerAdmin webmaster@localhost
#ServerName domain.tld
#ServerAlias www.domain.tld
DocumentRoot /var/www/magento2
# To avoid redirect loops in magento
SetEnvIf X-Forwarded-Proto https HTTPS=on
# Available loglevels: trace8, ..., trace1, debug, info, notice, warn,
# error, crit, alert, emerg.
# It is also possible to configure the loglevel for particular
# modules, e.g.
#LogLevel info ssl:warn
ErrorLog ${APACHE_LOG_DIR}/error-magento.log
CustomLog ${APACHE_LOG_DIR}/access-magento.log combined
<Directory />
Options FollowSymLinks
AllowOverride All
</Directory>
<Directory /var/www/magento2>
Options Indexes FollowSymLinks MultiViews
AllowOverride All
Order allow,deny
allow from all
</Directory>
php_value date.timezone "Asia/Kolkata"
</VirtualHost>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment