Setting up a Raspberry Pi Web Server with Debian Wheezy

  • Connect network cable, keyboard and screen for this.
  • Rasppberry Pi downloads
  • Install Debian Wheezy on an SD card, boot the Pi and log in (default user id = pi, password = raspberry)
  • type sudo apt-get install tasksel to install the tasksel server installation utility
  • type sudo tasksel to start tasksel
  • use space bar to select SSH and Web services to be installed
  • tab to Ok and hit return
  • type ip addr to find the IP address and note it
  • type sudo mv /boot/boot_enable_ssh.rc /boot/boot.rc to enable SSH
  • poweroff sudo poweroff and disconnect mouse, keyboard and screen and reboot unattended
  • Use the IP address to connect to the Pi via SSH from another machine
  • eg type: ssh pi@
  • once connected type sudo apt-get update to update the package list
  • type sudo apt-get upgrade - may take a while to get up to date
  • type sudo apt-get install libgd2-xpm-dev apache2-prefork-dev mysql-server libmysqlclient-dev to install some packages
  • when asked for mysql passwords do not enter anything, leave blank, tab to OK and hit return
  • To configure Apache
    • make sure you have a public_html folder in your home area, if not, create one and a cgi-bin folder inside this
    • type mkdir public_html
    • type mkdir public_html/cgi-bin
    • to edit the apache config file type: sudo nano /etc/apache2/sites-available/default
    • change the ScriptAlias /cgi-bin/ entry to /home/pi/public_html/cgi-bin/
    • change Directory to "/home/pi/public_html/cgi-bin" my version looks like this:
      	ScriptAlias /cgi-bin/ /home/pi/public_html/cgi-bin/
      	<Directory "/home/pi/public_html/cgi-bin">
      		AllowOverride None
      		Options +ExecCGI -MultiViews +SymLinksIfOwnerMatch
      		Order allow,deny
      		Allow from all
  • To configure MySQL
    • type: mysql -u root mysql to enter the MySQL system prompt
    • type: create database test; and hit return
    • type: grant all privileges on test.* to ' '@'localhost'; and hit return
    • type: flush privileges; and hit return
    • type: use test; and hit return
    • type: create table CIL (ITEM1 varchar(255),ITEM2(varchar(255)); and hit return
    • type: quit; and hit return
    • note that mysql commands end with a semi-colon ;
  • type:wget to get the source code bundle
  • type:unzip to unzip
  • type:cd cpilto move to the cpil directory just created
  • type:make all to compile the examples
  • examples are visible remotely in a browser eg