944,120 Members | Top Members by Rank

Ad:
  • PHP Discussion Thread
  • Unsolved
  • Views: 18045
  • PHP RSS
You are currently viewing page 1 of this multi-page discussion thread
May 12th, 2007
0

How to install a Debian LAMP Server

Expand Post »
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!
Similar Threads
Moderator
Featured Poster
Reputation Points: 1800
Solved Threads: 575
Moderator
jbennet is offline Offline
16,534 posts
since Apr 2005
May 13th, 2007
0

Re: How to install a Debian LAMP Server

Danceinstructor, you said that

Quote ...
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
Moderator
Featured Poster
Reputation Points: 1800
Solved Threads: 575
Moderator
jbennet is offline Offline
16,534 posts
since Apr 2005
May 14th, 2007
0

Re: How to install a Debian LAMP Server

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.
Reputation Points: 17
Solved Threads: 14
Posting Whiz
DanceInstructor is offline Offline
355 posts
since Feb 2005
May 15th, 2007
0

Re: How to install a Debian LAMP Server

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 3:17 am.
Moderator
Featured Poster
Reputation Points: 1800
Solved Threads: 575
Moderator
jbennet is offline Offline
16,534 posts
since Apr 2005
Jun 7th, 2007
0

Re: How to install a Debian LAMP Server

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.
Reputation Points: 15
Solved Threads: 5
Junior Poster in Training
TopDogger is offline Offline
87 posts
since Aug 2005
Jun 7th, 2007
0

Re: How to install a Debian LAMP Server

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
PHP Syntax (Toggle Plain Text)
  1. ifconfig
. 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 6:08 pm.
Moderator
Featured Poster
Reputation Points: 1800
Solved Threads: 575
Moderator
jbennet is offline Offline
16,534 posts
since Apr 2005
Apr 16th, 2008
0

Re: How to install a Debian LAMP Server

if you want a GUI just do

apt-get install xorg gnome gdm

reboot then type startx if it doesnt come up automatically.
Moderator
Featured Poster
Reputation Points: 1800
Solved Threads: 575
Moderator
jbennet is offline Offline
16,534 posts
since Apr 2005
Apr 17th, 2008
0

Re: How to install a Debian LAMP Server

just drop your content in /var/www by the way.

index.php

PHP Syntax (Toggle Plain Text)
  1.  
  2. <?php
  3. phpinfo();
  4. ?>

go to http://(hostname)/phpmyadmin to configure the database
Last edited by jbennet; Apr 17th, 2008 at 8:56 am.
Moderator
Featured Poster
Reputation Points: 1800
Solved Threads: 575
Moderator
jbennet is offline Offline
16,534 posts
since Apr 2005
Apr 17th, 2008
0

Re: How to install a Debian LAMP Server

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
Reputation Points: 10
Solved Threads: 5
Posting Pro in Training
bondi007 is offline Offline
406 posts
since Apr 2007
Apr 17th, 2008
0

Re: How to install a Debian LAMP Server

did you set the mysql password with

Quote ...
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
Moderator
Featured Poster
Reputation Points: 1800
Solved Threads: 575
Moderator
jbennet is offline Offline
16,534 posts
since Apr 2005

This thread is more than three months old

No one has posted to this discussion for at least three months. Please let old threads die and do not reply to them unless you feel you have something new and valuable to contribute that absolutely must be added to make the discussion complete. Otherwise, please start a new thread in this forum instead.
Message:
Previous Thread in PHP Forum Timeline: find and replace system
Next Thread in PHP Forum Timeline: creating autoresponder with php





About Us | Contact Us | Advertise | Acceptable Use Policy
Forum Index | Build Custom RSS Feed


Follow us on Twitter


© 2011 DaniWeb® LLC