howto: install debian, updates, mysql, cherokee web svr, php

10 posts
by Fuzzwah » Tue Jun 05, 2012 6:19 am
I just ran through this process on my RPi and noted down all the steps I took to do a completely headless install (ie: no monitor or keyboard plugged into the RPi) of the debian squeeze image, update the system, install and run hexxeh's rpi-update tool, set up my ssh authorized keys, install mysql client and server, the cherokee web server and php5.

I figured I may as well share it here on the off chance it helps someone out.


- slotted sd card into laptop's card reader
- used win32diskimager to write the debian squeeze img to sd card
- opened boot partition and renamed boot_enable_ssh.rc to boot.rc (as I run my rpi headless and only access via ssh)
- rebooted laptop into gparted live
- used gparted to modify sd card partitions to make full use of 16gb

- rebooted laptop back into windows; launched dhcp server on laptop
- configured internet sharing of wifi connection
- plugged rpi network directly into laptop network
- slotted sd card into rpi and booted
- ping -t (the first ip of my dhcp range)
- once it was replying, connected to rpi via ssh using putty
- log into rpi

note: everything below which is prefixed with a ]$ is a command completed via the putty ssh terminal window

- configure timezone
Code: Select all
$ sudo dpkg-reconfigure tzdata

- update apt package list, needed to run this twice to fix error
Code: Select all
$ sudo apt-get update

- update debian system files
Code: Select all
$ sudo apt-get upgrade

- install certificate authority certs
Code: Select all
$ sudo apt-get install ca-certificates

- install hexxeh's rpi-update tool
Code: Select all
$ sudo wget -O /usr/bin/rpi-update && chmod +x /usr/bin/rpi-update

- rpi-update requires git (and I use git to version my own code too)
Code: Select all
$ sudo apt-get install git-core

- run hexxeh's tool to update rpi firmware
Code: Select all
$ sudo rpi-update

- reboot the rpi to complete updates
Code: Select all
$ sudo shutdown -r now

- log back into the rpi when it comes back up
- setup rpi's ssh to automate future logins via authorized key
Code: Select all
$ mkdir .ssh

Code: Select all
$ chmod 700 .ssh/

- fire up the text editor (nano) and create an authorized_keys file where I paste in my public key (which I generated on my laptop), save and exit
Code: Select all
$ nano .ssh/authorized_keys

- change the permissions of the auth_key file
Code: Select all
$ chmod 600 .ssh/authorized_keys

note: I decided to use cherokee over apache because it is slimmer and far more simple to administer
I basically use the same steps from here: ... an-squeeze
But I found that this guide didn't mention creating the www-data group

- install mysql, during this process you will be prompted to set a mysql root password
Code: Select all
$ sudo apt-get install mysql-server mysql-client

- create the www-data group which the cherokee process will run under
Code: Select all
$ sudo addgroup www-data

- install cherokee webserver
Code: Select all
$ sudo apt-get install cherokee

- fire up a web browser on my laptop and plug in the rpi's ip address and confirm that the placeholder page is displayed

- install php5
Code: Select all
$ sudo apt-get install php5-cgi

- edit the php config file
Code: Select all
$ sudo nano /etc/php5/cgi/php.ini

- hit ctrl+W and search for "cgi.fix_pathinfo=1", remove the ; form the front of the line (aka uncomment)

- restart cherokee so it will pick up php
Code: Select all
$ /etc/init.d/cherokee restart

- fire up the cherokee admin webpage
Code: Select all
$ sudo cherokee-admin -b

- in a web browser on my laptop I connect to using the details which were output on the rpi's ssh window
- go to vServers, pick the default vhost and go to the Behavior tab; click the Rule Management button
- click the "New" button next to Behavior to add a new rule
- an overlay window pops up; select "Languages" from the left column, then choose "PHP" and click the "Add" button
- click the "Create" button in the Configuration Assistant window:
- to finalize the setup, click the box that says NON FINAL and it should change to FINAL
- in the upper right corner there should now be a "Save" link - click it to save the new configuration
- click the "Graceful restart" button

- back in the rpi ssh window, hit ctrl+C to shut down the cherokee admin web page

- grant my pi user permissions of the www directory
Code: Select all
$ sudo chown -R pi www/

- create a file to test php
Code: Select all
$ nano /var/www/info.php

- paste in the following: <?php phpinfo(); ?>
- ctrl+X and save

- in the web browser on my laptop I punch in which should display a whole stack of info about the system

- do a little dance, your RPi is now a little web server
User avatar
Posts: 7
Joined: Mon Jun 04, 2012 6:29 am
by TWAWLW » Tue Jun 05, 2012 2:08 pm
Brillant! Just what i was looking for. Will try it as soon as my piece of pi arrives ... :)
User avatar
Posts: 7
Joined: Tue Feb 14, 2012 9:41 am
Location: Dormagen, Germany
by mwlphelps » Tue Jun 05, 2012 7:01 pm
The very first step should be to change the default password with the 'passwd' command!

Posts: 1
Joined: Tue Jun 05, 2012 6:59 pm
by Fuzzwah » Tue Jun 05, 2012 9:12 pm
mwlphelps wrote:The very first step should be to change the default password with the 'passwd' command!


Indeed! So obvious I left it out. Oooops.
User avatar
Posts: 7
Joined: Mon Jun 04, 2012 6:29 am
by vi_RUS » Wed Jun 06, 2012 6:55 am
Hi to all,
So my comments
A lot of time I serch in forums default login - username "pi" and password "raspberry" :)
sudo wget -O /usr/bin/rpi-update && chmod +x /usr/bin/rpi-update

chmod not working for me, get permission error. I use standalone
Code: Select all
sudo chmod +x /usr/bin/rpi-update
Posts: 1
Joined: Wed Jun 06, 2012 6:28 am
by Midnight Caller » Thu Jun 07, 2012 8:30 pm
@Fuzzwah, Thank you for the step by step guide, Will try it as soon as my Raspberry Pi arrives.
Please remember that I am Dyslexic wen replying
User avatar
Posts: 28
Joined: Sat Feb 11, 2012 9:54 pm
Location: UK
by jkflash » Sat Jun 09, 2012 8:47 pm
Thanks, that was really helpful. For anyone else following the above - you need to install the php5-mysql package as well, if you want the mysql server from PHP.
Posts: 1
Joined: Sat Jun 09, 2012 8:39 pm
by Fuzzwah » Mon Jun 11, 2012 4:01 am
Good catch on the php5-mysql, I actually rebuilt my server and realised that I'd missed that in the apt-get command line.

The other package I realised I missed was ntpdate, which will sync the time on your pi against an internet server.

Wish I could edit the original post :(
User avatar
Posts: 7
Joined: Mon Jun 04, 2012 6:29 am
by warby » Thu Jun 28, 2012 10:45 pm
Success! Although the partition ran out of space after adding one html page :lol:
Posts: 7
Joined: Thu Dec 29, 2011 7:23 pm
by juvan » Thu Aug 08, 2013 5:48 pm
Hi, I encountered an issue when installing cherokee.

When typing the command "sudo apt-get install cherokee" I get the following message:

Reading package lists... Done
Building dependency tree
Reading state information... Done
Package cherokee is not available, but is referred to by another package.
This may mean that the package is missing, has been obsoleted, or
is only available from another source

E: Package 'cherokee' has no installation candidate

What am I missing?
Posts: 1
Joined: Wed Aug 07, 2013 12:50 pm