How to Make a Raspberry Pi Web Server

Obtain a copy of the Raspberry Pi OS (Operating System) from the link in the sources section., Extract the image to the SD card.,Once done burning, you can place the SD card into your Raspberry Pi, then plug in the rest of the cords, being sure to...

36 Steps 2 min read Advanced

Step-by-Step Guide

  1. Step 1: Obtain a copy of the Raspberry Pi OS (Operating System) from the link in the sources section.

    There are a few different distributions available, but for this article, we will be using the "Raspbian" version. , To do this, we need a tool called the Win32 Disc Imager.

    A link for this is also available in the sources section.

    Now open the tool, navigate to the drive letter that your SD card is in, select the location of the Raspberry Pi OS image, and select burn.,, The default username is "pi"

    and the default password is "raspberry"., From the command line type: passwd pi , Please note, the cursor will not move when typing passwords but you are entering text., First, we are going to update the clock, update our sources, then upgrade any pre-installed packages.

    Type the following at the command line (press return/enter after each line): sudo dpkg-reconfigure tzdata sudo apt-get update sudo apt-get upgrade , From the command line type (replace parts as necessary): sudo date
    --set="30 December 2013 10:00:00"

    To do this, run the following commands (press return/enter after each line): sudo apt-get install ca-certificates sudo apt-get install git-core sudo wget https://raw.github.com/Hexxeh/rpi-update/master/rpi-update
    -O /usr/bin/rpi-update && sudo chmod +x /usr/bin/rpi-update sudo rpi-update sudo shutdown
    -r now , To do this, first note the I.P. address of the Raspberry Pi: ifconfig You should see something like this: eth0 Link encap:
    Ethernet HWaddr fe:fd:45:xx:xx:xx inet addr:69.164.xxx.xxx Bcast:69.164.xxx.xxx Mask:255.255.255.0 inet6 addr: fe80::fcfd:xxx:xxx:xxx/64 Scope:
    Link UP BROADCAST RUNNING MULTICAST MTU:1500 Metric:1 RX packets:35463998 errors:0 dropped:0 overruns:0 frame:0 TX packets:30563995 errors:0 dropped:0 overruns:0 carrier:0 collisions:0 txqueuelen:1000 RX bytes:11300336376 (11.3 GB) TX bytes:33179556297 (33.1 GB) Interrupt:76 Make sure you are connected to internet!! The tag eth0 will appear if you have ethernet plugged in.

    Wireless might be wlan0, but could differ.

    On the second line "inet addr:69.164.xxx.xxx" is the IP address of your Raspberry Pi., Hint:
    If an error occurs, use the command below, and then the command up above. sudo apt-get install ssh Then, restart your pi: sudo shutdown
    -r now , These are no longer necessary, as everything else will be done over SSH.,,,, address of your Raspberry Pi into your web browser.

    You should see a simple page that says "It Works!"

    ,,,,,,,,,
  2. Step 2: Extract the image to the SD card.

  3. Step 3: Once done burning

  4. Step 4: you can place the SD card into your Raspberry Pi

  5. Step 5: then plug in the rest of the cords

  6. Step 6: being sure to plug in the mini USB last.

  7. Step 7: Once the operating system finishes loading

  8. Step 8: you will need to log in.

  9. Step 9: Start by changing the password.

  10. Step 10: Enter your new password and then confirm it.

  11. Step 11: Because you are running a fresh version of Debian

  12. Step 12: you will need to do some housecleaning

  13. Step 13: updating

  14. Step 14: and installing.

  15. Step 15: Set the date and time.

  16. Step 16: we want to install Hexxeh's RPI update tool to help keep Raspberry Pi up to date.

  17. Step 17: we are going to set up SSH so that we can do everything else from a different computer.

  18. Step 18: Now enable SSH and reboot (press return/enter after each line): After noting the inet addr use: sudo /etc/init.d/ssh start for every time you boot up the pi.

  19. Step 19: You can now unplug the cords for your USB keyboard and your monitor.

  20. Step 20: Download an SSH client like PuTTy (www.putty.org) which can be downloaded for free from Google and connect to the IP address of your Raspberry Pi logging in with the username "pi" and the password you set earlier.

  21. Step 21: To install Apache and PHP

  22. Step 22: execute the following commands: sudo apt-get install apache2 php5 libapache2-mod-php5

  23. Step 23: Now restart the service: sudo service apache2 restart OR sudo /etc/init.d/apache2 restart

  24. Step 24: Enter the I.P.

  25. Step 25: To install MySQL

  26. Step 26: install a few packages with the following command: sudo apt-get install mysql-server mysql-client php5-mysql

  27. Step 27: We will now install FTP to allow transferring files to and from your Raspberry Pi.

  28. Step 28: Take ownership of the web root: sudo chown -R pi /var/www

  29. Step 29: install vsftpd: sudo apt-get install vsftpd

  30. Step 30: Edit your vsftpd.conf file: sudo nano /etc/vsftpd.conf

  31. Step 31: Make the following changes: anonymous_enable=YES to anonymous_enable=NO Uncomment local_enable=YES and write_enable=YES by deleting the # symbol in front of each line then go to the bottom of the file and add force_dot_files=YES.

  32. Step 32: Now save and exit the file by pressing CTRL-O

  33. Step 33: CTRL-X.

  34. Step 34: Now restart vsftpd: sudo service vsftpd restart

  35. Step 35: Create a shortcut from the Pi user's home folder to /var/www: ln -s /var/www/ ~/www

  36. Step 36: You can now FTP using the Pi user and access the /var/www folder via a shortcut that should appear on login.

