Max

Minimal webserver distribution (Lighty + PHP + SQLite)

Sun Aug 26, 2012 2:11 pm

Created a minimal Linux distribution for those wanting to use a Pi as webserver.
Excluding the kernel it is only 5 MB compressed.

It contains:
  • Lighttpd
  • PHP 5.3.16
  • SQLite
  • SSH for file transfers
  • Supporting applications and libraries (busybox, libcurl, libxml, libjpeg, libpng, etc.)
Includes the following PHP modules.

Code: Select all

date
ereg
libxml
openssl
pcre
zlib
ctype
curl
dom
gd
hash
json
SPL
PDO
pdo_sqlite
Reflection
session
SimpleXML
soap
sockets
SQLite
standard
tokenizer
xml
xmlreader
xmlwriter
zip

To install:
  • Install Berryboot first.

    Image
  • In the "add operating system" window, scroll down to the bottom, select "Berrywebserver" (am open to a better name) and press "ok"
  • Press "exit" to exit berryboot.

    Image
  • Upon starting the first time, you will need to enter the password you would like to use twice.
Image

You can then transfer the files of the website you would like to host from your normal computer to the Pi using a file transfer program like FileZilla.
Make sure you set the protocol to "SFTP"

mrlinux2u
Posts: 215
Joined: Sat Sep 24, 2011 8:38 pm

Re: Minimal webserver distribution (Lighty + PHP + SQLite)

Mon Aug 27, 2012 2:57 pm

@Max,

Hi Max,

Do you have a direct download link for your webserver.img file?

Cheers

mrlinux2u

anotherbloke
Posts: 22
Joined: Sun Jun 17, 2012 10:30 pm

Re: Minimal webserver distribution (Lighty + PHP + SQLite)

Mon Aug 27, 2012 3:09 pm

This is a great idea. I have another raspberry pi on order and a few 64mb sd cards laying around.

Where can i download the image?

Max

Re: Minimal webserver distribution (Lighty + PHP + SQLite)

Mon Aug 27, 2012 3:13 pm

