User Name Password Register
DaniWeb IT Discussion Community
All
What is DaniWeb IT Discussion Community?
You're currently browsing the PHP section within the Web Development category of DaniWeb, a massive community of 402,910 software developers, web developers, Internet marketers, and tech gurus who are all enthusiastic about making contacts, networking, and learning from each other. In fact, there are 3,097 IT professionals currently interacting right now! Registration is free, only takes a minute and lets you enjoy all of the interactive features of the site.
Please support our PHP advertiser: Lunarpages PHP Web Hosting
Views: 4642 | Replies: 25
Reply
Join Date: Apr 2005
Location: Old Hampshire, Old England (LOL)
Posts: 11,937
Reputation: jbennet is a jewel in the rough jbennet is a jewel in the rough jbennet is a jewel in the rough jbennet is a jewel in the rough 
Rep Power: 30
Solved Threads: 268
Moderator
Featured Poster
jbennet's Avatar
jbennet jbennet is offline Offline
Microsoft Fanboy

How to install a Debian LAMP Server

  #1  
May 12th, 2007
How to install a Debian LAMP Server

The combination of Linux + Apache + MySQL + PHP setup is known as LAMP

We will be using:

Debian Linux - Operating System

Debian is an opensource operating system, which uses the popular Linux kernel. It is a good choice for servers as it is stable and has an easy to use package manager

Apache - Web server

Apache is one of the most famous web servers and with just few simple commands, you can configure apache to play nicely with PHP.

Note: You put your content /var/www.

MySQL 5 - Database Server


The MySQL database is renownd for its excellent performance, high reliability and ease of use.

PHP5 - Scripting Language

PHP is a common scripting language that is especially suited for Web development and can be easialy embedded into HTML pages and works well with other technogies such as the MySQL database and Apache webserver.

phpMyAdmin - Web-based database administration software.

PhpMyAdmin is an excellent web based database administration tool. Managing databases and tables couldnt any simpler.

Note:

First, lets ensure that the system meets the minimum requirements for Debian and that it has at least 256MB of RAM available. If your machine has less than 256MB ram then it can cause lot of problems and MySQL will give you the error "cannot connect to mysql.sock".

Getting Started:

Debian linux is my favourite for servers as it has the command "apt-get".

This command makes it easy for a beginner to install packages as you dont need to worry about package dependencies or manually creating configuration files.

I will assume that you have already installed debian and have it up and running (very easy). I personally love to use the netinstall cd and install just a base system then use apt-get.

If you wish to access the server remotely through SSH from a windows PC then please download a tool called PuTTY


Install:

Ok, now type (in this order, hit enter at the end of the line) and wait for it to complete. Reboot once all the software is installed

apt-get update

apt-get install apache2 php5 libapache2-mod-php5 mysql-server mysql-client php5-mysql phpmyadmin ssh


Security:

By default the mysql root (superuser) account does not have a password. Set one like this:

mysql -u root
mysql> USE mysql;
mysql> UPDATE user SET Password=PASSWORD('new-password') WHERE user='root';
mysql> FLUSH PRIVILEGES;

You are now ready to roll!
TRY MY SUGGESTIONS AT YOUR OWN RISK!
james.bennet1@ntlworld.com
AddThis Social Bookmark Button
Reply With Quote  
Join Date: Apr 2005
Location: Old Hampshire, Old England (LOL)
Posts: 11,937
Reputation: jbennet is a jewel in the rough jbennet is a jewel in the rough jbennet is a jewel in the rough jbennet is a jewel in the rough 
Rep Power: 30
Solved Threads: 268
Moderator
Featured Poster
jbennet's Avatar
jbennet jbennet is offline Offline
Microsoft Fanboy

Re: How to install a Debian LAMP Server

  #2  
May 13th, 2007
Danceinstructor, you said that

This is good stuff, but shouldn't it be under Web Hosting Tutorials?

