Skip to content

Instantly share code, notes, and snippets.

@Valentyn-Kubrak
Forked from kbond/post.md
Created July 30, 2013 18:19
Show Gist options
  • Save Valentyn-Kubrak/6115416 to your computer and use it in GitHub Desktop.
Save Valentyn-Kubrak/6115416 to your computer and use it in GitHub Desktop.

Install git:

sudo apt-get install git

Configure Git:

touch ~/.gitignore_global
git config --global core.excludesfile ~/.gitignore_global
git config --global user.name "Your Name"
git config --global user.email "Your Email"

ssh-keygen -t rsa -C "Your Email"
cat ~/.ssh/id_rsa.pub

Use php 5.4+ http://www.zimbio.com/Ubuntu+Linux/articles/D_AsJR2qAL6/How+Upgrade+PHP+5+4+Ubuntu

Install apache/php:

sudo apt-get install apache2 php5 php5-cli libapache2-mod-php5 php5-dev

Ensure this worked by visiting http://localhost/. You should see It works!.

Edit your php.ini:

sudo nano /etc/php5/cli/php.ini
  1. Add a timezone

     date.timezone = America/New_York
    
  2. Turn off short tags

     short_open_tag = Off
    
  3. Increase xdebug.max_nesting_level

     xdebug.max_nesting_level = 250
    

Install mysql (enter through password prompts to use use defaults):

sudo apt-get install mysql-server libapache2-mod-auth-mysql php5-mysql

Install phpmyadmin (choose apache2 and enter through password prompts to use default):

sudo apt-get install phpmyadmin

Edit phpmyadmin config.inc.php:

sudo nano /etc/phpmyadmin/config.inc.php

Add/edit the following (around page 42):

// ...

/* Authentication type */
$cfg['Servers'][$i]['auth_type'] = 'config';

$cfg['Servers'][$i]['AllowNoPassword'] = TRUE;
$cfg['Servers'][$i]['user'] = 'root';
/* Server parameters */

// ...

Ensure this worked by visiting http://localhost/phpmyadmin.

Install useful php modules:

sudo apt-get install php5-mcrypt php5-xdebug php5-curl php5-sqlite php5-xsl php5-intl php-pear php-apc

Change php.ini directory for apache to use the same config as cli:

Edit /etc/apache2/mods-enabled/php5.load to look like the following:

PHPIniDir "/etc/php5/cli"

LoadModule php5_module /usr/lib/apache2/modules/libphp5.so

Install PHPUnit:

sudo pear config-set auto_discover 1
sudo pear install pear.phpunit.de/PHPUnit

Install Composer:

sudo apt-get install curl
curl -sS https://getcomposer.org/installer | php
sudo mv composer.phar /usr/local/bin/composer

Install node.js/npm:

sudo apt-get install python-software-properties python g++ make
sudo add-apt-repository ppa:chris-lea/node.js
sudo apt-get update
sudo apt-get install nodejs

Install Bower/UglifyJs/UglifyCss:

sudo npm install -g bower
sudo npm install -g uglify-js
sudo npm install -g uglifycss

Appendix

A. Configure Apache Sites

Enable Apache mods:

sudo a2enmod rewrite vhost_alias

Add Apache site:

sudo nano /etc/apache2/sites-available/dev

Add the following:

<VirtualHost *:80>
  ServerName localhost
  DocumentRoot /home/{user}/www
</VirtualHost>

<VirtualHost *:80>
  ServerName *.local
  ServerAlias *.local
  VirtualDocumentRoot /home/{user}/www/%1/web
</VirtualHost>

Enable the site:

sudo a2ensite dev

Restart Apache:

sudo apache2ctl restart

Ensure your sites are added to /etc/hosts:

127.0.0.1    mysite.local

B. Enable SSL

Install ssl-cert:

sudo apt-get install ssl-cert

Enable ssl and default ssl site in apache:

sudo a2enmod ssl
sudo a2ensite default-ssl
sudo service apache2 restart

C. Install Twig C Extension

Reference: http://twig.sensiolabs.org/doc/intro.html#installing-the-c-extension

Ensure gcc is intalled:

sudo apt-get install gcc

Then run the following:

git clone https://github.com/fabpot/Twig.git
cd Twig/ext/twig/
sudo phpize
sudo ./configure
sudo make
sudo make install

Add the following to /etc/php5/cli/php.ini:

extension=twig.so

Restart Apache:

sudo apache2ctl restart

D. Enable ACL

Edit your filesystem table:

sudo nano /etc/fstab

Add acl to the options column of ext4:

# <file system>  <mount point>  <type>  <options>              <dump>  <pass>
UUID=...         /              ext4    acl,errors=remount-ro  0       1
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment