Install Apache web server, PHP5, and MySQL

Install and Configure Apache2

# apt-get update
# apt-get install apache2 apache2-utils

Add ServerName <mymachinename> to /etc/apache2/apache2.conf

Note that sites-enabled now expects files with the extension .conf to load

Restart the server with either of the following commands:

# service apache2 restart
# /etc/init.d/apache2 restart

Install and Configure PHP5

To install PHP5 package and all related package dependencies run the following command below. by default ubuntu server 14.04 will installed PHP 5.5

# apt-get install php5 php5-mysql php-pear php5-gd  php5-mcrypt php5-curl

Install and Configure MySQL Server

To install Mysql Server package and all related package dependencies run the followong command:

# apt-get install mysql-server libapache2-mod-auth-mysql php5-mysql
# apt-get install phpmyadmin

During the installation, you’ll be asked to setup the MySQL root user password. This is an administrative account in MySQL that has increased privileges, Enter the password and select [OK].

Configuration for phpmyadmin

# Allow access without password
SetEnvIf User-Agent "Mozilla" webmaster
Order Deny,Allow
Deny from all
Allow from env=webmaster

Restore existing databases

  1. Find the MySQL config file:
      # find / -name my.cnf
  2. Find datadir = /var/lib/mysql in the file, which points to where databases are stored on the server.
  3. Copy the folder with the existing database files into the datadir path
  4. Stop mysql server, set file permissions, and restart the server
      # /etc/init.d/mysql stop
      # chown -R mysql:mysql /var/lib/mysql/<folder>
      # /etc/init.d/mysql start
  5. If you restore existing joomla databases over restoring the joomla code, restore the code first including db, stop the mysql server, replace the db, and restart the mysql server

See How to Install LAMP in Ubuntu Server 14.04 LTS