How to Install Apache, MySQL, and PHP on Ubuntu

LAMP includes Apache, MySQL, PHP, and Ubuntu. This guide was written for Ubuntu 14.04.

Step One: Install Apache

Apache is a free open source software for web servers.

To install Apache on Ubuntu, type these commands:

sudo apt-get update
sudo apt-get install apache2

Or just copy and paste this:

sudo apt-get update; sudo apt-get install apache2

Tahhda. Let's check if Apache was installed correctly. Run the command: hostname -I and note down that IP. Open up your Internet Browser and direct your browser to that IP (Example: http://108.61.212.235 ). The page should load and say "It Works!".

Step Two: Install MySQL

MySQL is a database management system. Let's install MySQL on Ubuntu. Type these commands:

sudo apt-get install mysql-server php5-mysql

During the install, MySQL will request for you to setup a password.

Once that has been installed, run these commands:

sudo mysql_install_db

Then write:

sudo /usr/bin/mysql_secure_installation

Step Three: Install PHP

Now write these commands:

sudo apt-get install php5 libapache2-mod-php5 php5-mcrypt

Done.

  • Web Servers, Ubuntu, PHP, MySQL and MariaDB
  • 0 Users Found This Useful
Was this answer helpful?

Related Articles

Installing Ubuntu Server on Drives Larger Than 2 TB

The following tutorial requires a motherboard that is EFI compatible (most boards since 2012 are...

Enabling root user in Ubuntu

Instructions on how to enable root user in a newly installed Ubuntu server. The root user in...

Install MailCatcher On Ubuntu 14

Introduction MailCatcher is a tool that provides an easy way for developers to inspect emails...

Install PostgreSQL On Ubuntu 14

Introduction PostgreSQL is the world's most advanced open source Relational Database Management...

How to install PLESK on centOS & Ubuntu

InstallationThis is a guide on how to install PLESK. On centOS, Ubuntu. This command automates...