i dont know, i submitted it to davey for the PHP tutorials section but he said it wasnt in-depth enough. Fair enough, i dont have a problem with that, i may try to submit it again soon (with additional sections for a: doing a debian netinstall b: checking php/mysql are working and c: securing ssh and maybe adding FTP/samba
TRY MY SUGGESTIONS AT YOUR OWN RISK!
james.bennet1@ntlworld.com
Reply With Quote  
Join Date: Feb 2005
Posts: 354
Reputation: DanceInstructor is an unknown quantity at this point 
Rep Power: 4
Solved Threads: 12
DanceInstructor's Avatar
DanceInstructor DanceInstructor is offline Offline
Posting Whiz

Re: How to install a Debian LAMP Server

  #3  
May 14th, 2007
I think its great. It's to the point and succinct. It makes it look easy (which it is for the most part). If somebody has a problem, then its a good reason for them to post and everyone can benefit from that discussion (and possibly use that info to improve/udate the tutorial).

Although in my opinion this is a "server administratration" tutorial and doesn't really apply to scripters/programmers.
Clear Mind Hosting and Web Design

If I've helped you please consider adding to my reputation.
Reply With Quote  
Join Date: Apr 2005
Location: Old Hampshire, Old England (LOL)
Posts: 11,937
Reputation: jbennet is a jewel in the rough jbennet is a jewel in the rough jbennet is a jewel in the rough jbennet is a jewel in the rough 
Rep Power: 30
Solved Threads: 268
Moderator
Featured Poster
jbennet's Avatar
jbennet jbennet is offline Offline
Microsoft Fanboy

Re: How to install a Debian LAMP Server

  #4  
May 15th, 2007
Oh ok, i just put it there as that was what i used it for (instead of using sopmething like XAMPP i did that that and ran it u nder virtual pc so that i could develop from my windows pc)

i have nearly finished a new version which adds parts on:

installing debian
securing ssh
file transfer to server
bssic sql commands
phpinfo to test if it works
Last edited by jbennet : May 15th, 2007 at 2:17 am.
TRY MY SUGGESTIONS AT YOUR OWN RISK!
james.bennet1@ntlworld.com
Reply With Quote  
Join Date: Aug 2005
Location: somewhere in time
Posts: 71
Reputation: TopDogger is an unknown quantity at this point 
Rep Power: 4
Solved Threads: 3
TopDogger's Avatar
TopDogger TopDogger is offline Offline
Junior Poster in Training

Re: How to install a Debian LAMP Server

  #5  
Jun 7th, 2007
It appears that there is little more to a Debian install than this. I just installed it as a Web server from the downloads on the Debian site.

It appears to work fine as a stand-alone PC, but is not functioning as a server on my network. I cannot even ping it. I've read that all the ports are closed by default with a Debian install, but have not found info regarding what I need to do to complete the Web server setup.

What do I need to know to do this? I'm looking forward to your other tutorials.

Thus far I think Red Hat was much easier to work with.
Reply With Quote  
Join Date: Apr 2005
Location: Old Hampshire, Old England (LOL)
Posts: 11,937
Reputation: jbennet is a jewel in the rough jbennet is a jewel in the rough jbennet is a jewel in the rough jbennet is a jewel in the rough 
Rep Power: 30
Solved Threads: 268
Moderator
Featured Poster
jbennet's Avatar
jbennet jbennet is offline Offline
Microsoft Fanboy

Re: How to install a Debian LAMP Server

  #6  
Jun 7th, 2007
when you installed did you choose the Standdard System option. If not then you dont get the DHCP client.

Also make sure to guve it a proper hostname . NOT LOCALHOST!

go into a command prompt and type . Thats I-F. Post the details here. Also at the command prompt it should say sometuing like

root@(name): $

tell us what the name is
Last edited by jbennet : Jun 7th, 2007 at 5:08 pm.
TRY MY SUGGESTIONS AT YOUR OWN RISK!
james.bennet1@ntlworld.com
Reply With Quote  
Join Date: Apr 2005
Location: Old Hampshire, Old England (LOL)
Posts: 11,937
Reputation: jbennet is a jewel in the rough jbennet is a jewel in the rough jbennet is a jewel in the rough jbennet is a jewel in the rough 
Rep Power: 30
Solved Threads: 268
Moderator
Featured Poster
jbennet's Avatar
jbennet jbennet is offline Offline
Microsoft Fanboy

Re: How to install a Debian LAMP Server

  #7  
Apr 16th, 2008
if you want a GUI just do

apt-get install xorg gnome gdm

reboot then type startx if it doesnt come up automatically.
TRY MY SUGGESTIONS AT YOUR OWN RISK!
james.bennet1@ntlworld.com
Reply With Quote  
Join Date: Apr 2005
Location: Old Hampshire, Old England (LOL)
Posts: 11,937
Reputation: jbennet is a jewel in the rough jbennet is a jewel in the rough jbennet is a jewel in the rough jbennet is a jewel in the rough 
Rep Power: 30
Solved Threads: 268
Moderator
Featured Poster
jbennet's Avatar
jbennet jbennet is offline Offline
Microsoft Fanboy

Re: How to install a Debian LAMP Server

  #8  
Apr 17th, 2008
just drop your content in /var/www by the way.

index.php

<?php
    phpinfo();
?>

go to http://(hostname)/phpmyadmin to configure the database
Last edited by jbennet : Apr 17th, 2008 at 7:56 am.
TRY MY SUGGESTIONS AT YOUR OWN RISK!
james.bennet1@ntlworld.com
Reply With Quote  
Join Date: Apr 2007
Location: Manchester, U.K
Posts: 383
Reputation: bondi007 is an unknown quantity at this point 
Rep Power: 2
Solved Threads: 5
bondi007's Avatar
bondi007 bondi007 is offline Offline
Posting Whiz

Re: How to install a Debian LAMP Server

  #9  
Apr 17th, 2008
When I try to set the password everything seemed to go OK so I restarted my pc and then tried myphp admin without a pass and it would still let you login

Any Ideas?

Also where is the dir where I can drop all my file's etc in to be hosted on apache?


Cheers
Bondi007
I will try and help you even if everyone has given up!

I will not stop! IM BONDI
Reply With Quote  
Join Date: Apr 2005
Location: Old Hampshire, Old England (LOL)
Posts: 11,937
Reputation: jbennet is a jewel in the rough jbennet is a jewel in the rough jbennet is a jewel in the rough jbennet is a jewel in the rough 
Rep Power: 30
Solved Threads: 268
Moderator
Featured Poster
jbennet's Avatar
jbennet jbennet is offline Offline
Microsoft Fanboy

Re: How to install a Debian LAMP Server

  #10  
Apr 17th, 2008
did you set the mysql password with

mysql -u root
mysql> USE mysql;
mysql> UPDATE user SET Password=PASSWORD('new-password') WHERE user='root';
mysql> FLUSH PRIVILEGES;

drop your files into the webroot (ususally somewhere under /var/www)

see post 8
TRY MY SUGGESTIONS AT YOUR OWN RISK!
james.bennet1@ntlworld.com
Reply With Quote  
Reply

Only community members can participate in forum threads. You must register or log in to contribute.

DaniWeb PHP Marketplace
Currently Active Users Viewing This Thread: 1 (0 members and 1 guests)

 

Thread Tools Display Modes

Similar Threads
Other Threads in the PHP Forum

All times are GMT -4. The time now is 3:43 pm.
Forum system based on vBulletin Copyright ©2000 - 2008, Jelsoft Enterprises Ltd.
©2003 - 2008 DaniWeb® LLC