The Raspberry Pi Superuser

Turning your little computer into a capable server.

Introduction:

OK, so you just unwrapped your shiny, new Raspberry Pi and set it up. Now, it's running Raspbian Linux, and you're wondering, "OK, that's all good, but what now?" No worries, you've come to the right place. Believe it or not, the little Pi has the potential to be a very capable server for SSH, telnet, HTTP, and other services, and unlocking that potential is only a few short commands away.

Let's get started.



Setting up SSH

SSH stands for secure shell, and it makes it easy for you to access your Pi from other locations using a terminal interface. Your Pi should already have an SSH Daemon running. To test it, open LXTerminal and type this:

sudo -s
ssh pi@127.0.0.1

When you get the password prompt, enter raspberry. If you are able to log in successfully, then the sshd (d is for daemon) is set up sucessfully. Now, you've got to figure out whether your Pi is on the Internet, or behind a subnet. The best way to test this is as follows. First, make sure that the three bottom lights (labeled "FDX", "LNK", and "10M") are lit on the Pi, then open an LXTerminal window and type the following:

sudo -s
ifconfig eth0

On the second line, next to "inet address," is your IP address. Go ahead and jot it down. Now, get a hold of an iPhone or Android phone near you and do the following.

If you're on an iPhone, get the app "Zatelnet". On Android, get the app ConnectBot. Then use the following credentials.

IP Address (Hostname on Android:) (use whatever you jotted down)
Port: 22
Username: pi
Password: raspberry

If you get in, then your Raspberry Pi is not on a subnet. If you can't get in, then click here to contact us. We might just be able to help out.

Of course, we're not done yet. There's plenty more that your new Pi can do.



Setting up telnet

Telnet is a lot like SSH, but it's less secure. We don't recommend using it unless you have a reason (like its extremely cool name,) but we're still going to show you how to set it up.

As usual, open an LXTerminal window. Then, type the following.

sudo -s
apt-get install telnetd

That's it! The inetd (Internet daemon) will restart and attach the telnetd. To test your brand-spanking-new telnetd, open an LXTerminal and type the following.

sudo -s
apt-get install telnet
telnet 127.0.0.1

Then enter pi for your username, and raspberry for your password.



Setting up an HTTP Server

Now, it's time for the big dog: the HTTP server. In case you don't know what that is, the hypertext transfer protocol (HTTP) is what drives the web; therefore, an HTTP server is just a fancy name for a web server.

Since the Raspberry Pi is a rather simple machine with low bandwidth, we'll install a micro HTTP server on it. To get started, go ahead and open an LXTerminal (shouldn't you know to do this already?) and type the following.

sudo -s
apt-get install micro_httpd

That's it! Simple, huh? To test it, type this into your terminal window.

midori 127.0.0.1

There should be a blank page displayed in the browser window. To add web pages to your new site, you're going to need to put them in the /var/www folder. W3Schools is a great place to learn HTML, but we've got a sample homepage for you here. Follow these instructions to set it up.

Click here to download a zip file containing the page, make sure to save it in /home/pi, then open LXTerminal and run these commands.

sudo -s
apt-get install zip
unzip /home/pi/index.zip
cp /home/pi/index.html /var/www/index.html
midori 127.0.0.1

Behold your handiwork!

A little bit of fun

If you've made it this far, we applaud you. You are well on your way to becoming a Raspberry Pi Superuser.

Before you leave, here's a little bit of fun. Open an LXTerminal window (last time, promise) and run this.

apt-get moo

What's that doing there? We'll leave you to figure that one out.

Copyright © Computer Sciences Club 2013