LAMP is an accronym that stands for '''L'''inux'''A'''pache'''M'''ySQL'''P'''HP these are the components required to run a Dynamic HTML webpage and these are the steps to build a LAMP webserver on a RaspberryPi.

+

==Preamble==

+

'''Over on the forum there's some that say this is an option far too advanced for a noob... If you're feeling adventurous what do you have to loose?''

+

+

+

LAMP is an acronym that stands for '''L'''inux'''A'''pache'''M'''ySQL'''P'''HP these are the components required to run a Dynamic HTML webpage and these are the first steps to build a LAMP webserver on a RaspberryPi.

+

+

If all you want to run is a basic webpage then the update and apache2 is all you need to install. All the other stuff is extras. If however, at some later date, you want to explore the dynamic stuff you're going to need PHP and, at some point, MySQL.

+

+

If you want to explore the option of having forms on your web pages posting you e-mails of the filled in data you're going to need postfix (and the faf of setting this up).

+

+

If you want to try incorporating Java (and I have not tried this) you need tomcat.

+

+

If you're interested in trying out an FTP server you're going to need vsftpd or somthing like it. (there's a faf setting this up too)

+

+

Please do not be complacent - most of this stuff will need quite a bit of setting up but these installs will put the software in place and the default setting files ready to edit.

+

+

There's voices on the forum say I am opening up a "world of pain" for the noobs; I will be interested in the noob viewpoint.

+

+

==I would say "Caveat Emptor" but then it's free so is supect it's just "Caveat"==

+

+

This assumes you have a Raspberry Pi which is working (i.e you can either view it and interact with it using HDMI/Keyboard & mouse) OR you have set it up and can "SSH" into the computer.

+

+

Either way, you have to access the command line. If you're SSH'ing into the Raspberry Pi, do the following:

Then enter the following commands (enter each line, followed by the return key. Some commands can take longer than others to complete. Some may ask you to press Y to continue.

−

Image Wheezy

−

sort raspi-config

−

login:pi

−

password:raspberry #unless you have changed it

sudo su

sudo su

−

apt-get update

+

apt-get update && apt-get upgrade

−

apt-get install apache2

+

apt-get install apache2 php5 mysql-client mysql-server tomcat6 vsftpd

−

apt-get install php5

+

−

apt-get install mysql-client mysql-server

+

−

apt-get install postfix

+

−

apt-get install tomcat6

+

−

apt-get install vsftpd

+

cd /var/www

cd /var/www

−

pico index.html

+

nano index.html

−

do a bit of editing to personalise the file

+

−

[Ctrl][x]

+

−

[y]

+

−

[Enter]

+

−

figure out the IP of theRPi assigned by DHCP

+

The last command allows you to edit the default and basic page. Change the contents (if you wish) and press

−

put that IP address into your browser

+

CTRL + O (press Y)

−

LAMP achieved

+

CTRL + X

−

Ok there's a load of editing to get the FTP working (but it does) and there's the stuff to get postfix sorted but it fit's on a 2g SD card and I don't think you will get a lot of web space stick it on a 4g give yourself some room.

+

Now you can go to a web browser on another computer, and enter the Raspberry Pi's IP address as the address, and you now have a working server!

+

+

To test that PHP is working, I suggest heading back into the terminal and typing the following:

+

+

sudo nano /var/www/test.php

+

+

In this document, enter the following:

+

+

<?php

+

phpinfo();

+

?>

+

+

Again, to exit this document, do the following:

+

+

CTRL + O (press Y)

+

CTRL + X

+

+

And again, head to your web browser, enter the Pi's IP address, followed by /test.php (i.e http://192.168.1.10/test.php)

+

+

Ok there's a load of editing to get the FTP working (but it does) and there's the stuff to get postfix sorted but it fit's on a 2GB SD card and I don't think you will get a lot of web space stick it on a 4GB give yourself some room.

In addition i've got fixed IP sorted so I can port forward with confidence and there should be room to get a No-ip patch running but thats borderline on space.

In addition i've got fixed IP sorted so I can port forward with confidence and there should be room to get a No-ip patch running but thats borderline on space.

−

Nearly forgot Win32DiskImage read to create a new image file so you don't need to do it all again.

+

Nearly forgot Win32DiskImage read to create a new image file so you don't need to do it all again.

==Here is an explination for our Noob readers.==

==Here is an explination for our Noob readers.==

Image Wheezy

Image Wheezy

−

I hope you know that this is about preparing your SD card for the comming events 2g will do 4g better

+

I hope you know that this is about preparing your SD card for the coming events 2GB will do, 4GB better

sort raspi-config

sort raspi-config

Line 42:

Line 75:

password:raspberry #unless you have changed it

password:raspberry #unless you have changed it

−

Yes if you changed the password when you were in raspi-config you will need tto use that new password

+

Yes if you changed the password when you were in raspi-config you will need to use that new password

sudo su

sudo su

Line 65:

Line 98:

At this point you have a LAMP install '''L'''inux'''A'''pache'''M'''ySQL'''P'''HP but to be fair you need some other stuff to help

At this point you have a LAMP install '''L'''inux'''A'''pache'''M'''ySQL'''P'''HP but to be fair you need some other stuff to help

−

−

apt-get install postfix

−

−

This is the mail server stuff

apt-get install tomcat6

apt-get install tomcat6

Line 80:

Line 109:

cd /var/www

cd /var/www

−

Change Directory to /var/www note the slash direction and the leading slash and the space after cd

+

Change Directory to /var/www Note the slash direction, the leading slash and the space after cd

do a bit of editing to personalise the file index.html in the www dirctory is the automatically added test page for Apache2 if you type some new stuff in here when you do hit the page from a browser you will know you have the right page and it's worked because you will see the text you added.

+

do a bit of editing to personalise the file index.html in the www directory by default this is the automatically added test page for Apache2. If you type some new stuff in here then when you load the page from a browser you will know you have the right page and it's worked because you will see the text you added.

[Ctrl][x]

[Ctrl][x]

Line 94:

Line 123:

[y]

[y]

−

conformation

+

confirmation

[Enter]

[Enter]

Line 102:

Line 131:

==What to do next==

==What to do next==

−

Now you need to figure out the IP of the RPi assigned by DHCP if you have a HDMI or Composite monitor it's on one of the last lines as you boot if you have come to this page because you completed the blind login you will know the IP it's the address you typed ito Putty.

+

Now you need to figure out the IP of the RPi assigned by DHCP. If you have a HDMI or Composite monitor it's on one of the last lines as you boot; if you have come to this page because you completed the blind login you will know the IP as it's the address you typed into Putty.

−

Type that IP address into your browser (It must be one on a computer attached digitaly or physically to the same router as your RaspberryPi this is intranet not internet that slight change in spelling iplies you are inside the router barrier.

+

Type that IP address into your browser. Note, it must be on a computer attached digitally or physically to the same router as your RaspberryPi as this is your intranet, not the internet - that slight change in spelling implies you are inside the router barrier.

−

LAMP achieved

+

LAMP achieved!

−

Ok there's a load of editing to get the FTP working (but it does I got it working with FileZilla) and there's the stuff to get postfix sorted but it fit's on a 2g SD card and I don't think you will get a lot of web space stick it on a 4g give yourself some room.

+

Ok there's a load of editing to get the FTP working (but it does I got it working with FileZilla) and there's the stuff to get postfix sorted but it fit's on a 2GB SD card and I don't think you will get a lot of web space stick it on a 4GB give yourself some room.

In addition I have got fixed IP sorted so I can port forward with confidence and there should be room to get a No-ip patch running but thats borderline on space.

In addition I have got fixed IP sorted so I can port forward with confidence and there should be room to get a No-ip patch running but thats borderline on space.

−

My No-IP runs on my big (Lauughs 80g) Ubuntu server.

+

My No-IP runs on my big (Laughs 80GB) Ubuntu server.

Port forwarding is something very Router/Hub specific but if you do manage it then your LAMP will shine on the Internet

Port forwarding is something very Router/Hub specific but if you do manage it then your LAMP will shine on the Internet

Line 119:

Line 148:

Nearly forgot shut down take out your SD card and use Win32DiskImage read to create a new image file''' REMEMBER GIVE IT A NEW NAME''' so you don't need to do it all again

Nearly forgot shut down take out your SD card and use Win32DiskImage read to create a new image file''' REMEMBER GIVE IT A NEW NAME''' so you don't need to do it all again

Revision as of 07:49, 20 May 2013

Contents

Preamble

'Over on the forum there's some that say this is an option far too advanced for a noob... If you're feeling adventurous what do you have to loose?

LAMP is an acronym that stands for LinuxApacheMySQLPHP these are the components required to run a Dynamic HTML webpage and these are the first steps to build a LAMP webserver on a RaspberryPi.

If all you want to run is a basic webpage then the update and apache2 is all you need to install. All the other stuff is extras. If however, at some later date, you want to explore the dynamic stuff you're going to need PHP and, at some point, MySQL.

If you want to explore the option of having forms on your web pages posting you e-mails of the filled in data you're going to need postfix (and the faf of setting this up).

If you want to try incorporating Java (and I have not tried this) you need tomcat.

If you're interested in trying out an FTP server you're going to need vsftpd or somthing like it. (there's a faf setting this up too)

Please do not be complacent - most of this stuff will need quite a bit of setting up but these installs will put the software in place and the default setting files ready to edit.

There's voices on the forum say I am opening up a "world of pain" for the noobs; I will be interested in the noob viewpoint.

I would say "Caveat Emptor" but then it's free so is supect it's just "Caveat"

This assumes you have a Raspberry Pi which is working (i.e you can either view it and interact with it using HDMI/Keyboard & mouse) OR you have set it up and can "SSH" into the computer.

Either way, you have to access the command line. If you're SSH'ing into the Raspberry Pi, do the following:

Ok there's a load of editing to get the FTP working (but it does) and there's the stuff to get postfix sorted but it fit's on a 2GB SD card and I don't think you will get a lot of web space stick it on a 4GB give yourself some room.

In addition i've got fixed IP sorted so I can port forward with confidence and there should be room to get a No-ip patch running but thats borderline on space.

Nearly forgot Win32DiskImage read to create a new image file so you don't need to do it all again.

Here is an explination for our Noob readers.

Image Wheezy

I hope you know that this is about preparing your SD card for the coming events 2GB will do, 4GB better

sort raspi-config

This is primarily about making all of the SD card available (resizing thing) there's a wiki page of its own on this step.

login:pi
password:raspberry #unless you have changed it

Yes if you changed the password when you were in raspi-config you will need to use that new password

sudo su

Make yourself root the super user for the duration of this session.

apt-get update

Get the updates for the install program some of the later installs won't happen if you do not do this.

apt-get install apache2

Install the web host software Apache current version is 2

apt-get install php5

Install a version of PHP current version is 5

apt-get install mysql-client mysql-server

Install the MySQL stuff

At this point you have a LAMP install LinuxApacheMySQLPHP but to be fair you need some other stuff to help

apt-get install tomcat6

This is server side Java

apt-get install vsftpd

This is a FTP Host

cd /var/www

Change Directory to /var/www Note the slash direction, the leading slash and the space after cd

do a bit of editing to personalise the file index.html in the www directory by default this is the automatically added test page for Apache2. If you type some new stuff in here then when you load the page from a browser you will know you have the right page and it's worked because you will see the text you added.

[Ctrl][x]

Command to exit pico

[y]

confirmation

[Enter]

execute command as Picard would say "Make it so"

What to do next

Now you need to figure out the IP of the RPi assigned by DHCP. If you have a HDMI or Composite monitor it's on one of the last lines as you boot; if you have come to this page because you completed the blind login you will know the IP as it's the address you typed into Putty.

Type that IP address into your browser. Note, it must be on a computer attached digitally or physically to the same router as your RaspberryPi as this is your intranet, not the internet - that slight change in spelling implies you are inside the router barrier.

LAMP achieved!

Ok there's a load of editing to get the FTP working (but it does I got it working with FileZilla) and there's the stuff to get postfix sorted but it fit's on a 2GB SD card and I don't think you will get a lot of web space stick it on a 4GB give yourself some room.

In addition I have got fixed IP sorted so I can port forward with confidence and there should be room to get a No-ip patch running but thats borderline on space.

My No-IP runs on my big (Laughs 80GB) Ubuntu server.

Port forwarding is something very Router/Hub specific but if you do manage it then your LAMP will shine on the Internet

It is unlikely to be bright at this time but shine it will.

Nearly forgot shut down take out your SD card and use Win32DiskImage read to create a new image file REMEMBER GIVE IT A NEW NAME so you don't need to do it all again