Options For This Howto
Free Support
P aid Support
Navigation
H owtos
L inux
C entO S
D ebian
Fedora
Kernel
M andriva
P C L inuxO S
SuSE
U buntu
A pac he
Bac kup
C ontrol P anels
D N S
D es ktop
E mail
A nti-Spam/V irus
P os tfix
P roc mail
Sendmail
FT P
H igh-A vailability
L ighttpd
M onitoring
M ySQ L
P rogramming
C /C ++
P H P
Samba
Sec urity
A nti-Spam/V irus
V irtualization
O ther
FreeBSD
Subscription
Contribute
Search
News
Forums
Howtos
Installing LAMP On Ubuntu For Newbies | HowtoF...
http://www.howtoforge.com/ubuntu_lamp_for_newbies
1 of 12
26.10.2008 17:08
C ommerc ial
M ini-H owtos
Forums
C ontribute
Subs c ription
L ogin
Site M ap/RSS Feeds
User login
U s ername:
P as s word:
Remember M e?
C reate a new ac c ount
Reques t new pas s word
Who's online
T here are c urrently 1 4 us ers and 2 0 2 6 gues ts online.
HowtoForge Forums
Show us ernames on
SA RG reports
I SP c onfig ins tall
arc hive virus
godaddy migration
to pos tfix
I s pC onfig Remoting
Framework
I ns tallation
pos tfix error
T he P erfec t
D es ktop - O penSU SE
1 1 (G N O M E )
P roblem pos tfix
H ow about a thank
you area?
V is ta s idebar
gadget
I P and D N S
Installing LAMP On Ubuntu For Newbies | HowtoF...
http://www.howtoforge.com/ubuntu_lamp_for_newbies
2 of 12
26.10.2008 17:08
A s s is tanc e
required
News
T he G reat 3 G L etdown
Ridic ulous Res umes - U nix, L inux and everything in between
What the H igh P riority Free Software P rojec ts Should Be
T es t Firefox 3 .1 Beta 1 Without C hanging Y our E xis ting I ns tallation
M ic ros oft makes moc kery of interoperability
M y Firefox 3 experienc e
L inux inc ognito part two: Windows XP
Jilted L over Jailed for Rubbing O ut E x's A vatar
Fedora 1 0 beta s naps hot 2 : Sc reens hots
3 C las s ic Firs t-P ers on Shooter G ames for L inux
more
Recent comments
c hanges in apac he2 .2
3 hours 5 7 min ago
grac ias
1 0 hours 4 1 min ago
i had a problem
1 1 hours 5 2 min ago
I ns tall 6 4 -bit U buntu H H P V D omU with V N C at U buntu H H D om0
1 day 3 3 min ago
G reat tutorial
1 day 1 hour ago
Flas h P layer 1 0 on U buntu 6 4
1 day 1 1 hours ago
Re: Why not us e 8 .1 0 � 3 9 ;s flas hplugin-nonfre e pac kage for 6 4 -bit?
1 day 1 6 hours ago
try..ec ho "deb
1 day 1 6 hours ago
Re: Why not us e 8 .1 0 � 3 9 ;s flas hplugin-nonfre e pac kage for 6 4 -bit?
1 day 1 8 hours ago
Sec ure P roxy
1 day 2 3 hours ago
Newsletter
Subscribe to
HowtoForge
Newsletter
and s tay informed
Installing LAMP On Ubuntu For Newbies | HowtoF...
http://www.howtoforge.com/ubuntu_lamp_for_newbies
3 of 12
26.10.2008 17:08
about our lates t
H O WT O s and
projec ts .
(T o uns ubs c ribe
from our news letter
s end a blank email
with the s ubjec t
'uns ubs c ribe' to:
news letter
@howtoforge.c om
.)
Syndicate
H owtoForge Feed for Fac ebook®
"Facebook" is a registered trademark of Facebook, Inc. All rights reserved.
English |
Deutsch
|
Site Map/RSS Feeds
|
Advertise
You are here:
Home
»
Howtos
»
Linux
»
Ubuntu
» Installing LAMP On Ubuntu For Newbies
Installing LAMP On Ubuntu For Newbies
Submitted by
Cargoship
(
Contact Author
) (
Forums
) on Fri, 2007-07-13 15:57. ::
Ubuntu
Installing LAMP On Ubuntu For Newbies
I n this guide I will s how you how to ins tall a L A M P s ys tem. L A M P s tands for Linux, A pac he,
MySQ L , PH P . T he guide is intended to help thos e who have very little knowlegde of us ing
L inux.
Install Apache
T o s tart off we will ins tall A pac he.
1 . O pen up the T erminal (Applications > Accessories > Terminal).
2 . C opy/P as te the following line of c ode into T erminal and then pres s enter:
sudo apt-get install apache2
Installing LAMP On Ubuntu For Newbies | HowtoF...
http://www.howtoforge.com/ubuntu_lamp_for_newbies
4 of 12
26.10.2008 17:08
3 . T he T erminal will then as k you for you're pas s word, type it and then pres s enter.
Testing Apache
T o make s ure everything ins talled c orrec tly we will now tes t A pac he to ens ure it is working
properly.
1 . O pen up any web brows er and then enter the following into the web addres s :
http://localhost/
Y ou s hould s ee a folder entitled apache2-default/. O pen it and you will s ee a mes s age s aying
"I t works ! " , c ongrats to you!
Install PHP
I n this part we will ins tall P H P 5 .
Step 1 . A gain open up the T erminal (Applications > Accessories > Terminal).
Step 2 . C opy/P as te the following line into T erminal and pres s enter:
sudo apt-get install php5 libapache2-mod-php5
Step 3 . I n order for P H P to work and be c ompatible with A pac he we mus t res tart it. T ype the
following c ode in T erminal to do this :
sudo /etc/init.d/apache2 restart
Test PHP
T o ens ure there are no is s ues with P H P let's give it a quic k tes t run.
Step 1 . I n the terminal c opy/pas te the following line:
sudo gedit /var/www/testphp.php
T his will open up a file c alled phptest.php.
Step 2 . C opy/P as te this line into the phptes t file:
<?php phpinfo(); ?>
Step 3 . Save and c los e the file.
Step 4 . N ow open you're web brows er and type the following into the web addres s :
Installing LAMP On Ubuntu For Newbies | HowtoF...
http://www.howtoforge.com/ubuntu_lamp_for_newbies
5 of 12
26.10.2008 17:08
http://localhost/testphp.php
T he page s hould look like this :
T es t P H P P age
C ongrats you have now ins talled both A pac he and P H P !
Install MySQL
T o finis h this guide up we will ins tall M ySQ L . (N ote - O ut of A pac he and P H P , M ySQ L is the
mos t diffic ult to s et up. I will provide s ome great res ourc es for anyone having trouble at the
end of this guide.)
Step 1 . O nc e again open up the amazing T erminal and then c opy/pas te this line:
sudo apt-get install mysql-server
Step 2 (optional). I n order for other c omputers on your network to view the s erver you have
c reated, you mus t firs t edit the "Bind A ddres s ". Begin by opening up T erminal to edit the
my.cnf
file.
gksudo gedit /etc/mysql/my.cnf
C hange the line
bind-address = 127.0.0.1
A nd c hange the 127.0.0.1 to your I P addres s .
Step 3 . T his is where things may s tart to get tric ky. Begin by typing the following into
T erminal:
mysql -u root
Following that c opy/pas te this line:
mysql> SET PASSWORD FOR 'root'@'localhost' = PASSWORD('yourpassword');
(M ake s ure to c hange yourpassword to a pas s word of your c hoic e.)
Step 4 . We are now going to ins tall a program c alled phpM yA dmin whic h is an eas y tool to
edit your databas es . C opy/pas te the following line into T erminal:
sudo apt-get install libapache2-mod-auth-mysql php5-mysql phpmyadmin
A fter that is ins talled our next tas k is to get P H P to work with M ySQ L . T o do this we will
Installing LAMP On Ubuntu For Newbies | HowtoF...
http://www.howtoforge.com/ubuntu_lamp_for_newbies
6 of 12
26.10.2008 17:08
need to open a file entitled php.ini. T o open it type the following:
gksudo gedit /etc/php5/apache2/php.ini
N ow we are going to have to unc omment the following line by taking out the s emic olon (;).
C hange this line:
;extension=mysql.so
T o look like this :
extension=mysql.so
N ow jus t res tart A pac he and you are all s et!
sudo /etc/init.d/apache2 restart
The End
Q uic k note to anyone who enc ountered problems with s etting up the M ySQ L pas s word,
pleas e refer to this page:
M ys qlP as s wordRes et
I applaud everyone who has taken the time to read this guide. T his guide is als o my firs t
ever s o I would love to hear bac k from the public on what you guys think! J us t don't be too
hars h. ;)
I f you have ques tions about ins talling any part of L A M P jus t drop them in the c omment box
and I will do my bes t to help you out.
C opyright © 2 0 0 7 C argos hip
A ll Rights Res erved.
add c omment
|
view as pdf
|
|
Related Tutorials
T he P erfec t Setup - U buntu Feis ty Fawn (U buntu 7 .0 4 )
H ow T o Set U p A n U buntu/D ebian L A M P Server
U buntu L A M P Server With T orrentflux I n V M ware
L A M P I ns tallation O n U buntu 6 .0 6 For L inux N oobs
Pleas e do not us e the comment function to as k for help! I f you need help, pleas e us e our
Installing LAMP On Ubuntu For Newbies | HowtoF...
http://www.howtoforge.com/ubuntu_lamp_for_newbies
7 of 12
26.10.2008 17:08
forum
.
Comments will be publis hed after adminis trator approval.
Great tutorial
Submitted by Anonymous (not registered) on Sat, 2008-10-25 15:07.
Everything worked perfectly fist time, thank you very much for a great tutorial.
reply
|
view as pdf
Wonderful article. It helped
Submitted by Anonymous (not registered) on Sun, 2008-10-12 17:26.
Wonderful article. It helped me a lot! Thank you.
reply
|
view as pdf
Minor problems
Submitted by Lagavulin (not registered) on Sun, 2008-10-12 16:08.
Thanks a lot, this was really helpful. However, I encountered some problems on Ubuntu 7.04 which may be
related to previous Apache installations, configurations and deinstallations.
1. Apache complained: "Could not reliably determine the server's fully qualified domain name, using 127.0.1.1
for ServerName"
Solution: Add a directive "ServerName myserver" to apache2.conf and add "127.0.1.1 myserver" to /etc/hosts.
2. http://localhost did not work.
Solution: Apache is listening on port 8081. See ports.conf.
3. Apache did not execute the php testscript but simply served the file.
Solution: I had to activate the php module manually by creating a symbolic link:
$ cd /etc/apache2
$ sudo ln -s ../mods-available/php5.load mods-enabled/php5.load
reply
|
view as pdf
It failes to Restarting web server apache2
Submitted by ZP (not registered) on Sun, 2008-09-21 09:17.
Thanks for the wonderful guide.
I also didn't need to edit php.ini for it was already edited but I couldn't restarting web server apache2.
it says: Unable to resolve host ... and fails !
I'm totally a newbie and I'd appreciate it if you tell me if there is anything wrong.
Thanks in advance
Installing LAMP On Ubuntu For Newbies | HowtoF...
http://www.howtoforge.com/ubuntu_lamp_for_newbies
8 of 12
26.10.2008 17:08
reply
|
view as pdf
Thank you for this
Submitted by Hélio Ã
vora (not registered) on Sat, 2008-09-20 13:21.
Thank you for this tutorial.
It's very good and it's help me to solve all my problems...
Hélio Évora
reply
|
view as pdf
First: Excellent work
Submitted by
Zmetser
(registered user) on Thu, 2008-05-22 11:10.
First: Excellent work dude!
Second: I had to copy phpmyadmin into my document root directory to work http://localhost/phpmyadmin, with
this command in shell:
sudo ln -s /usr/share/phpmyadmin/ /var/www/phpmyadmin
# /usr/share/phpmyadmin/ is the directory where phpmyadmin installed
# /var/www/ is your document root directory
reply
|
view as pdf
Starting mysql
Submitted by
mcmarwa
(registered user) on Sun, 2008-03-02 13:30.
Thanks! This worked very well, with one minor glitch for my particular case. After installing mysql, I needed to
start mysql with:
sudo /etc/init.d mysql start
Then everything else worked.
reply
|
view as pdf
Thanks very much for the
Submitted by
srodden
(registered user) on Sat, 2007-10-06 11:00.
Thanks very much for the howto. i installed on Oct 5 and the php.ini you refered to near the end has no
;extension=mysql.so line to uncomment. Not able to log in using the root and password set earlier but i haven't
spent any time troubleshooting yet.
reply
|
view as pdf
adding desktop GUI
Submitted by
zaphu
(registered user) on Mon, 2007-08-20 04:43.
Installing LAMP On Ubuntu For Newbies | HowtoF...
http://www.howtoforge.com/ubuntu_lamp_for_newbies
9 of 12
26.10.2008 17:08
one can also add the desktop GUI to the server installation by following this guide on
zaphu.com
Enjoy your new
LAMP server!
reply
|
view as pdf
I had problems
Submitted by
aromaman
(registered user) on Sun, 2007-08-19 20:52.
Hi cargoship. I had problems, I'm afraid, and did not manage to get lamp operational. I've posted my questions
on the forum, as requested by the admin. I'm new to Linux so I suspect I'm the problem, not your procedure.
reply
|
view as pdf
command missing after mysql password set
Submitted by
majikins
(registered user) on Tue, 2007-08-07 06:49.
Hi Great howto - thanks! A newbie would not know to type 'exit' after step 3(MySQL section)to get to step 4.
Cheers
reply
|
view as pdf
Thanks for the How-To
Submitted by
douglaslopezt
(registered user) on Sat, 2007-07-28 01:45.
Excelent How-to, very usefull, very simple and efficent. Thanks a lot.
reply
|
view as pdf
Great How-TO!!!!
Submitted by
DJ_Maiko
(registered user) on Wed, 2007-07-18 23:09.
First off, thanks a ton for the awesome how-to. My only question is:
Do I have to be connected to the internet to get all of this started? I ask because I plan to set this up on a
separate machine & I haven't picked up a router/nat yet. So I just want to make sure if I need that in place for
everything to work properly w/out having to re-do it again if I start w/out internet connectivity.
reply
|
view as pdf
Nope you do not need an
Submitted by
Cargoship
(registered user) on Thu, 2007-07-19 09:44.
@DJ_Maiko - Nope you do not need an internet connection to get LAMP to work.
reply
|
view as pdf
Thanks for the comments
Submitted by
Cargoship
(registered user) on Wed, 2007-07-18 14:29.
Installing LAMP On Ubuntu For Newbies | HowtoF...
http://www.howtoforge.com/ubuntu_lamp_for_newbies
10 of 12
26.10.2008 17:08
Thanks for the comments everyone.
@ IronHide - Now just do whatever you want with your brand new installation!
@locutus_of_borg - I re-installed LAMP and it still seems to be in php.ini, but you are right it is also in mysql.ini. I
am not sure it if makes a difference though.
@mihai331 - I think I might edit the guide to explain more the purpose of what people are doing. Like what they
are downloading, and why they would edit this and that. Also maybe a few pictures for extra clarification.
reply
|
view as pdf
now what
Submitted by
IronHide
(registered user) on Tue, 2007-07-17 17:54.
Great article! Easy to follow. Now what?
reply
|
view as pdf
Surely even easier?
Submitted by
ferret99
(registered user) on Tue, 2007-07-17 10:51.
sudo apt-get install apache2 php5 mysql-server phpmyadmin
Worked for me.
reply
|
view as pdf
great guide
Submitted by
locutus_of_borg
(registered user) on Tue, 2007-07-17 10:47.
i followed your guide with my new installation of ubuntu server 7.04 (feisty) and everything worked exactly as
you said.
one small correction in the part where you edit: /etc/php5/apache2/php.ini
it seems, they moved "extension=mysql.so" to /etc/php5/apache2/conf.d/mysql.ini so we dont really need to
bother editing php.ini after all.
thanks for the guide, saved me the trouble of figuring out the correct sequence of packages to install
reply
|
view as pdf
Just went through and it
Submitted by
mihai331
(registered user) on Mon, 2007-07-16 01:32.
Just went through and it worked wonderful.
As a small advice. Maybe you should explain why some things are changed and maybe what other options one
has depending on the purpose.
Great tutorial!
Thanks! :)
reply
|
view as pdf
Installing LAMP On Ubuntu For Newbies | HowtoF...
http://www.howtoforge.com/ubuntu_lamp_for_newbies
11 of 12
26.10.2008 17:08
I am running the 64bit
Submitted by
srodden
(registered user) on Sat, 2007-10-06 11:21.
I am running the 64bit version of Ubuntu 7.04 and I found that I could not log in with phpMyAdmin. It refused
me with an error #1035. A little googling reveals that loading the mcrypt package fixes it.
sudo apt-get install php4-mcrypt
Now I'm in and running fine!
reply
|
view as pdf
Sponsored Links:
Request a Novell/Microsoft migration
Request a Novell/Microsoft migration workshop
Request a
Novell/Microsoft migration workshop and kit
Howtos
|
Mini-Howtos
|
Forums
|
News
|
Search
|
Contribute
|
Subscription
Site Map/RSS Feeds
|
Advertise
|
Contact
|
Disclaimer
|
Imprint
Copyright © 2008 HowtoForge - Linux Howtos and Tutorials
All Rights Reserved.
Installing LAMP On Ubuntu For Newbies | HowtoF...
http://www.howtoforge.com/ubuntu_lamp_for_newbies
12 of 12
26.10.2008 17:08