You need to install it through Berryboot.
(Image is in Squashfs format and cannot be dd'ed to a card directly)

mrlinux2u
Posts: 215
Joined: Sat Sep 24, 2011 8:38 pm

Re: Minimal webserver distribution (Lighty + PHP + SQLite)

Mon Aug 27, 2012 3:17 pm

@Max,

OK, that's cool, will install berryboot later on.

Cheers

mrlinux2u

Max

Re: Minimal webserver distribution (Lighty + PHP + SQLite)

Mon Aug 27, 2012 4:27 pm

anotherbloke wrote:This is a great idea. I have another raspberry pi on order and a few 64mb sd cards laying around.
You will need a slightly larger SD card (or a USB stick as secondary storage), because Berryboot reserves exactly 64 mb for the FAT partition that holds the Raspberry firmware and kernel.
Not leaving enough space for the second partition that holds the 5 MB operating system image.

anotherbloke
Posts: 22
Joined: Sun Jun 17, 2012 10:30 pm

Re: Minimal webserver distribution (Lighty + PHP + SQLite)

Mon Aug 27, 2012 5:43 pm

Max wrote:
anotherbloke wrote:This is a great idea. I have another raspberry pi on order and a few 64mb sd cards laying around.
You will need a slightly larger SD card (or a USB stick as secondary storage), because Berryboot reserves exactly 64 mb for the FAT partition that holds the Raspberry firmware and kernel.
Not leaving enough space for the second partition that holds the 5 MB operating system image.
Thanks for letting me know, i was just in the middle of trying a 64mb card. Just using a 128mb card now to see if it works.

Noticed i can try puppy linux as well from that install. Must admit it is very clean and easy to follow.

anotherbloke
Posts: 22
Joined: Sun Jun 17, 2012 10:30 pm

Re: Minimal webserver distribution (Lighty + PHP + SQLite)

Tue Aug 28, 2012 3:06 pm

Works fine with 128mb MMC. I was confused for a few mins as i can install via wireless but i couldn't find wireless so used wired connection instead.

ocopus
Posts: 14
Joined: Fri Aug 17, 2012 3:10 pm

Re: Minimal webserver distribution (Lighty + PHP + SQLite)

Mon Sep 17, 2012 3:54 pm

Anybody know if it's possible to install MySQL on this? Could you just do this by installing phpmyadmin?

Thanks

Max

Re: Minimal webserver distribution (Lighty + PHP + SQLite)

Mon Sep 17, 2012 4:32 pm

MySQL is not supported, as I do not expect it to run properly on a Pi.
When MySQL executes queries containing joins it tends to generate temporary tables, which either requires a lot of memory (not available on the Pi) or it will resort to using temporary files (which you don't want when using a SD card as storage).

Use SQLite instead.

ocopus
Posts: 14
Joined: Fri Aug 17, 2012 3:10 pm

Re: Minimal webserver distribution (Lighty + PHP + SQLite)

Sun Sep 23, 2012 10:58 am

What package manager does this use? (e.g- apt-get)

Thanks

Max

Re: Minimal webserver distribution (Lighty + PHP + SQLite)

Sun Sep 23, 2012 12:06 pm

ocopus wrote:What package manager does this use? (e.g- apt-get)
None.
You simply replace the entire image if you want more software.
Since your website data is kept seperate from the image with the programs, this can be done without dataloss.

http://www.buildroot.net/
In "make menuconfig" choose arm1176jzf-s, squashfs output format, and the software you want (berrywebserver by default has lighttpd, php, sqlite)
After "make", rename resulting image in output/rootfs.squashfs to Berrywebserver.img240 and put it in the /images folder on the second partition of sd card.

jsmith
Posts: 1
Joined: Tue Nov 13, 2012 3:41 am

Re: Minimal webserver distribution (Lighty + PHP + SQLite)

Tue Dec 25, 2012 5:36 pm

Max wrote:
ocopus wrote:What package manager does this use? (e.g- apt-get)
None.
You simply replace the entire image if you want more software.
Since your website data is kept seperate from the image with the programs, this can be done without dataloss.

http://www.buildroot.net/
In "make menuconfig" choose arm1176jzf-s, squashfs output format, and the software you want (berrywebserver by default has lighttpd, php, sqlite)
After "make", rename resulting image in output/rootfs.squashfs to Berrywebserver.img240 and put it in the /images folder on the second partition of sd card.
Hey @Max,
Max, you're saying build Buildroot, right ?
But there is no "make" in this operating system.
How can I "make" the file ?
Please reply soon man !!!! :twisted:

Max

Re: Minimal webserver distribution (Lighty + PHP + SQLite)

Tue Dec 25, 2012 5:53 pm

jsmith wrote:But there is no "make" in this operating system.
Need to cross-compile it using a regular desktop computer running Linux, not on the Pi.

permaband
Posts: 62
Joined: Wed Aug 01, 2012 2:14 pm
Location: uk
Contact: Website

Re: Minimal webserver distribution (Lighty + PHP + SQLite)

Wed Dec 26, 2012 10:13 am

Max wrote:MySQL is not supported, as I do not expect it to run properly on a Pi.
When MySQL executes queries containing joins it tends to generate temporary tables, which either requires a lot of memory (not available on the Pi) or it will resort to using temporary files (which you don't want when using a SD card as storage).

Use SQLite instead.
Now come on! MYSQL works fine on the pi. Its not good form to spread this 'pi is wheezy and can't handle anything' myth chap. Like apache2; if you actually take the time to configure it and set sensible operating resource limits there is absolutely no issue on the pi. My server has been running 5 apache processes, php5 and mysqld and happily vending 1-2000 queries a day for the last 6 months nbd.

I know of at least one high traffic high availability site running on pis: http://networkgeekstuff.com/projects/ne ... pberry-pi/

The 'lighttpd and sqlite' brigade is nonsense when you're only fencing 10-50 visitors at any one time. A well configured pi webserver running apache can handle upwards of one THOUSAND concurrent requests. P sure that covers the vast majority of personal websites.

Subjective opinion here but I have found that the so called advantages of nerding yourself in to a corner disappear rapidly when you factor in all the time you waste trying to understand the crappy documentation of obscure projects vs the world of ready information for major established and well ironed out projects like apache and mysql.

Max

Re: Minimal webserver distribution (Lighty + PHP + SQLite)

Wed Dec 26, 2012 1:13 pm

permaband wrote: I know of at least one high traffic high availability site running on pis: http://networkgeekstuff.com/projects/ne ... pberry-pi/
To be honest with all of you, when I first moved this web (apache/mysql/wordpress/etc..) directly to the RaspberryPI system, I was thinking that this is not the way, loading of the main page of networkgeekstuff.com took 25 seconds without optimization for Raspberry PI. I can imagine that no-one would wait 25 seconds for a webpage. Fortunately for me, the solution was to implement web caching system to my networkgeekstuff.com. This means that most of the pages are pre-computed as a static html webpage and when a user comes, nothing is computed anymore but visitor is served a pre-computed static html
Bad example.
What does serving pre-generated static pages has to do with MySQL performance?

User avatar
cyrano
Posts: 714
Joined: Wed Dec 05, 2012 11:48 pm
Location: Belgium

Re: Minimal webserver distribution (Lighty + PHP + SQLite)

Thu Dec 27, 2012 10:04 am

permaband wrote:
Max wrote:Subjective opinion here but I have found that the so called advantages of nerding yourself in to a corner disappear rapidly when you factor in all the time you waste trying to understand the crappy documentation of obscure projects vs the world of ready information for major established and well ironed out projects like apache and mysql.
+1

I have tested most webservers (although not yet on a RPi) and I couldn't agree more. Some do some things better than others, but staying mainstream has the very definite advantage of being well documented and well supported by the community.

User avatar
Jim JKla
Posts: 2218
Joined: Sun Jan 29, 2012 11:15 pm
Location: Newcastle upon Tyne UK

Re: Minimal webserver distribution (Lighty + PHP + SQLite)

Thu Dec 27, 2012 10:11 am

Hey Max anny chance of writing this up for the wiki it looks like an interesting project for those with minimal resources. ;)
Noob is not derogatory the noob is just the lower end of the noob--geek spectrum being a noob is just your first step towards being an uber-geek ;)

If you find a solution please post it in the wiki the forum dies too quick

Max

Re: Minimal webserver distribution (Lighty + PHP + SQLite)

Thu Dec 27, 2012 12:06 pm

Jim JKla wrote:Hey Max anny chance of writing this up for the wiki it looks like an interesting project for those with minimal resources. ;)
If someone else wants to create documentation, he is welcome to.
Not being a native English speaker, it takes me more effort than others to write large amounts of text.

