Installing Apache, MySQL, PHP (LAMP) on Ubuntu 14.04 Print

  • 0

What is LAMP?

LAMP named as an acronym of the names of its components: Linux, Apache, MySQL and PHP.

Before Installing

We need to update our system to make sure that our system is currently using updated repositories and PPAs.

# sudo apt-get update

1. Install Apache HTTP Server

# sudo apt-get install apache2

Note: To check if Apache HTTP Server is running, visit your server's IP address using your web browser.

2. Install MySQL

# sudo apt-get install mysql-server php5-mysql

First, we need to create the database directory where it will store its information.

# sudo mysql_install_db

Then, we need to run this Simple Security System. In this step you will be asked to change your MySQL root password, remove anonymous user accounts, remove test databases, and disable remote root login.

# sudo mysql_secure_installation

3. Install PHP

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

We need to make Apache search for PHP files first:

# sudo nano /etc/apache2/mods-enabled/dir.conf

Directory Config should look like this:

<IfModule mod_dir.c>
    DirectoryIndex index.html index.cgi index.pl index.php index.xhtml index.htm
</IfModule>

We need to move index.php after DirectoryIndex. Then, it should look like this:

<IfModule mod_dir.c>
    DirectoryIndex index.php index.html index.cgi index.pl index.xhtml index.htm
</IfModule>

In order for our changes to be recognized, we need to restart our Apache:

# sudo service apache2 restart

Congratulations! You have now set up and configured a simple LAMP environment.

Was this answer helpful?

« Back