Installing LAMP Server, phpMyAdmin And Enabling Userdir in Ubuntu 15.10

There are a lot of tutorials covering this subject but most of them not saying all things to you. There are a few things to do more than just installing them, not a big deal but you need to do them to get working. So we are starting with just installing things:

1- Install apache2

sudo apt-get install apache2

2- Install mysql

sudo apt-get install mysql-server mysql-client

3- Install php

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

4- Install phpMyAdmin

sudo apt-get install phpmyadmin

Get phpMyAdmin Working

If the page http://localhost/phpmyadmin works, you are fine. If not, do the following:

Open the apache2.conf file:

gksu gedit /etc/apache2/apache2.conf

And add this line to the end of the file:

Include /etc/phpmyadmin/apache.conf

Then restart apache2:

service apache2 restart

Now http://localhost/phpmyadmin should open without a problem.

Enable UserDir

The default Ubuntu document root is /var/www/html and it’s a root directory. So it’s hard to work with. You can enable public_html directories and use them easily. What you need to do is give this command:

sudo a2enmod userdir

And open php5.conf

sudo gedit /etc/apache2/mods-available/php5.conf

Then change this lines

<IfModule mod_userdir.c>
<Directory /home/*/public_html>
php_admin_flag engine Off

to this:

#<IfModule mod_userdir.c>
#    <Directory /home/*/public_html>
#        php_admin_flag engine Off
#     </Directory>

Now restart the apache2 and you are good to go.

service apache2 restart

Dont forget to create a directory named public_html under your home directory(/home/user_name/public_html). After creating your files under that directory, you can just go in http://localhost/~user_name and see your site.

Leave a Reply

Your email address will not be published. Required fields are marked *