PDA

View Full Version : LAMP local server installation on Ubuntu 8.04 Hardy Heron.


sanus|art
May 27th, 2008, 08:38 PM
[1] - Installation:

This will install 'Apache 2', 'php5', 'MySQL' and 'phpMyAdmin' (if you need php4 rather than php5 - just change 5's to 4's in the code bellow):


sudo apt-get install apache2 php5 libapache2-mod-php5 mysql-server libapache2-mod-auth-mysql php5-mysql phpmyadmin
NOTE ! You'll be asked to provide SQL password durring the MySQL installation.

[2] - Configure:
Add 'phpMyAdmin' module to apache:

echo "Include /etc/phpmyadmin/apache.conf" | sudo tee -a /etc/apache2/apache2.conf
NOTE ! If you get 'blowfish password error' in http://localhost/phpmyadmin/ see the second post by antiigrav (http://ubuntuforums.org/showpost.php?p=5160992&postcount=2) in this tread.
NOTE ! the default username is 'root', the default password is whatever you specified at the stage [1] at the MySQL installation.

Edit the file /etc/apache2/httpd.conf (it might be empty - don't worry):


sudo gedit /etc/apache2/httpd.conf
and add this (my username and user group is called 'sasha' - change it to yours):

ServerName localhost
User sasha
Group sasha
This will grant you access as the specified user.

[3] - Testing the installation:
Restart the apache for new setting to be applied:

sudo /etc/init.d/apache2 restart
To test Apache2 installation - point your web browser to:

http://localhost/
You should see page which reads 'It works!'.
To test php installation - create file called test.php in /var/www or type in terminal:

echo '<?php phpinfo(); ?>' | sudo tee /var/www/test.php
and point your web browser to:

http://localhost/test.php
You should see page which tells different php settings like in the picture:
71843
To test phpMyAdmin installation point your web browser to:

http://localhost/phpmyadmin
[4] - Re-configurations (optional):
By default, apache2 is set to listen to port 80 at http://localhost/ while the server's root directory is /var/www.
(a) - to change the port - edit the file /etc/apache2/ports.conf and change the 'Listen 80' to some other number:

sudo gedit /etc/apache2/ports.conf
(for example: if you change 80 to 4747 - you can access the server root by http://localhost:4747/)

(b) - to change the 'server root' - edit the file /etc/apache2/sites-available/default:
back-up the original file:

sudo cp /etc/apache2/sites-available/default /etc/apache2/sites-available/default_backup
... and open the file for editing:

sudo gedit /etc/apache2/sites-available/default
change the content to something like the following:
(this is my settings - I wanted my server to be accessed from 'http://www' while all my web files are located at '/home/sasha/www')

NameVirtualHost *
<VirtualHost *>
ServerName www
DocumentRoot /home/sasha/www
</VirtualHost>
now go to SYSTEM => ADMINISTRATION => NETWORK at the HOST tab select localhost, and add 'www' as it shows in the picture:
71844
Or edit file /etc/hosts
sudo gedit /etc/hosts
Now restart the apache:

sudo /etc/init.d/apache2 restart
Now test it by pointing your web browser to:

http://www
(c) - To add more virtual hosts - just repeat the (b) part with the ServerName and DocumentRoot specification, add the ServerName to SYSTEM => ADMINISTRATION => NETWORK the HOST tab, restart apache.


Hope I didn't forgot/messed things up or worse, if I did - please feel free to correct me.

antiigrav
June 11th, 2008, 12:41 AM
works well thanks.

as mentioned above, to fix initial blowfish error on phpmyadmin startup page:

from /var/lib/phpmyadmin/blowfish_secret.inc.php
copy the line like $cfg['blowfish_secret'] = 'your hash here';
and paste it at the end of /etc/phpmyadmin/config.inc.php

sanus|art
June 11th, 2008, 01:02 AM
Thanks antiigrav,
Didn't noticed the error (did not worked with SQL for about a 6 months), I'll edit the tutorial.

JT9161
June 14th, 2008, 01:59 AM
Thanks for the Tutorial everything works great. But do you how I would set up a part of my site to be password protected ? I know I need a combo of a .htaccess file in /var/www and a .htpasswd file in my private folder but I have no idea how to go about this.

sanus|art
June 14th, 2008, 03:05 AM
Thanks for the Tutorial everything works great. But do you how I would set up a part of my site to be password protected ? I know I need a combo of a .htaccess file in /var/www and a .htpasswd file in my private folder but I have no idea how to go about this.
Basically you need to specify full server path to .htpasswd file in .htaccess, create username/s and encripted password/s and specify protected directory.

Here is some tutorial:
http://www.elated.com/articles/password-protecting-your-pages-with-htaccess/

Here are password encription generator:
http://www.kxs.net/support/htaccess_pw.html

tananaBrian
October 4th, 2008, 01:33 AM
works well thanks.

as mentioned above, to fix initial blowfish error on phpmyadmin startup page:

from /var/lib/phpmyadmin/blowfish_secret.inc.php
copy the line like $cfg['blowfish_secret'] = 'your hash here';
and paste it at the end of /etc/phpmyadmin/config.inc.php

Yes! Thank you! It would have taken me bazillions of years to figure this one out!

Brian
Fox, Alaska... Got snow?

and.duncan
November 9th, 2008, 08:40 PM
Hi,

Just updating for my experience with 8.10:

In [1] after the MySQL password was entered it asked me which web server to automatically configure phpmyadmin in, I selected apache2 and didn't perform the step in [2] nor the added blowfish bit. Step [3] was followed as written and it all seems to work, took 5 mins :) (I'm expecting something to be horribly wrong somewhere... still looking for it)

skym
February 17th, 2009, 11:52 PM
Thanks for the tutorial..however am still having a problem.
When I finish the step and want to test the http://localhost on the browser, it doesnt work.
On the command prompt its giving me this message:
[warn] The Alias directive in /etc/phpmyadmin/apache.conf at line 3 will probably never match because it overlaps an earlier Alias.
What can I do to solve this problem...
plz I need help

sanus|art
February 18th, 2009, 06:50 AM
Could you post the content of your /etc/apache2/sites-avaliable/default and /etc/hosts here?