PDF download Download Article PDF download Download Article

If you are looking for a way to make a cheap web server, primarily to be used as a testing environment or to store files, then the Raspberry Pi is perfect for you. What is a Raspberry Pi? It is an inexpensive mini computer, perfect for basic functions. This guide will show you how to take a new Raspberry Pi and turn it in to a web server. Please note that for this article, we will be working in Windows.

Part 1
Part 1 of 7:

Installing the Operating System

PDF download Download Article
  1. There are a few different distributions available, but for this article, we will be using the "Raspbian" version.
  2. 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. Wait for it to finish.
    Advertisement
  3. Just create a file with the name ssh . This is a security update introduced since Raspbian Jessie.
  4. Eject the SD card, and place it into your Raspberry Pi, then plug in the rest of the cords, being sure to plug in the mini USB last.
  5. The default username is "pi", and the default password is "raspberry". Newer versions of Raspbian have auto-login enabled by default.
  6. From the command line type:
      sudo passwd pi.
  7. 7
    You can also change your password by typing sudo raspi-config and selecting Change User Password or going to the System Configuration.
  8. Please note, the cursor will not move when typing passwords but you are entering text.
  9. Advertisement
Part 2
Part 2 of 7:

Updating Software

PDF download Download Article
  1. Because you are running a fresh version of Debian, you will need to do some housecleaning, updating, and installing. 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
  2. From the command line type (replace parts as necessary):
      sudo date --set = 
       "30 December 2013 10:00:00" 
      
  3. Advertisement
Part 3
Part 3 of 7:

Updating Firmware

PDF download Download Article
  1. 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
Part 4
Part 4 of 7:

Configuring SSH

PDF download Download Article
  1. 1
    Set up SSH so that we can do everything else from a different computer. To do this, first note the IP address of the Raspberry Pi
      hostname -I
    • You should see something like this:
    •  192 
      .168.1.17
    • What appears is the IP address of your Raspberry Pi.

    • After noting the inet addr use:
      
      sudo /etc/init.d/ssh start for 
      every time 
      you boot up the 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
  2. These are no longer necessary, as everything else will be done over SSH.
  3. 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.
  4. Advertisement
Part 5
Part 5 of 7:

Installing the Web Server

PDF download Download Article
  1. To do this, execute the following commands:
      sudo apt-get install apache2 php5 libapache2-mod-php5
    • sudo service apache2 restart

      OR
      sudo /etc/init.d/apache2 restart
  2. address of your Raspberry Pi into your web browser. You should see a simple page that says "It Works!"
  3. Advertisement


Part 6
Part 6 of 7:

Installing MySQL

PDF download Download Article
  1. To do this, install a few packages with the following command:
      sudo apt-get install mysql-server mysql-client php5-mysql
Part 7
Part 7 of 7:

Setting Up FTP

PDF download Download Article
    • sudo chown -R pi /var/www
    • sudo apt-get install vsftpd
    • sudo nano /etc/vsftpd.conf
    • 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 .
    • sudo service vsftpd restart
    • ln -s /var/www/ ~/www
  1. Advertisement


Community Q&A

Search
Add New Question
  • Question
    My Pi said PHP5 is no longer available. Should I update to 7.0?
    Community Answer
    Yes, you should.
  • Question
    How do I create a shortcut from the user's home folder to a specific folder? And when asked to log in with filezilla, what do I put in the "host" field?
    Community Answer
    As the host, you would put the IP (internet protocol) address of the Raspberry Pi. As for the shortcut, type into the terminal: cd ln -s [LOCATION OF FOLDER] ~/[NAME OF SHORTCUT].
  • Question
    Can you give an example of doing step 9?
    Community Answer
    After you've followed all the steps in the article go to a command line. In example - using Windows 10 - Press the Windows Key. Type "FTP". Type "open xxx.xxx.xxx.xxx" (Put your ip from the IFCONFIG you ran above, part 4, step 1). If all is OK you'll get: Connected to xxx.xxx.xxx.xxx - 220 (vsFTPd 3.0.2) (or something close). 200 Always in UTF8 mode. User (xxx.xxx.xxx.xxx:(non)): enter your login default is "pi". You should get: 331 Please specify the password. Password: enter your password, default is "raspberry". If the login and password are correct you will get: 230 Login successful ftp> type ls -- you'll see a directory list.
See more answers
Ask a Question
      Advertisement

      Tips

      • It's not necessary to install an FTP server if you have the SSH server installed. You can use an application such as WinSCP to connect via SCP which is safer and prevents the need to open up another port on your Raspberry Pi.
      • If you get an error message saying: "wget: command not found", run "sudo apt-get install wget"
      Submit a Tip
      All tip submissions are carefully reviewed before being published
      Name
      Please provide your name and last initial
      Thanks for submitting a tip for review!
      Advertisement

      Things You'll Need

      • Raspberry Pi (model B)
      • Blank SD card that is at least four gigabytes
      • Micro USB cable (for power)
      • Network cable with access to the internet
      • USB keyboard or SSH connection

      References

      1. https://www.raspberrypi.com/software/ - Raspberry Pi OS download
      2. https://launchpad.net/win32-image-writer - Win32 Disc Imager download

      About This Article

      Thanks to all authors for creating a page that has been read 771,748 times.

      Is this article up to date?

      Advertisement