, ,

References used:

  1. Raspberry Pi web server – LAMP

  2. Creating a LAMP server (web server – Linux Apache Mysql PHP) with the Raspberry Pi

  3. Raspberry Pi Web Server

  4. Setting up web server using Raspbian Wheezy

LAMP stands for Linux Apache MySQL PHP. With web server, I can create a web app for home automation and monitor it from anywhere.

Things I did:

  1. Set a hostname
    sudo nano /etc/dhcp/dhclient.confuncomment the line #send host-name "andare.fugue.com" and change “andare.fugue.com” to “raspberrypi”

    raspberrypi can be anything you want your hostname to be.

    There is another file to change.
    sudo nano /etc/hostname
    type in the hostname

    Add hosts
    sudo nano /etc/hosts
    comment out localhost
    add XX.XX.XX.XX(your IP) localhost
    XX.XX.XX.XX your-hostname

  2. Update password
    passwd pi

Next, to set up web server, make sure R-Pi is connected to the internet.

  1. Perform updates
    sudo apt-get upgrade && sudo apt-get update
  2. Install Apache
    sudo apt-get install apache2 apache2-doc apache2-utils
  3. Install PHP
    sudo apt-get install libapache2-mod-php5 php5 php-pear php5-xcache
    sudo apt-get install php5-mysql
  4. Install MySQL
    sudo apt-get install mysql-server mysql-client Remember to set a password when prompt
  5. Install phpmyadmin
    sudo apt-get install phpmyadmin
    There are two adjustments to the configurations necessary before you can use phpMyAdmin.
    First edit the php.ini file to include a MySQL library:
    sudo nano /etc/php5/apache2/php.ini
    Then type the following text into the Dynamic Extensions section about two thirds down the page:
    As things stand, there is no provision for showing the phpMyAdmin pages from your default web page directory. To such an create an entry make a symbolic link in the Apache2 data directory, as follows:
    sudo cd /var/www
    ln -s /usr/share/phpmyadmin
  6. Install vsftp
    sudo apt-get install vsftpd
    Follow some steps here

For information about the above installation process, please refer to those reference links.
Create an extra file to list the servername.
sudo nano /etc/apache2/conf.d/servername.conf
To stop/start the server,
sudo service apache2 stop
sudo service apache2 start