Detailed Guide

There are a few different distributions available, but for this article, we will be using the "Raspbian" version. , To do this, we need a tool called the Win32 Disc Imager.

A link for this is also available in the sources section.

Now open the tool, navigate to the drive letter that your SD card is in, select the location of the Raspberry Pi OS image, and select burn.,, The default username is "pi"

and the default password is "raspberry"., From the command line type: passwd pi , Please note, the cursor will not move when typing passwords but you are entering text., First, we are going to update the clock, update our sources, then upgrade any pre-installed packages.

Type the following at the command line (press return/enter after each line): sudo dpkg-reconfigure tzdata sudo apt-get update sudo apt-get upgrade , From the command line type (replace parts as necessary): sudo date
--set="30 December 2013 10:00:00"

To do this, run the following commands (press return/enter after each line): sudo apt-get install ca-certificates sudo apt-get install git-core sudo wget https://raw.github.com/Hexxeh/rpi-update/master/rpi-update
-O /usr/bin/rpi-update && sudo chmod +x /usr/bin/rpi-update sudo rpi-update sudo shutdown
-r now , To do this, first note the I.P. address of the Raspberry Pi: ifconfig You should see something like this: eth0 Link encap:
Ethernet HWaddr fe:fd:45:xx:xx:xx inet addr:69.164.xxx.xxx Bcast:69.164.xxx.xxx Mask:255.255.255.0 inet6 addr: fe80::fcfd:xxx:xxx:xxx/64 Scope:
Link UP BROADCAST RUNNING MULTICAST MTU:1500 Metric:1 RX packets:35463998 errors:0 dropped:0 overruns:0 frame:0 TX packets:30563995 errors:0 dropped:0 overruns:0 carrier:0 collisions:0 txqueuelen:1000 RX bytes:11300336376 (11.3 GB) TX bytes:33179556297 (33.1 GB) Interrupt:76 Make sure you are connected to internet!! The tag eth0 will appear if you have ethernet plugged in.

Wireless might be wlan0, but could differ.

On the second line "inet addr:69.164.xxx.xxx" is the IP address of your Raspberry Pi., Hint:
If an error occurs, use the command below, and then the command up above. sudo apt-get install ssh Then, restart your pi: sudo shutdown
-r now , These are no longer necessary, as everything else will be done over SSH.,,,, address of your Raspberry Pi into your web browser.

You should see a simple page that says "It Works!"

,,,,,,,,,

About the Author

M

Marilyn King

Writer and educator with a focus on practical practical skills knowledge.

32 articles
View all articles

Rate This Guide

--
Loading...
5
0
4
0
3
0
2
0
1
0

How helpful was this guide? Click to rate: