Ubuntu Zero To Hero Guide (best for PHP developers)

Took me quite a while to pull all these information together. This guide should install most basic packages you will need to get started with PHP Development.

*This was tested with Ubuntu 13.04 but most things should also work on Ubuntu 12.

Java First

#remove open jdk and install oracle jdk

sudo apt-get purge openjdk*

sudo apt-get autoremove

sudo add-apt-repository ppa:webupd8team/java

sudo apt-get update

sudo apt-get install oracle-java7-installer


Basic Stuff

sudo apt-get install apache2 -y

sudo apt-get install php5-curl

sudo apt-get install ant -y

sudo apt-get install php5-intl

sudo apt-get install php5-tidy

sudo apt-get install mysql[*] (type in mysql and it will tell you what version to install)

sudo apt-get install mysql-server -y

sudo apt-get install php5 -y

sudo apt-get install php5-mysql -y

sudo apt-get install ssh -y

sudo apt-get install gnome-system-tools -y

#the PECL_HTTP extension
sudo apt-get install libcurl3-openssl-dev -y
sudo pecl install pecl_http -y
#when this is done, add “extension=http.so” in /etc/php/apache2/php.ini under the “Dynamic Extensions” section

Apache Authentication

sudo a2enmod auth_digest //install digest authentication module

Image libraries

sudo apt-get install php5-imagick
sudo apt-get install php5-gd

#I think it makes sense not to use imagick and gd directly but to use Imagine which is a wrapper for the two available on packagist. It has a much user friendly API which I highly recommend if you want a time saver.
Here is the link to it on packagist https://packagist.org/packages/imagine/imagine


MySQL Optimization for InnoDB, (This will significant increase the query time for InnoDB but it’s important to leave this as 1 on a live environment. For more information, see http://dev.mysql.com/doc/refman/4.1/en/innodb-parameters.html)

innodb_flush_log_at_trx_commit = 0

#To debug slow queries, set the following configuration options

log_queries_not_using_indexes = on
slow_query_log = on
log_output = table

and then look at the ‘slow_query’ table in the ‘mysql’ database.

Install MongoDB

sudo apt-key adv –keyserver hkp://keyserver.ubuntu.com:80 –recv 7F0CEB10
echo ‘deb http://downloads-distro.mongodb.org/repo/ubuntu-upstart dist 10gen’ | sudo tee /etc/apt/sources.list.d/mongodb.list
sudo apt-get update
sudo apt-get install mongodb-10gen

#gui tool


If your Ubuntu is installed as a Virtual Machine, it’s very likely you’ll come cross using Samba to share folders so that a mapped drive can be created in your native OS to access them directly.

The easiest way to do this is by right clicking on a folder and select Sharing Options, then tick the Share this folder box and the Allow others to create and delete files in this folder box. Save your changes.

Once this is done, you’ll need to manually create a Samba user to gain access to the shared folder. This can be simply done by,

sudo smbpasswd -a <username>




sudo apt-get install php5-dev -y

sudo apt-get install php-pear -y

sudo pecl install xdebug

#then add the following lines into /etc/php5/apache2/php.ini








#finally make sure xdebug shows in phpinfo();

Xdebug – CMD setup

edit /etc/php5/apache2/php.ini and add the following section on the bottom,








I am using Netbeans as my IDE, Type in

export XDEBUG_CONFIG=idekey=netbeans-xdebug on command line and start Netbean debug session to listen on the same key.

Now, simply run phpunit <Test Script Name>.php should start the debug session.

If you need to stop debugging from command line, type in


Rabbitvcs (svn client gui on linux)


#the following line is a fix for utuntu 13.04 (please note that in Ubuntu 13.04, you can only bring up the GUI from command line. E.g. rabbitvcs commit)

sudo ln -s /usr/lib/x86_64-linux-gnu/libpython2.7.so /usr/lib/libpython2.7.so.1.0


Firewall GUI tool

search gufw from software manager


VHost Setup

First, follow the guide from


Just a quite note, to enable or disable a vhost,

Enable: sudo a2ensite [site-name]

Disable: sudo a2dissite [site-name]


#Enable rewriteengine

a2enmod rewrite

In order to use the .htaccess file, you need to set

AllowOverRide All within the Apache config file


#install node

sudo apt-get install g++ curl libssl_dev apache2-utils git-core
sudo apt-get install python-software-properties
sudo add-apt-repository ppa:chris-lea/node.js
sudo apt-get update
sudo apt-get install nodejs

If these commands don’t work, check http://slopjong.de/2012/10/31/how-to-install-the-latest-nodejs-in-ubuntu/

Bower (A Package Manager for the web)

sudo apt-get install npm

Then follow https://github.com/bower/bower