as a webdeveloper this was my first priority to install. a lot of people say that linux is hard to use, but installing lamp on an ubuntu installation is not hard at all, it’s a heck lot easier than installing in windows, lesser ticks and tacks to make it work. once installed, you’ll be confident that it’s gonna run properly.

so what is lamp? it is Linux Apache MySQL and PHP.

Installing LAMP On Ubuntu For Newbies | HowtoForge – Linux Howtos and Tutorials

Update your Sources

sudo apt-get update

Install Apache and PHP5
in the terminal

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

Refresh Apache then try it on
again, nowhere else

sudo /etc/init.d/apache2 restart

then in your browser open this address

 http://localhost/

and if you have your machine on a local network try this address on another computer in the same network.

http://{your_machine_name}/

Try PHP too
create a php file, in your terminal

gksudo gedit /var/www/test.php

copy and paste this in the newly opened gedit

<?php phpinfo(); ?>

now open it up in your web browser

http://localhost/testphp.php

Install MySQL
once again in the terminal

 sudo apt-get install mysql-server

to allow other computers in the network to get access to mysql, edit my.cnf

gksudo gedit /etc/mysql/my.cnf

and change this line, using your ip address

bind-address = 127.0.0.1

Set MySQL password 

mysql -u root

the prompt should change to mysql>, then enter the following

SET PASSWORD FOR ‘root’@'localhost’ = PASSWORD(‘yourpassword’);

Install PHPMyAdmin
this is a great tool for managing databases, it’s web based, so you’ll be using the web browser with this one.

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

and now to make PHP work with MySQL

gksudo gedit /etc/php5/apache2/php.ini

look for this line, and remove the semicolon.

;extension=mysql.so

Again, refresh Apache, then your Done.

sudo /etc/init.d/apache2 restart

13 Responses to “HOWTO install LAMP on ubuntu feisty fawn”

  1. KirkH Says:

    Thank you! The LAMP option in the server setup stopped working for me for some reason. Doing it by hand is probably a better idea from a learning standpoint anyway.

  2. bryan Says:

    very nice walk through, best on the web that i have seen

  3. browned off Says:

    I have been through every tutorial, website, blog, thread and FAQ and I am still no further forward. All the instructions above I have followed, the browser still tries to open the script via the text editor. I have installed, uninstalled, re-installed and done ALL that ten times over. It ain’t gonna work. Its a spanking new Dell 530. I already have LAMP running on a 1.2Ghz AMD box, no problem. I have checked the apache server and it runs no problem. I have pulled php5 from the repository, mysql is installed I can create databases to they come outta my ears, but I can’t execute a php script… Last chance before I wipe this and put XP Pro on it… 10 days and no success.


  4. [...] Make a LAMP server by following the instructions on this page: Installing a LAMP server on Ubuntu Feisty Fawn [...]

  5. patambrosio Says:

    @browned off, what exactly is happening on your machine? what errors are you getting?


  6. [...] Make a LAMP server by following the instructions on this page: Installing a LAMP server on Ubuntu Feisty Fawn [...]

  7. Luke Says:

    I’m having the same problem as “browned off”. When I navigate my browser to a php file on my server, it tries to make me download it instead of executing it.

  8. MJ King Says:

    phymyadmin is not installing.. Everything else was perfect.

    ubuntu 6.06.1 LTS
    mj@ub-server:~$ sudo apt-get install libapache2-mod-auth-mysql php5-mysql phpmyadmin
    Reading package lists… Done
    Building dependency tree… Done
    E: Couldn’t find package phpmyadmin

    I am confused… everything else was beautiful … clean and fast

  9. patambrosio Says:

    @MJ King, are you sure you got your sources right? i can still see phpmyadmin in the ubuntu repos, it’s here -> http://packages.ubuntu.com/cgi-bin/search_packages.pl?keywords=phpmyadmin&searchon=names&subword=1&version=gutsy&release=all

  10. MJ King Says:

    Sources file read:
    deb http://us.archive.ubuntu.com/ubuntu/ dapper main restricted
    deb-src http://us.archive.ubuntu.com/ubuntu/ dapper main restricted

    I changed it to:
    deb http://us.archive.ubuntu.com/ubuntu dapper main restricted universe multiverse
    deb-src http://us.archive.ubuntu.com/ubuntu dapper main restricted universe multiverse

    and got the same error. Suggestions?

    Thanks

  11. baworz Says:

    nice tutorial, good job

  12. Darklord Says:

    same happening to me i installed using

    sudo apt-get install php5

    and

    sudo apt-get install apache2

    but when try

    http://localhost/hello.php ( )

    firefox says to download that php file . same happens with other browser

    do i hav to start php with any command in terminal?


Leave a Reply