Wednesday, August 13, 2014

Raspberry Pi FTP Server

That's a nicely sized server if you ask me
For a while now I've been trying to set up a FTP Server using an Arduino Uno with an ethernet shield, and it's just not up to the job. An FTP server is a website that people can upload and download files to, effectively serving as a network drive that is accessed through a web browser.  I've found that the Arduino is capped at hosting http pages with the ethernet shield and an SD card, and I need something more to be able to use web services like php and java.  Earlier this week I was lucky enough to get my hands on a Rasbperry Pi model B+, and decided that it would be perfect for the job.

As a Mac user, interfacing with linux devices is relatively easy for me. Apple's Terminal application (Applications/Utilities/Terminal) is able to communicate via ssh with the Raspberry Pi and allows me to program it through the command line in what is referred to as a "headless" mode. In other words, I can program the Pi without access to an external monitor, keyboard, or mouse.  For those of you who are interested, I installed the Raspbian OS on my Raspberry Pi's SD card so that I could run headless from the first boot.

In order to get my Raspberry Pi set up as a FTP Server, I first installed Apache and PHP 5 through the command line.  I then installed phpFileManager onto the Raspberry Pi, and viola! I now have the ability to upload and save files to the SD card on my Raspberry Pi through any web browser, whether on my phone, laptop or computer.

Code/commands for creating your own FTP server after the break!

To start, connect an ethernet cord from your router to your Raspberry Pi's Ethernet port, and connect a micro-USB cable from the Pi to your computer. Run the following commands after SSHing into your Raspberry Pi through Terminal on your mac/linux computer or through PuTTY on a Windows computer.


  1. sudo apt-get update
  2. sudo apt-get install apache2 -y
  3. hostname -I
  4. sudo apt-get install php5 libapache2-mod-php5 -y
  5. sudo wget http://node-arm.herokuapp.com/node_latest_armhf.deb
  6. sudo dpkg -i node_latest_armhf.deb
  7. cd /var/www
  8. sudo rm index.html
  9. sudo wget http://prdownloads.sourceforge.net/phpfm/phpFileManager-0.9.8.zip?download
  10. sudo mv phpFileManager-0.9.8.zip?download phpFileManager-0.9.8.zip
  11. sudo unzip phpFileManager-0.9.8.zip
  12. sudo rm phpFileManager-0.9.8.zip
  13. cd
  14. sudo service apache2 restart


And that should be it! You should be able to access your server by typing your Pi's IP address into the address bar of your web browser. You can also install and experiment with any other PHP-based FTP server software using the same commands and replacing http://prdownloads.sourceforge.net/phpfm/phpFileManager-0.9.8.zip?download with the source to your desired software.  Let me know how it goes!


No comments:

Post a Comment