User avatar
Jim JKla
Posts: 2218
Joined: Sun Jan 29, 2012 11:15 pm
Location: Newcastle upon Tyne UK

Re: Minimal webserver distribution (Lighty + PHP + SQLite)

Thu Dec 27, 2012 12:43 pm

Who said it had to be in English ;)

No mater what your language it will be usefull for somebody. :D
Noob is not derogatory the noob is just the lower end of the noob--geek spectrum being a noob is just your first step towards being an uber-geek ;)

If you find a solution please post it in the wiki the forum dies too quick

Griffen
Posts: 2
Joined: Thu Feb 07, 2013 9:42 pm

Re: Minimal webserver distribution (Lighty + PHP + SQLite)

Thu Feb 07, 2013 9:45 pm

How do i change the ip address to a static one?

Max

Re: Minimal webserver distribution (Lighty + PHP + SQLite)

Thu Feb 07, 2013 10:48 pm

Griffen wrote:How do i change the ip address to a static one?
Switch over to tty2 (ctrl+alt+f2) and do "vi /etc/network/interfaces"
Syntax of the interfaces file is the same as on Debian based distributions.

Griffen
Posts: 2
Joined: Thu Feb 07, 2013 9:42 pm

Re: Minimal webserver distribution (Lighty + PHP + SQLite)

Thu Feb 07, 2013 10:58 pm

Max wrote:
Griffen wrote:How do i change the ip address to a static one?
Switch over to tty2 (ctrl+alt+f2) and do "vi /etc/network/interfaces"
Syntax of the interfaces file is the same as on Debian based distributions.
I'm sort of a newbie so from there I would just type the ip address I want to staticly assign or is there further commands to enter after?

Max

Re: Minimal webserver distribution (Lighty + PHP + SQLite)

Thu Feb 07, 2013 11:11 pm

Griffen wrote:I'm sort of a newbie so from there I would just type the ip address I want to staticly assign or is there further commands to enter after?
If you do not have prior Linux experience, this image might not be the first to try.

You need to login as root, use vi to edit the configuration file, and reboot.
A vi tutorial (the only text editor available in the 5 MB image): http://www.youtube.com/watch?v=XSXoap2h3Mw
Structure of the /etc/network/interfaces configuration file you need to edit: http://wiki.debian.org/NetworkConfigura ... e_manually
Need to replace the current "iface eth0 inet dhcp" in that file with a "iface eth0 inet static" section with the ip/netmask/gateway settings you want to have.

Tryph
Posts: 6
Joined: Wed Feb 20, 2013 12:38 pm

Re: Minimal webserver distribution (Lighty + PHP + SQLite)

Wed Feb 20, 2013 12:50 pm

Hello,

I installed BerryWebserver yesterday and still searching for change the keyboard layout.

I have a AZERTY keyboard but the pi consider it as a QWERTY one.
I have a /etc/default/keyboard file in which XKBLAYOUT is defined to "fr" but it doesn't change anything and all methods to change keyboard layout i seen on internet didn't help me.

do you know how i could change this keyboard layout to a AZERTY one?

Return to “Networking and servers”