Monday, August 6, 2012

Raspberry Pi, the Second Helping

Have you ordered yourself one of these yet? No? Well what's wrong with you? They're fun. I'm going to proceed to be a really lousy inspiration for you to get one by telling you about some of the things I've done and had trouble with.

First of all I decided to stick with Raspbian as the OS simply because it is pretty far along and has a lot of support right now. In the mean time Gentoo has starting making releases, and I expect they will be another very popular option.

I dedided a good challenge would be to replace my Windows based server (previously mentioned Intel Atom in a spacious rack mount bay). The main features it would require are:

  1. Remote Music Player (accessible by phone/tablet)
  2. Web Server (HTTP, PHP, PERL, MySQL)
  3. FTP Server (FTP/SFTP)
  4. Download Server (accessible by phone/tablet)

Looking down these they all are things to be accessed remotely, and I would have very little use for a desktop environment for them. Since a desktop takes a lot of overhead I decided I should stick to the command line. And I haven't booted the desktop environment since. Fun right? No, seriously. It's fun. You just forgot. Like I did. Because most of us only crack open a terminal window every now and then when someone hasn't made a button to do something for us. Or perhaps check our IP address or something.

This also means at some point I unplugged the mouse and couldn't think of a reason to plug it back in. I replaced it with an external hard drive, which, BTW, needs to either have its own power source or be plugged in to a powered USB hub. The 'Pi doesn't have much juice on the ports.

The web server and FTP seemed like a good place to start, so I pulled in the packages for this:

sudo apt-get install apache2
sudo apt-get install php5
sudo apt-get install mysql-client mysql-server
sudo apt-get install postfix

And that was pretty much it. Apache is the http stuff, PHP is a useful programming language for web that things like wordpress run on, MySQL is database, and postfix is email (which is useful for having your pages send messages out). I made some minor adjustments to /etc/apache2/httpd.conf and /etc/apache2/ports.conf using a command line text editor, example:

sudo pico /etc/apache2/httpd.conf

(You make your edits and then press ctrl + x and follow the prompts from there. There are other command line editors besides pico, so dig around and find one you like. Or don't. I mean it's editing things with a keyboard. There probably isn't a text editor that will make unicorns shoot out of your pupils.)

Speaking of, this is where I noticed my first "oops." It turns out that the default keyboard setup is for Britain, and so my Amuricah the Keyboard had a few keys rearranged and inaccessible (*nix is hard to work with when you don't have a \, ~, or |, even if you can find they swapped # and @ to other places Plus it means you have to curse at the machine without censoring). Fix this by changing "gb" to "us" in /etc/default/keyboard. Unless you're British. In which case chortle at the yank' luddites.

A quick check by going to the Pi's local IP address from another computer confirmed I had web service running.

Next up was FTP:

sudo apt-get install vsftpd

I had to edit this one a fair amount to get users added to the system. You can find a lot of info about this by reading about VSFTPD, it's not difficult but this post is going to be long enough already.

At any rate I did manage to get it working, got permissions set on the folders that would be used, and made an alias to the web server's www directory using

mount --bind [a] [b]

where [a] = what you want to link from and [b] is where you want to link to, in my case /srv/ftp/www and /var/www respectivly. This knowledge will come in handy later when you decide you want large folder of files to not reside on the SD card.

More to come...


  1. This comment has been removed by a blog administrator.

  2. This comment has been removed by a blog administrator.