Last Updated: February 25, 2016
·
9.3K
· muszynskis

Ubuntu 12.04: Installing Apache2 + PHP5 + MySQL + phpMyAdmin

0) At the beginning

sudo apt-get update

1) Install Apache2

sudo apt-get install apache2

1.1) Change DocumentRoot (optional)

sudo vi /etc/apache2/sites-available/default

Update /var/www to your path in line:

DocumentRoot /var/www

and repeat it in line:

<Directory /var/www/>

1.2) Restart Apache2

sudo service apache2 restart

2) Install PHP5

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

3) Install MySQL

sudo apt-get install mysql-server

4) Install phpMyAdmin

sudo apt-get install phpmyadmin

2 Responses
Add your response

How does this differ from sudo apt-get install lamp-server^ then sudo apt-get install phpmyadmin

over 1 year ago ·

It doesn't differ, but personally I prefer to install each component individually.

What's important and worth knowing:

To uninstall your lamp-server you would probably enter something like this:

sudo apt-get remove lamp-server^

Unfortunately, the above command removes also openssh-server (you can’t login to your remote server via SSH without it).

To uninstall the most important packages of lamp-server you should enter this command:

sudo apt-get purge mysql-server apache2 php5

And if you want to completely uninstall your LAMP, try this:

sudo apt-get remove apache2 apache2-mpm-prefork apache2-utils apache2.2-common libapache2-mod-php5 libapr1 libaprutil1 libdbd-mysql-perl libdbi-perl libmysqlclient15off libnet-daemon-perl libplrpc-perl libpq5 mysql-client-5.0 mysql-common mysql-server mysql-server-5.0 php5-common php5-mysql

Read more: How to remove the LAMP stack

over 1 year ago ·