This step by step how to is intended to be a reference for those who are comfortable with working in terminals. This page lists all the commands on one place.

Step 0:
sudo apt-get update
Step 1: Installing Apache
sudo apt-get install apache2
sudo a2enmod rewrite
Step 2: Installing & Set up MySQL
sudo apt-get install mysql-server libapache2-mod-auth-mysql php5-mysql
sudo mysql_install_db
sudo /usr/bin/mysql_secure_installation
Follow instructions on screen.
Step 3: Install Ruby and Update RubyGems
sudo apt-get install ruby-full build-essential
sudo apt-get install libmysqlclient-dev
sudo gem install mysql2
sudo gem install rails
sudo gem install rubygems-update
sudo update_rubygems
Step 4: Installing Passenger and Configuring Apache
sudo gem install passenger
Install Apache development headers, curl development headers with SSL support.
sudo apt-get install libcurl4-openssl-dev libssl-dev apache2-threaded-dev libapr1-dev libaprutil1-dev
Configure Passenger for apache
sudo passenger-install-apache2-module
Follow the instructions on screen. You’ll get two sets of directives, one to be added to your apache config file and other to your Virtual Host directive.
Step 5: Installing phpMyAdmin (Optional)
Install PHP
sudo apt-get install php5 libapache2-mod-php5 php5-mcrypt
Install phpMyAdmin
sudo apt-get install phpmyadmin
Add the following line at the end of your /etc/apache2/apache.conf file
Include /etc/phpmyadmin/apache.conf